CountBitsCntSameAsSignBit
Applicability
Product |
Supported/Unsupported |
|---|---|
√ |
|
√ |
|
x |
|
√ |
|
x |
|
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
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); |
Parent topic: Scalar Computation