@jani I had no idea what the difference is, but looked them up.
I'm still not sure after reading the code what they do, but I'm sure I'd use the wrong one occasionally.
@jani OK, did not check the implementation. I thought the point was to find the nearest power of two.
I’d probably use __fls()
and << 1
unless the exact same number (i.e. already pow2). Like for the stuff I thought it was used for to be more specific… I guess I stay away from those functions, feels for me more complicated to use them than do what I want open-coded :-) Probably would end up using them in a wrong way…
@jani While both functions may be defined in math.h, they are not intended to be called dorectly. see https://en.cppreference.com/w/c/numeric/math/round for more information on rounding functions exposed by math.h.
You should ALWAYS refer to the documentation. Js and python developers are notorious for shitty documentation, and for believing that the user should make assumptions about the function of a thing (like a function's return value).
@jani Documentation should never leave room for assumptions.