ScalarCountLeadingZero

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 leading 0s of a uint64_t number (number of 0s from the most significant bit to the first 1 in the binary number).

Prototype

1
__aicore__ inline int64_t ScalarCountLeadingZero(uint64_t valueIn)

Parameters

Table 1 Parameters

Parameter

Input/Output

Description

valueIn

Input

A binary number.

Returns

Return the number of leading zeros in valueIn.

Constraints

None

Example

1
2
3
uint64_t valueIn = 0x0fffffffffffffff;
// Output (ans): 4
int64_t ans = AscendC::ScalarCountLeadingZero(valueIn);