Timur Davydov has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/42655?usp=email )


Change subject: convolve: avoid function pointer casts by adding wrapper 
functions
......................................................................

convolve: avoid function pointer casts by adding wrapper functions

Introduce _base_convolve_*_void() wrappers matching the expected
function pointer signatures and use them instead of casting
_base_convolve_* functions to (void *).

This removes unsafe function pointer casts and improves
type safety, which is required for stricter toolchains and
non-native targets (e.g. WebAssembly)

Change-Id: Idecb118be285eb3e4691d1761d0d8fa24fd80c75
---
M Transceiver52M/arch/x86/convolve.c
1 file changed, 27 insertions(+), 10 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/55/42655/1

diff --git a/Transceiver52M/arch/x86/convolve.c 
b/Transceiver52M/arch/x86/convolve.c
index 45a3719..aeec39d 100644
--- a/Transceiver52M/arch/x86/convolve.c
+++ b/Transceiver52M/arch/x86/convolve.c
@@ -62,19 +62,36 @@
 int bounds_check(int x_len, int h_len, int y_len,
                 int start, int len);

+void _base_convolve_complex_void(const float *x, int x_len,
+                                const float *h, int h_len,
+                                float *y, int y_len,
+                                int start, int len)
+{
+       _base_convolve_complex(x, x_len, h, h_len, y, y_len, start, len);
+}
+
+void _base_convolve_real_void(const float *x, int x_len,
+                             const float *h, int h_len,
+                             float *y, int y_len,
+                             int start, int len)
+{
+       _base_convolve_real(x, x_len, h, h_len, y, y_len, start, len);
+}
+
+
 /* API: Initialize convolve module */
 void convolve_init(void)
 {
-       c.conv_cmplx_4n = (void *)_base_convolve_complex;
-       c.conv_cmplx_8n = (void *)_base_convolve_complex;
-       c.conv_cmplx = (void *)_base_convolve_complex;
-       c.conv_real4 = (void *)_base_convolve_real;
-       c.conv_real8 = (void *)_base_convolve_real;
-       c.conv_real12 = (void *)_base_convolve_real;
-       c.conv_real16 = (void *)_base_convolve_real;
-       c.conv_real20 = (void *)_base_convolve_real;
-       c.conv_real4n = (void *)_base_convolve_real;
-       c.conv_real = (void *)_base_convolve_real;
+       c.conv_cmplx_4n = _base_convolve_complex_void;
+       c.conv_cmplx_8n = _base_convolve_complex_void;
+       c.conv_cmplx = _base_convolve_complex_void;
+       c.conv_real4 = _base_convolve_real_void;
+       c.conv_real8 = _base_convolve_real_void;
+       c.conv_real12 = _base_convolve_real_void;
+       c.conv_real16 = _base_convolve_real_void;
+       c.conv_real20 = _base_convolve_real_void;
+       c.conv_real4n = _base_convolve_real_void;
+       c.conv_real = _base_convolve_real_void;

 #if defined(HAVE_SSE3) && defined(HAVE___BUILTIN_CPU_SUPPORTS)
        if (__builtin_cpu_supports("sse3")) {

--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/42655?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: Idecb118be285eb3e4691d1761d0d8fa24fd80c75
Gerrit-Change-Number: 42655
Gerrit-PatchSet: 1
Gerrit-Owner: Timur Davydov <[email protected]>

Reply via email to