max
Applicability
Product |
Supported |
|---|---|
√ |
|
√ |
|
x |
|
√ |
|
x |
|
x |
Function
Compares two numbers of the same data type and returns the maximum value.
Prototype
1 2 | template <typename T, typename U> __aicore__ inline T max(const T src0, const U src1) |
Parameters
Parameter |
Description |
|---|---|
T |
Data type of the input data src0. Currently, the supported data types are bool, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, float, int64_t, and uint64_t. |
U |
Data type of the input data src1. Currently, the supported data types are bool, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, float, int64_t, and uint64_t. Reserved type. Currently, the value must be the same as that of T. |
Parameter |
Input/Output |
Description |
|---|---|---|
src0 |
Input |
Source operand. This is the input for comparison. |
src1 |
Input |
Source operand. This is the input for comparison. |
Restrictions
The data types of the two source operands must be the same.
Returns
Maximum value of the two input data elements.
Example
1 2 3 4 5 | int64_t src0 = 1; int64_t src1 = 2; int64_t result = AscendC::Std::max(src0, src1); // result: 2 |