Calculates the number of one-bits in the 64-bit two's complement binary representation of the input.
Usage | Returns |
---|---|
Number.bitCount() | Number |
Argument | Type | Details |
---|---|---|
this: input | Number | The input value. |
Examples
JavaScript
print(ee.Number(0).bitCount()); // [0] print(ee.Number(1).bitCount()); // [1] print(ee.Number(2).bitCount()); // [1] print(ee.Number(3).bitCount()); // [2] print(ee.Number(0xFFFF).bitCount()); // [16] // https://en.wikipedia.org/wiki/Two's_complement signed values. print(ee.Number(-1).bitCount()); // [64] print(ee.Number(-1, ee.PixelType.int8()).bitCount()); // [64] print(ee.Number(-2).bitCount()); // [63]
Python
# Your example goes here!