aboutsummaryrefslogtreecommitdiffstats
path: root/comms/liquid-dsp/files/patch-src_dotprod_src_dotprod__rrrf.av.c
blob: 380885fd00a1a589c76d206e6165f34d79590f47 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
--- src/dotprod/src/dotprod_rrrf.av.c.orig	2024-06-19 07:25:01 UTC
+++ src/dotprod/src/dotprod_rrrf.av.c
@@ -26,6 +26,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <altivec.h>
 
 #include "liquid.internal.h"
 
@@ -117,7 +118,7 @@ dotprod_rrrf dotprod_rrrf_create_opt(float *      _h,
     for (i=0; i<4; i++) {
         q->h[i] = calloc(1+(q->n+i-1)/4,sizeof(vector float));
         for (j=0; j<q->n; j++)
-            e->h[i][j+i] = _h[_rev ? q->n-j-1 : j];
+            q->h[i][j+i] = _h[_rev ? q->n-j-1 : j];
     }
 
     return q;
@@ -190,8 +191,8 @@ int dotprod_rrrf_execute(dotprod_rrrf _q,
     union { vector float v; float w[4];} s;
     unsigned int nblocks;
 
-    ar = (vector float*)( (int)_x & ~15);
-    al = ((int)_x & 15)/sizeof(float);
+    ar = (vector float*)( (uintptr_t)_x & ~15);
+    al = ((uintptr_t)_x & 15)/sizeof(float);
 
     d = (vector float*)_q->h[al];
 
@@ -200,7 +201,7 @@ int dotprod_rrrf_execute(dotprod_rrrf _q,
     // split into four vectors each with four 32-bit
     // partial sums.  Effectively each loop iteration
     // operates on 16 input samples at a time.
-    s0 = s1 = s2 = s3 = (vector float)(0);
+    s0 = s1 = s2 = s3 = (vector float){0,0,0,0};
     while (nblocks >= 4) {
         s0 = vec_madd(ar[nblocks-1],d[nblocks-1],s0);
         s1 = vec_madd(ar[nblocks-2],d[nblocks-2],s1);
@@ -221,7 +222,7 @@ int dotprod_rrrf_execute(dotprod_rrrf _q,
     // move the result into the union s (effetively,
     // this loads the four 32-bit values in s0 into
     // the array w).
-    s.v = vec_add(s0,(vector float)(0));
+    s.v = vec_add(s0,(vector float){0,0,0,0});
 
     // sum the resulting array
     *_r = s.w[0] + s.w[1] + s.w[2] + s.w[3];