目录

CountBitsCntSameAsSignBit

Function Description

Computes the number of consecutive bits that are the same as the sign bit from the most significant bit in the binary number of the int64_t type.

If the input is –1 (all bits are 1) or 0 (all bits are 0), –1 is returned.

Function Prototype

__aicore__ inline int64_t CountBitsCntSameAsSignBit(int64_t valueIn)

Parameters

Table 1 Parameters

Parameter Input/Output Description
valueIn Input Input data of the int64_t type.

Return Value

The number of consecutive bits that are the same as the sign bit starting from the most significant bit.

Supported Models

Kirin 9020 series processors

Kirin 9030 series processors

Kirin X90 series processors

Restrictions

None

Calling Example

int64_t valueIn = 0x0f00000000000000;
// Output (ans): 3
int64_t ans = AscendC::CountBitsCntSameAsSignBit(valueIn);