Rate This Document
Findability
Accuracy
Completeness
Readability

DivCRev

Divides a constant by each element in a vector.

The function interface declaration is as follows:

  • Operations on unsigned integers:

    HmppResult HMPPS_DivCRev_16u(const uint16_t* src, uint16_t val, uint16_t* dst, int32_t len);

  • Operations on floating-point numbers:

    HmppResult HMPPS_DivCRev_32f(const float* src, float val, float* dst, int32_t len);

  • In-place operations on unsigned integers:

    HmppResult HMPPS_DivCRev_16u_I(uint16_t val, uint16_t* srcDst, int32_t len);

  • In-place operations on floating-point numbers:

    HmppResult HMPPS_DivCRev_32f_I(float val, float* srcDst, int32_t len);

Parameters

Parameter

Description

Value Range

Input/Output

src

Pointer to the source vector

The value cannot be NULL.

Input

val

Dividend

Not limited, depending on the type

Input

dst

Pointer to the destination vector

The value cannot be NULL.

Output

srcDst

Pointer to the source vector for in-place operations

The value cannot be NULL.

Input/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 src, dst, or srcDst is NULL.

HMPP_STS_SIZE_ERR

The value of len must be greater than 0.

HMPP_STS_DIV_BY_ZERO

The divisor is 0.

Example

#define BUFFER_SIZE_T 10
void DivCRevExample(void)
{
    float src[BUFFER_SIZE_T] = {6.44, 8.88, 0.78, 5.33, 10.29, 2.46, 10.88, 3.51, 10.72, 10.46};
    float dst[BUFFER_SIZE_T] = {0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00};
    float val = 8.51;
    int32_t i, result;
    result = HMPPS_DivCRev_32f(src, val, dst, BUFFER_SIZE_T);
    printf("result = %d\n", result);
    if (result != HMPP_STS_NO_ERR) {
        return;
    }
    printf("dst =");
    for (i = 0; i < BUFFER_SIZE_T; i++) {
        printf(" %.2f", dst[i]);
    }
    printf("\n");
}

Output:

result = 0
dst = 1.32 0.96 10.91 1.60 0.83 3.46 0.78 2.42 0.79 0.81