Method countbits
countbits(int)
Returns number of 1-bits in the binary representation of an int value. Also known as the Hamming weight, popcnt on x86, and vcnt on ARM.
Declaration
public static int countbits(int x)
Parameters
Type | Name | Description |
---|---|---|
int | x | int value in which to count bits set to 1. |
Returns
Type | Description |
---|---|
int | Number of bits set to 1 within x. |
countbits(int2)
Returns component-wise number of 1-bits in the binary representation of an int2 vector. Also known as the Hamming weight, popcnt on x86, and vcnt on ARM.
Declaration
public static int2 countbits(int2 x)
Parameters
Type | Name | Description |
---|---|---|
int2 | x | int2 value in which to count bits for each component. |
Returns
Type | Description |
---|---|
int2 | int2 containing number of bits set to 1 within each component of x. |
countbits(int3)
Returns component-wise number of 1-bits in the binary representation of an int3 vector. Also known as the Hamming weight, popcnt on x86, and vcnt on ARM.
Declaration
public static int3 countbits(int3 x)
Parameters
Type | Name | Description |
---|---|---|
int3 | x | Number in which to count bits. |
Returns
Type | Description |
---|---|
int3 | int3 containing number of bits set to 1 within each component of x. |
countbits(int4)
Returns component-wise number of 1-bits in the binary representation of an int4 vector. Also known as the Hamming weight, popcnt on x86, and vcnt on ARM.
Declaration
public static int4 countbits(int4 x)
Parameters
Type | Name | Description |
---|---|---|
int4 | x | Number in which to count bits. |
Returns
Type | Description |
---|---|
int4 | int4 containing number of bits set to 1 within each component of x. |
countbits(uint)
Returns number of 1-bits in the binary representation of a uint value. Also known as the Hamming weight, popcnt on x86, and vcnt on ARM.
Declaration
public static int countbits(uint x)
Parameters
Type | Name | Description |
---|---|---|
uint | x | Number in which to count bits. |
Returns
Type | Description |
---|---|
int | Number of bits set to 1 within x. |
countbits(uint2)
Returns component-wise number of 1-bits in the binary representation of a uint2 vector. Also known as the Hamming weight, popcnt on x86, and vcnt on ARM.
Declaration
public static int2 countbits(uint2 x)
Parameters
Type | Name | Description |
---|---|---|
uint2 | x | Number in which to count bits. |
Returns
Type | Description |
---|---|
int2 | int2 containing number of bits set to 1 within each component of x. |
countbits(uint3)
Returns component-wise number of 1-bits in the binary representation of a uint3 vector. Also known as the Hamming weight, popcnt on x86, and vcnt on ARM.
Declaration
public static int3 countbits(uint3 x)
Parameters
Type | Name | Description |
---|---|---|
uint3 | x | Number in which to count bits. |
Returns
Type | Description |
---|---|
int3 | int3 containing number of bits set to 1 within each component of x. |
countbits(uint4)
Returns component-wise number of 1-bits in the binary representation of a uint4 vector. Also known as the Hamming weight, popcnt on x86, and vcnt on ARM.
Declaration
public static int4 countbits(uint4 x)
Parameters
Type | Name | Description |
---|---|---|
uint4 | x | Number in which to count bits. |
Returns
Type | Description |
---|---|
int4 | int4 containing number of bits set to 1 within each component of x. |
countbits(ulong)
Returns number of 1-bits in the binary representation of a ulong value. Also known as the Hamming weight, popcnt on x86, and vcnt on ARM.
Declaration
public static int countbits(ulong x)
Parameters
Type | Name | Description |
---|---|---|
ulong | x | Number in which to count bits. |
Returns
Type | Description |
---|---|
int | Number of bits set to 1 within x. |
countbits(long)
Returns number of 1-bits in the binary representation of a long value. Also known as the Hamming weight, popcnt on x86, and vcnt on ARM.
Declaration
public static int countbits(long x)
Parameters
Type | Name | Description |
---|---|---|
long | x | Number in which to count bits. |
Returns
Type | Description |
---|---|
int | Number of bits set to 1 within x. |