es.math.clz32.js 324 B

1234567891011121314
  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. var n = x >>> 0;
  10. return n ? 31 - floor(log(n + 0.5) * LOG2E) : 32;
  11. }
  12. });