-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Yet another simplification of Dragonbox #2984
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1276,8 +1276,6 @@ template <> struct float_info<float> { | |
static const int small_divisor = 10; | ||
static const int min_k = -31; | ||
static const int max_k = 46; | ||
static const int divisibility_check_by_5_threshold = 39; | ||
static const int case_fc_pm_half_lower_threshold = -1; | ||
Comment on lines
-1279
to
-1280
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should these be removed from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ha. Another careless mistake. Sorry about that, it's fixed now. |
||
static const int shorter_interval_tie_lower_threshold = -35; | ||
static const int shorter_interval_tie_upper_threshold = -35; | ||
}; | ||
|
@@ -1290,8 +1288,6 @@ template <> struct float_info<double> { | |
static const int small_divisor = 100; | ||
static const int min_k = -292; | ||
static const int max_k = 326; | ||
static const int divisibility_check_by_5_threshold = 86; | ||
static const int case_fc_pm_half_lower_threshold = -2; | ||
static const int shorter_interval_tie_lower_threshold = -77; | ||
static const int shorter_interval_tie_upper_threshold = -77; | ||
}; | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why switch to bitwise AND? Better codegen?
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.
Yes. With logical AND, it generates three
test
instructions and three conditional branches. With bitwise AND, it generates twotest
instructions and two conditional branches. I thought compilers are aware of how to optimize this when all the things are just booleans variables (thus no short-circuit is really involved), but apparently they don't bother doing so. I am not sure why...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.
I guess, compilers are not sure if all boolean variables involved are really just 0 or 1. Like, if one is
2
and another is1
, they are bothtrue
so&&
should givetrue
, but&
will give0
. It is wrong from the first place to usebool
for things with more than two states, but maybe the current standard allowsbool
variables to hold nonsensical values without UB.