-
Notifications
You must be signed in to change notification settings - Fork 200
Port bellard/quickjs sumPrecise #1170
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
Conversation
upstream added a more compact version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
a = float64_as_uint64(d); | ||
sgn = a >> 63; | ||
e = (a >> 52) & ((1 << 11) - 1); | ||
m = a & (((uint64_t)1 << 52) - 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a little more legible as:
m = a & (((uint64_t)1 << 52) - 1); | |
m = a & ((1ULL << 52) - 1); |
Although I can't fault you for being precise with types. Consider it just a suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, the rest of the code uses the uint64_t pattern too, so I think it's better to stick to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool!
It's more compact than xsum.