Sm!rk wrote:
Just out of interest (and I can't think of any reason to need this) what do you need to do this for?
In Varium a number is shifted right by a user-supplied value (can't divide due to performance). In the config file instead of requiring the user to specify a shift value, they can specify the actual numeric value. So they get to express in familar world units, instead of providing something more abstract like an exponent.
However, I'm thinking of using something different. If the user supplies 4095, it would be better to round up to 4096, so the exponent is 12. The routines listed above would all return the highest bit 11, giving a result 50% less then desired.
Dan East