summaryrefslogtreecommitdiffstats
path: root/apps/plugins/pdbox
diff options
context:
space:
mode:
authorPeter D'Hoye <peter.dhoye@gmail.com>2009-07-12 19:18:59 +0000
committerPeter D'Hoye <peter.dhoye@gmail.com>2009-07-12 19:18:59 +0000
commitc133c6a964133200c59b12e1f1c9214f37122189 (patch)
tree7ed05a7d4a44b051fb50f5b4d3fff3eb79cc3490 /apps/plugins/pdbox
parent4bcd8475cb8d5027f73eeeaab880f2ad35abb1b2 (diff)
downloadrockbox-c133c6a964133200c59b12e1f1c9214f37122189.tar.gz
rockbox-c133c6a964133200c59b12e1f1c9214f37122189.tar.bz2
rockbox-c133c6a964133200c59b12e1f1c9214f37122189.zip
Another patch by Wincent Balin (from the FS #10416 series): get rid of some warnings. PDBox now builds without any error or warning.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21819 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/pdbox')
-rw-r--r--apps/plugins/pdbox/PDa/intern/rsqrt~.c30
-rw-r--r--apps/plugins/pdbox/PDa/intern/sqrt~.c6
-rw-r--r--apps/plugins/pdbox/PDa/src/d_soundfile.c12
-rw-r--r--apps/plugins/pdbox/pdbox.h5
4 files changed, 53 insertions, 0 deletions
diff --git a/apps/plugins/pdbox/PDa/intern/rsqrt~.c b/apps/plugins/pdbox/PDa/intern/rsqrt~.c
index 7f5a481132..3f82e115f6 100644
--- a/apps/plugins/pdbox/PDa/intern/rsqrt~.c
+++ b/apps/plugins/pdbox/PDa/intern/rsqrt~.c
@@ -18,10 +18,16 @@ static void init_rsqrt(void)
int i;
for (i = 0; i < DUMTAB1SIZE; i++)
{
+#ifdef ROCKBOX
+ union f2i f2i;
+ f2i.i = (i ? (i == DUMTAB1SIZE-1 ? DUMTAB1SIZE-2 : i) : 1)<< 23;
+ rsqrt_exptab[i] = 1./sqrt(f2i.f);
+#else /* ROCKBOX */
float f;
long l = (i ? (i == DUMTAB1SIZE-1 ? DUMTAB1SIZE-2 : i) : 1)<< 23;
*(long *)(&f) = l;
rsqrt_exptab[i] = 1./sqrt(f);
+#endif /* ROCKBOX */
}
for (i = 0; i < DUMTAB2SIZE; i++)
{
@@ -34,18 +40,42 @@ static void init_rsqrt(void)
float q8_rsqrt(float f)
{
+#ifdef ROCKBOX
+ union f2i f2i;
+ if(f < 0.0)
+ return 0.0;
+ else
+ {
+ f2i.f = f;
+ return (rsqrt_exptab[(f2i.i >> 23) & 0xff] *
+ rsqrt_mantissatab[(f2i.i >> 13) & 0x3ff]);
+ }
+#else /* ROCKBOX */
long l = *(long *)(&f);
if (f < 0) return (0);
else return (rsqrt_exptab[(l >> 23) & 0xff] *
rsqrt_mantissatab[(l >> 13) & 0x3ff]);
+#endif /* ROCKBOX */
}
float q8_sqrt(float f)
{
+#ifdef ROCKBOX
+ union f2i f2i;
+ if(f < 0.0)
+ return 0.0;
+ else
+ {
+ f2i.f = f;
+ return (f * rsqrt_exptab[(f2i.i >> 23) & 0xff] *
+ rsqrt_mantissatab[(f2i.i >> 13) & 0x3ff]);
+ }
+#else /* ROCKBOX */
long l = *(long *)(&f);
if (f < 0) return (0);
else return (f * rsqrt_exptab[(l >> 23) & 0xff] *
rsqrt_mantissatab[(l >> 13) & 0x3ff]);
+#endif /* ROCKBOX */
}
/* the old names are OK unless we're in IRIX N32 */
diff --git a/apps/plugins/pdbox/PDa/intern/sqrt~.c b/apps/plugins/pdbox/PDa/intern/sqrt~.c
index d78a6c6b98..42e526b76b 100644
--- a/apps/plugins/pdbox/PDa/intern/sqrt~.c
+++ b/apps/plugins/pdbox/PDa/intern/sqrt~.c
@@ -18,10 +18,16 @@ static void init_rsqrt(void)
int i;
for (i = 0; i < DUMTAB1SIZE; i++)
{
+#ifdef ROCKBOX
+ union f2i f2i;
+ f2i.i = (i ? (i == DUMTAB1SIZE-1 ? DUMTAB1SIZE-2 : i) : 1)<< 23;
+ rsqrt_exptab[i] = 1./sqrt(f2i.f);
+#else /* ROCKBOX */
float f;
long l = (i ? (i == DUMTAB1SIZE-1 ? DUMTAB1SIZE-2 : i) : 1)<< 23;
*(long *)(&f) = l;
rsqrt_exptab[i] = 1./sqrt(f);
+#endif /* ROCKBOX */
}
for (i = 0; i < DUMTAB2SIZE; i++)
{
diff --git a/apps/plugins/pdbox/PDa/src/d_soundfile.c b/apps/plugins/pdbox/PDa/src/d_soundfile.c
index 34aa105d28..74c41a78d4 100644
--- a/apps/plugins/pdbox/PDa/src/d_soundfile.c
+++ b/apps/plugins/pdbox/PDa/src/d_soundfile.c
@@ -885,8 +885,14 @@ static void soundfile_xferout(int nchannels, t_sample **vecs,
for (j = 0, sp2 = sp, fp=vecs[i] + onset;
j < nitems; j++, sp2 += bytesperframe, fp++)
{
+#ifdef ROCKBOX
+ union f2i f2i;
+ f2i.f = *fp * normalfactor;
+ xx = f2i.i;
+#else /* ROCKBOX */
float f2 = *fp * normalfactor;
xx = *(long *)&f2;
+#endif /* ROCKBOX */
sp2[0] = (xx >> 24); sp2[1] = (xx >> 16);
sp2[2] = (xx >> 8); sp2[3] = xx;
}
@@ -896,8 +902,14 @@ static void soundfile_xferout(int nchannels, t_sample **vecs,
for (j = 0, sp2 = sp, fp=vecs[i] + onset;
j < nitems; j++, sp2 += bytesperframe, fp++)
{
+#ifdef ROCKBOX
+ union f2i f2i;
+ f2i.f = *fp * normalfactor;
+ xx = f2i.i;
+#else /* ROCKBOX */
float f2 = *fp * normalfactor;
xx = *(long *)&f2;
+#endif /* ROCKBOX */
sp2[3] = (xx >> 24); sp2[2] = (xx >> 16);
sp2[1] = (xx >> 8); sp2[0] = xx;
}
diff --git a/apps/plugins/pdbox/pdbox.h b/apps/plugins/pdbox/pdbox.h
index e7587927dc..2ca5bc8d4f 100644
--- a/apps/plugins/pdbox/pdbox.h
+++ b/apps/plugins/pdbox/pdbox.h
@@ -83,6 +83,11 @@ typedef struct
}
div_t;
div_t div(int x, int y);
+union f2i
+{
+ float f;
+ int32_t i;
+};
void sys_findlibdir(const char* filename);
int sys_startgui(const char *guidir);