Loading...
Searching...
No Matches
volk_8i_x2_add_saturated_8i

Overview

Adds two int8_t vectors element-wise with saturation. Results are clamped to the range [-128, 127] to prevent overflow wraparound.

Dispatcher Prototype

void volk_8i_x2_add_saturated_8i(int8_t* outVector, const int8_t* inVectorA, const
int8_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();
int8_t* a = (int8_t*)volk_malloc(N, align);
int8_t* b = (int8_t*)volk_malloc(N, align);
int8_t* result = (int8_t*)volk_malloc(N, align);
// Values that will cause saturation
a[0] = 100; b[0] = 50; // 150 -> saturates to 127
a[1] = -100; b[1] = -50; // -150 -> saturates to -128
volk_8i_x2_add_saturated_8i(result, a, b, N);
// result[0] == 127, result[1] == -128
volk_free(a);
volk_free(b);
volk_free(result);