CountBitsCntSameAsSignBit

Applicability

Product

Supported/Unsupported

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

x

Atlas inference product's AI Core

Atlas inference product's Vector Core

x

Atlas training products

x

Function Usage

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.

Prototype

1
__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.

Returns

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

Constraints

None

Example

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