Commit 321a20ea authored by Sakthivel Velumani's avatar Sakthivel Velumani

Fix vector mult function for out of bound access

parent a50cb354
......@@ -30,28 +30,30 @@ void multadd_complex_vector_real_scalar(int16_t *x,
uint8_t zero_flag,
uint32_t N)
{
simd_q15_t alpha_128,*x_128=(simd_q15_t *)x,*y_128=(simd_q15_t*)y;
int n;
alpha_128 = set1_int16(alpha);
const uint32_t num_adds = (N + 3) / 4; // ceil(N/4)
const uint32_t num_simd_adds = N / 4;
const uint32_t num_adds = N % 4;
if (zero_flag == 1) {
for (n = 0; n < num_adds; n++) {
// print_shorts("x_128[n]=", &x_128[n]);
// print_shorts("alpha_128", &alpha_128);
for (n = 0; n < num_simd_adds; n++) {
y_128[n] = mulhi_int16(x_128[n],alpha_128);
// print_shorts("y_128[n]=", &y_128[n]);
}
} else {
for (n = 0; n < num_adds; n++) {
const uint32_t offset = num_simd_adds * 4;
y[offset + n] = (x[offset + n] * alpha) >> 16;
}
} else {
for (n = 0; n < num_simd_adds; n++) {
y_128[n] = adds_int16(y_128[n],mulhi_int16(x_128[n],alpha_128));
}
for (n = 0; n < num_adds; n++) {
const uint32_t offset = num_simd_adds * 4;
y[offset + n] += (x[offset + n] * alpha) >> 16;
}
}
simde_mm_empty();
simde_m_empty();
}
void multadd_real_vector_complex_scalar(const int16_t *x, const int16_t *alpha, int16_t *y, uint32_t N)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment