CodeQL library for JavaScript/TypeScript
codeql/javascript-all 2.2.2-dev (changelog, source)
Search

Primitive predicate QlBuiltins::BigInt::bitLength

Returns the number of bits in the minimal two’s complement representation of the receiver, excluding a sign bit. This means that the receiver is minimally representable as a bitLength()+1-bit signed integer. For positive BigInts, this is equivalent to the number of bits in the ordinary binary representation. For negative BigInts, this gives the same result as it does for the bitwise NOT of the BigInt. For zero and -1, this method returns 0. (Computes ceil(log2(if this < 0 then -this else this+1)).)

int bitLength()