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

vnot

Perform bitwise NOT operations on real-number vectors.

The function interface declaration is as follows:

Operations on integers:

void (vsip_vnot_i)(const vsip_vview_i *a, const vsip_vview_i *r);

Parameters

Parameter

Description

Value Range

Input/Output

a

Pointer to the source vector

The value cannot be NULL.

Input

r

Pointer to the destination vector

The value cannot be NULL.

Output

Abnormal Input

When a null pointer is input, the function directly returns a result.

Example

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "kvsip.h"
#include "vsip.h"
#include "vsip_type.h"

#define BUFFER_SIZE_T 10
void VnotExample()
{
    int32_t src[BUFFER_SIZE_T] = {164, 0, -1, 3, 13, -5, 1, -14, 5, 8};
    int32_t dst[BUFFER_SIZE_T];
    int64_t stride = 1;
    uint64_t offset = 0;

    vsip_block_i *block_a = vsip_blockbind_i(src, BUFFER_SIZE_T, VSIP_MEM_NONE);
    vsip_block_i *block_r = vsip_blockbind_i(dst, BUFFER_SIZE_T, VSIP_MEM_NONE);

    vsip_vview_i *a = vsip_vbind_i(block_a, offset, stride, BUFFER_SIZE_T);
    vsip_blockadmit_i(block_a, VSIP_TRUE);
    vsip_vview_i *r = vsip_vbind_i(block_r, offset, stride, BUFFER_SIZE_T);
    vsip_blockadmit_i(block_r, VSIP_TRUE);

    vsip_vnot_i(a, r);

    vsip_valldestroy_i(a);
    vsip_valldestroy_i(r);

    printf("src:\n");
    for (int32_t i = 0; i < BUFFER_SIZE_T; ++i) {
        printf("%d ", src[i]);
    }
    printf("\ndst:\n");
    for (int32_t i = 0; i < BUFFER_SIZE_T; ++i) {
        printf("%d ", dst[i]);
    }
    printf("\n");
}

int main(void) {
    VnotExample();
    return 0;
}

Output:

src:
164 0 -1 3 13 -5 1 -14 5 8
dst:
-165 -1 0 -4 -14 4 -2 13 -6 -9