Bug 15973 – nextPow2 and truncPow2 rely on processor specific behavior

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-04-29T20:06:00Z
Last change time
2016-05-02T16:26:19Z
Assigned to
jack
Creator
jack

Comments

Comment #0 by jack — 2016-04-29T20:06:43Z
The integer version of nextPow2 uses >> on numbers that cause overflow. The behavior of this operation is processor specific, so the function should just return 0 if val == T.max/T.min
Comment #1 by github-bugzilla — 2016-05-02T16:26:19Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/6d8f0b8285c67422f0463b30d5afc9c82c6d3dfb Fixed Issue 15973: nextPow2 and truncPow2 rely on processor specific behavior https://github.com/dlang/phobos/commit/aa8cf8646f1cedb058a51465da5b962f98b42cd7 Merge pull request #4268 from JackStouffer/issue15973 [Issue 15973]: nextPow2 and truncPow2 rely on processor specific …