Rate This Document
Findability
Accuracy
Completeness
Readability

And

Performs bitwise AND between a vector and each element of the vector.

The function interface declaration is as follows:

  • Operations on integers:

    HmppResult HMPPS_And_8u(const uint8_t* src1, const uint8_t* src2,uint8_t* dst, int32_t len);

    HmppResult HMPPS_And_16u(const uint16_t* src1, const uint16_t* src2, uint16_t* dst, int32_t len);

    HmppResult HMPPS_And_32u(const uint32_t* src1, const uint32_t* src2,uint32_t* dst, int32_t len);

  • In-place operations on integers:

    HmppResult HMPPS_And_8u_I(const uint8_t* src, uint8_t* srcDst, int32_t len);

    HmppResult HMPPS_And_16u_I(const uint16_t* src, uint16_t* srcDst, int32_t len);

    HmppResult HMPPS_And_32u_I(const uint32_t* src, uint32_t* srcDst, int32_t len);

Parameters

Parameter

Description

Value Range

Input/Output

src1

Pointer to the first source vector

The value cannot be NULL.

Input

src2

Pointer to the second source vector

The value cannot be NULL.

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 src1, src2, dst, or srcDst is NULL.

HMPP_STS_SIZE_ERR

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

Example

#define BUFFER_SIZE_T 9

void AndExample(void)
{
    uint8_t src1[BUFFER_SIZE_T] = {1, 0,  45, 255,  214, 22, 11 ,112, 45};
    uint8_t src2[BUFFER_SIZE_T] = {0, 45,  55,  214, 22, 11 ,112, 45, 66};
    uint8_t dst[BUFFER_SIZE_T] = {0};
    int32_t i, result;

    result = HMPPS_And_8u(src1, src2, dst, BUFFER_SIZE_T);
    if (result != HMPP_STS_NO_ERR) {
        return;
    }
    printf("result = %d \n dst = ", result);
    for (i = 0; i < BUFFER_SIZE_T; i++) {
        printf("%d ", dst[i]);
    }
}

Output:

result = 0
dst = 0 0 45 214 22 2 0 32 0