ScalarGetSFFValue

Applicability

Product

Supported

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

Obtains the position of the first 0 or 1 starting from the least significant bit in the binary representation of a uint64_t value. Returns –1 if no such position is found.

Prototype

1
2
template <int countValue> 
__aicore__ inline int64_t ScalarGetSFFValue(uint64_t valueIn)

Parameters

Table 1 Template parameters

Parameter

Description

countValue

Value to be searched for. It is of int type and must be 0 or 1. 0 indicates that the position of the first 0 is to be searched for, and 1 indicates that the position of the first 1 is to be searched for.

Table 2 Parameters

Parameter

Input/Output

Description

valueIn

Input

Input data of the uint64_t type.

Returns

A number of the int64_t type, indicating the location where the first 0 or 1 appears in valueIn.

Restrictions

None

Example

1
2
3
uint64_t valueIn = 28;
// Output (oneCount): 2
int64_t oneCount = AscendC::ScalarGetSFFValue<1>(valueIn);