summaryrefslogtreecommitdiff
path: root/lib/bitio.c
diff options
context:
space:
mode:
authorkramm <kramm>2008-07-11 08:52:52 +0000
committerkramm <kramm>2008-07-11 08:52:52 +0000
commit2b7d856ec993650ff4f685ba35c352d92f013122 (patch)
treef26a7e8609466046c7c7e1a02b745d2d9fcbbb51 /lib/bitio.c
parent70ae3fd60f004169306374818e565e27e8db84cd (diff)
fixed bug in read/write float
Diffstat (limited to 'lib/bitio.c')
-rw-r--r--lib/bitio.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/bitio.c b/lib/bitio.c
index 19c662d0..bd549359 100644
--- a/lib/bitio.c
+++ b/lib/bitio.c
@@ -678,6 +678,10 @@ U32 reader_readU32(reader_t*r)
}
float reader_readFloat(reader_t*r)
{
+ float f;
+ r->read(r, &f, 4);
+ return f;
+
U8 b1=0,b2=0,b3=0,b4=0;
r->read(r, &b1, 1);
r->read(r, &b2, 1);
@@ -743,7 +747,10 @@ void writer_writeU32(writer_t*w, unsigned long v)
}
void writer_writeFloat(writer_t*w, float f)
{
- unsigned long v = *(unsigned long*)&f;
+ w->write(w, &f, 4);
+ return;
+
+ unsigned v = *(unsigned*)&f;
unsigned char b1 = v;
unsigned char b2 = v>>8;
unsigned char b3 = v>>16;