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

library_int53: range assertion warnings, comments #16879

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kainino0x
Copy link
Collaborator

Extracted from old PR #15244.

Per comment there:
#15244 (comment)
These changes seemed to optimize away fully in non-ASSERTIONS builds.

@kainino0x kainino0x force-pushed the int53-assertions branch from 2eed90c to 21cbc89 Compare May 4, 2022 23:38
}
var result = (lo >>> 0) + (hi >>> 0) * 4294967296;
#if ASSERTIONS
if ((result >>> 0) != (lo >>> 0)) warnOnce('convertU32PairToI53() resulted in rounding (lo=0x' + lo + ', hi=0x' + hi + ') to 0x' + result.toString(16));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why wouldn't I want to warn each time this happens? Also, why not make it an assertion?

If there valid use cases for passing out-of-range values to this API, then presumably the developer will want to way to disable the warning or assertion whichever one we go with.

If there are no valid reasons then I think assertion makes more sense.

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