Jason Orendorff (2014-01-16T22:27:14.000Z)
domenic at domenicdenicola.com (2014-01-24T19:55:10.410Z)
On Thu, Jan 16, 2014 at 3:12 PM, Jens Nockert <jens at nockert.se> wrote: > What is Math.bitlen(-1) then? Isn’t this just the same problem as before, except it happens for negative numbers instead of positive? No opinion. For the use cases I know of, speed matters: it is desired that this operation compile down to a CLZ or equivalent machine instruction, when the argument is in the range of uint32. I slightly prefer Math.clz32 to Math.bitlen for this reason. It's exactly what it says on the label. People searching for a JS equivalent of CLZ or __builtin_clz() are likely to find it. The specification can start with ToUint32 which already tells us how corner cases should behave.