es.math.clz32.js 312 B

12345678910111213
  1. var $ = require('../internals/export');
  2. var floor = Math.floor;
  3. var log = Math.log;
  4. var LOG2E = Math.LOG2E;
  5. // `Math.clz32` method
  6. // https://tc39.es/ecma262/#sec-math.clz32
  7. $({ target: 'Math', stat: true }, {
  8. clz32: function clz32(x) {
  9. return (x >>>= 0) ? 31 - floor(log(x + 0.5) * LOG2E) : 32;
  10. }
  11. });