我要评分
获取效率
正确性
完整性
易理解

Set

Sets a constant to the destination address.

The function interface declaration is as follows:

  • Operations on integers:

    HmppResult HMPPS_Set_8u(uint8_t val,uint8_t* dst,int32_t len);

    HmppResult HMPPS_Set_16s(int16_t val, int16_t *dst, int32_t len);

    HmppResult HMPPS_Set_32s(int32_t val, int32_t *dst, int32_t len);

    HmppResult HMPPS_Set_64s(int64_t val,int64_t* dst,int32_t len);

    HmppResult HMPPS_Set_16sc(Hmpp16sc val,Hmpp16sc* dst,int32_t len);

    HmppResult HMPPS_Set_32sc(Hmpp32sc val, Hmpp32sc* dst,int32_t len);

    HmppResult HMPPS_Set_64sc(Hmpp64sc val, Hmpp64sc* dst,int32_t len);

  • Operations on floating-point numbers:

    HmppResult HMPPS_Set_32f(float val, float *dst, int32_t len);

    HmppResult HMPPS_Set_64f(double val, double *dst, int32_t len);

    HmppResult HMPPS_Set_32fc(Hmpp32fc val, Hmpp32fc *dst, int32_t len);

    HmppResult HMPPS_Set_64fc(Hmpp64fc val, Hmpp64fc* dst,int32_t len);

Parameters

Parameter

Description

Value Range

Input/Output

val

Fixed value

Not limited, depending on the type

Input

dst

Pointer to the destination vector

The value cannot be NULL.

Output

len

Vector length

(0, INT_MAX]

Input

Return Value

  • Success: HMPP_STS_NO_ERR
  • Failure: An error code is returned.

Error Codes

Error Code

Description

HMPP_STS_NULL_PTR_ERR

The value of dst is NULL.

HMPP_STS_SIZE_ERR

The value of len is less than or equal to 0.

Example

#define BUFFER_SIZE_T 10

int main()
{
    uint8_t val = 127;
    uint8_t dst[BUFFER_SIZE_T];
    int32_t i;

    HmppResult result = HMPPS_Set_8u(val, dst, BUFFER_SIZE_T);
    printf("result = %d \ndst =", result);
    for (i = 0; i < BUFFER_SIZE_T; i++) {
        printf("%d    ", dst[i]);
    }

    return 0;
}

Output:

result = 0
dst = 127    127    127    127    127    127    127    127    127    127