Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Make it possible again to compile cmp.c as C++. #8

Merged
merged 1 commit into from
Jan 24, 2024

Conversation

iphydf
Copy link
Member

@iphydf iphydf commented Jan 23, 2024

This change is Reviewable

@iphydf iphydf added this to the master milestone Jan 23, 2024
@iphydf iphydf force-pushed the cxx branch 5 times, most recently from 44fbd7a to 85749bc Compare January 23, 2024 21:49
Copy link
Member

@JFreegman JFreegman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status: 0 of 1 approvals obtained (waiting on @iphydf)


cmp.c line 144 at r1 (raw file):

static uint64_t be64(uint64_t x) {
  if (!is_bigendian())
    return ((uint64_t)be32((uint32_t)(x & 0xffffffff)) << 32) | (uint64_t)be32((uint32_t)(x >> 32));

A simple call to be64() ends up making a call stack of 14. Is this really an improvement? Does it matter for our use case?

Copy link
Member Author

@iphydf iphydf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 1 approvals obtained (waiting on @JFreegman)


cmp.c line 144 at r1 (raw file):

Previously, JFreegman wrote…

A simple call to be64() ends up making a call stack of 15. Is this really an improvement? Does it matter for our use case?

Is your concern code clarity or performance? If it's the latter: the code generated for the function before and after is exactly the same: 1 instruction bswapq. If it's the former: how would you write it to be clearer?

Copy link
Member

@JFreegman JFreegman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @iphydf)


cmp.c line 144 at r1 (raw file):

Previously, iphydf wrote…

Is your concern code clarity or performance? If it's the latter: the code generated for the function before and after is exactly the same: 1 instruction bswapq. If it's the former: how would you write it to be clearer?

My concern was with performance. If that's the case, ignore this comment.

@iphydf iphydf merged commit 065b1ca into TokTok:master Jan 24, 2024
7 checks passed
@iphydf iphydf deleted the cxx branch January 24, 2024 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants