Opened 8 years ago
Closed 8 years ago
#10363 closed Feature Requests (fixed)
Used unsigned long pieces for GMP _ui functions
Reported by: | Owned by: | John Maddock | |
---|---|---|---|
Milestone: | To Be Determined | Component: | multiprecision |
Version: | Boost 1.56.0 | Severity: | Optimization |
Keywords: | Cc: |
Description
Hello,
looking for something else, I was surprised to notice that, when it gets an 'unsigned long long', boost splits it in pieces of type 'unsigned' to pass them to GMP functions, when it could use bigger 'unsigned long' pieces for better performance. When long and long long have the same size, it would avoid any splitting.
Also, I believe using << or >> with numeric_limits<unsigned>::digits is undefined behavior if int and long long have the same size (maybe that's why you didn't use long, because there are much fewer platforms where int and long long have the same size).
Thanks, you're quite right on all counts, fixed in https://github.com/boostorg/multiprecision/commit/3719752df50e2b93a2eb7ad1784641fd8922eb97.
Also quashed GCC warnings when using long long in -ansi mode: https://github.com/boostorg/multiprecision/commit/0de03d129db4ac71e593c5243d953fa0df83a04c