Open
Bug 1370435
Opened 9 years ago
Updated 3 years ago
RoundUpPow2 should be templated on the argument type
Categories
(Core :: MFBT, enhancement)
Tracking
()
NEW
People
(Reporter: mozbugz, Unassigned)
Details
RoundUpPow2 always takes a size_t and returns a size_t.
This is inconsistent with other MathAlgorithms.h functions, which are templated on the argument type.
And internally RoundUpPow2 uses CeilingLog2, which is also templated, so it should be easy enough to make RoundUpPow2 templated as well.
However, before proceeding we should first verify that all existing uses don't actually rely on the return type being size_t!
Note that RoundUpPow2 returns the next power of 2 for |x| (i.e., the sign is ignored).
So in case of a signed input type, we'll need to decide whether to return the exact same type (which is probably more useful in most use cases), or the unsigned equivalent (which feels more type-safe with regards to the result).
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•