On 2014/01/17, at 4:20, Brendan Eich <[email protected]> wrote: > Not sure it matters. We could return -1 for any negative number, 0 for 0, and > > 0 for positive integral values.
It does matter, this specific issue makes the x86 instruction BSR a lot less useful than it could be. There they set a zero-flag instead of returning a defined value. This is enough of an issue that AMD introduced the LZCNT instruction that instead returns the input size, to mirror what other platforms do[1]. When I needed this function the last time (implementing audio codecs in JS) I would have needed that it worked essentially like the bitwise operators, and defined on the resulting 32-bit signed int. We already leak the 32-bitness of those operators, so leaking a 32-bitness on a few related functions wouldn’t be a big issue imho. [1] http://en.wikipedia.org/wiki/Find_first_set#Hardware_support _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

