You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
471 B
26 lines
471 B
|
|
var N1 = Math.pow(2, 7)
|
|
var N2 = Math.pow(2, 14)
|
|
var N3 = Math.pow(2, 21)
|
|
var N4 = Math.pow(2, 28)
|
|
var N5 = Math.pow(2, 35)
|
|
var N6 = Math.pow(2, 42)
|
|
var N7 = Math.pow(2, 49)
|
|
var N8 = Math.pow(2, 56)
|
|
var N9 = Math.pow(2, 63)
|
|
|
|
module.exports = function (value) {
|
|
return (
|
|
value < N1 ? 1
|
|
: value < N2 ? 2
|
|
: value < N3 ? 3
|
|
: value < N4 ? 4
|
|
: value < N5 ? 5
|
|
: value < N6 ? 6
|
|
: value < N7 ? 7
|
|
: value < N8 ? 8
|
|
: value < N9 ? 9
|
|
: 10
|
|
)
|
|
}
|