Loading...
Searching...
No Matches
volk_16u_x2_add_saturated_16u

Overview

Adds two uint16_t vectors element-wise with saturation. Results are clamped to the range [0, 65535] to prevent overflow wraparound.

Dispatcher Prototype

void volk_16u_x2_add_saturated_16u(uint16_t* outVector, const uint16_t* inVectorA,
const uint16_t* inVectorB, unsigned int num_points)

Inputs

- inVectorA: First input vector.
- inVectorB: Second input vector.
- num_points: Vector length.

Outputs

- outVector: Saturated sum output.

Example

unsigned int N = 8;
unsigned int align = volk_get_alignment();
uint16_t* a = (uint16_t*)volk_malloc(N * sizeof(uint16_t), align);
uint16_t* b = (uint16_t*)volk_malloc(N * sizeof(uint16_t), align);
uint16_t* result = (uint16_t*)volk_malloc(N * sizeof(uint16_t), align);
// Values that will cause saturation
a[0] = 60000; b[0] = 10000; // 70000 -> saturates to 65535
a[1] = 1000; b[1] = 2000; // 3000 -> no saturation
volk_16u_x2_add_saturated_16u(result, a, b, N);
// result[0] == 65535, result[1] == 3000
volk_free(a);
volk_free(b);
volk_free(result);