big-rat
Version:
A big integer rational number
20 lines (16 loc) • 320 B
JavaScript
var db = require('double-bits')
var ctz = require('bit-twiddle').countTrailingZeros
module.exports = ctzNumber
//Counts the number of trailing zeros
function ctzNumber(x) {
var l = ctz(db.lo(x))
if(l < 32) {
return l
}
var h = ctz(db.hi(x))
if(h > 20) {
return 52
}
return h + 32
}