1
0
mirror of https://github.com/gryf/gryf-overlay.git synced 2025-12-26 00:12:33 +01:00
Files
gryf-overlay/media-plugins/xmms-cdread/files/endian.patch
2010-02-09 21:25:29 +01:00

45 lines
962 B
Diff

diff -Naur xmms-cdread-0.14a/filter.c xmms-cdread-0.14a-endian/filter.c
--- xmms-cdread-0.14a/filter.c 2001-04-09 19:33:13.000000000 +0100
+++ xmms-cdread-0.14a-endian/filter.c 2003-10-17 22:57:34.000000000 +0100
@@ -4,6 +4,7 @@
#include <stdio.h>
#include <string.h>
#include <math.h>
+#include <endian.h>
typedef double real;
@@ -37,9 +38,18 @@
int i, j, k;
sample *data = buf;
real ol, or;
+#ifdef __BIG_ENDIAN
+ char *p;
+#endif
if (!cd_eq_on) return;
+#ifdef __BIG_ENDIAN
+ for (p = (char *)data; p < (char *)(data + len); p += 2) {
+ p[0] ^= p[1] ^= p[0] ^= p[1];
+ }
+#endif
+
for (i = 0; i < len; i++) {
ol = fc[0] * (real)data[i].l;
or = fc[0] * (real)data[i].r;
@@ -58,6 +66,13 @@
data[i].l = (short)ol;
data[i].r = (short)or;
}
+
+#ifdef __BIG_ENDIAN
+ for (p = (char *)data; p < (char *)(data + len); p += 2) {
+ p[0] ^= p[1] ^= p[0] ^= p[1];
+ }
+#endif
+
}
#define PI 3.1415926535897932384626433832795029L