es.math.clz32.js 338 B

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