[Swfdec-commits] 2 commits - swfdec/swfdec_bits.c
Benjamin Otte
company at kemper.freedesktop.org
Mon Feb 18 01:03:01 PST 2008
swfdec/swfdec_bits.c | 23 +++++++----------------
1 file changed, 7 insertions(+), 16 deletions(-)
New commits:
commit 84adf5118ea63c40b9f12003d96ae1c3ec9aa184
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Feb 18 10:02:54 2008 +0100
try to make swfdec_bits_from_bdouble() portable
diff --git a/swfdec/swfdec_bits.c b/swfdec/swfdec_bits.c
index c1d50e0..10c1bcd 100644
--- a/swfdec/swfdec_bits.c
+++ b/swfdec/swfdec_bits.c
@@ -346,24 +346,19 @@ swfdec_bits_get_double (SwfdecBits * b)
double
swfdec_bits_get_bdouble (SwfdecBits * b)
{
- guint8 x[8];
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
- guint8 c;
-#endif
+ union {
+ double d;
+ guint64 u64;
+ } u;
SWFDEC_BYTES_CHECK (b, 8);
- memcpy (&x, b->ptr, 8);
+ memcpy (&u.u64, b->ptr, 8);
b->ptr += 8;
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
- c=x[0]; x[0]=x[7]; x[7]=c;
- c=x[1]; x[1]=x[6]; x[6]=c;
- c=x[2]; x[2]=x[5]; x[5]=c;
- c=x[3]; x[3]=x[4]; x[4]=c;
-#endif
+ u.u64 = GUINT64_FROM_BE (u.u64);
- return *(double *)&x;
+ return u.d;
}
void
commit ea0597acda73f142991f2e5aadd8deefcc06889d
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Feb 18 09:58:50 2008 +0100
remove commented out code
diff --git a/swfdec/swfdec_bits.c b/swfdec/swfdec_bits.c
index 19e0a64..c1d50e0 100644
--- a/swfdec/swfdec_bits.c
+++ b/swfdec/swfdec_bits.c
@@ -337,10 +337,6 @@ swfdec_bits_get_double (SwfdecBits * b)
#else
conv.i[0] = (b->ptr[3] << 24) | (b->ptr[2] << 16) | (b->ptr[1] << 8) | b->ptr[0];
conv.i[1] = (b->ptr[7] << 24) | (b->ptr[6] << 16) | (b->ptr[5] << 8) | b->ptr[4];
-#if 0
- conv.i[0] = (b->ptr[0] << 24) | (b->ptr[1] << 16) | (b->ptr[2] << 8) | b->ptr[3];
- conv.i[1] = (b->ptr[4] << 24) | (b->ptr[5] << 16) | (b->ptr[6] << 8) | b->ptr[7];
-#endif
#endif
b->ptr += 8;
More information about the Swfdec-commits
mailing list