L.S.
In order to wrap this up: apparently there's a feature / bug (choose one) in
any ARM core earlier than v5 due to which a float will be stored in big
endian quad order. The processor in this particular case is an SA1110, which
is default little endian while having a v4 core..... (and thus is 'swapping'
the quads).
> [Doug Currie] So for your ARM FP library, the code goes from
For the part that reads the data it's just semantics, really, but I'm using
the patch now (against v3.2.3):
--- vdbeaux.c_orig 2005-08-22 21:32:53.000000000 +0200
+++ vdbeaux.c 2005-08-22 21:39:46.000000000 +0200
@@ -1649,7 +1649,11 @@
}
len = i = sqlite3VdbeSerialTypeLen(serial_type);
while( i-- ){
- buf[i] = (v&0xFF);
+ if( serial_type==7 ){
+ buf[(i+4)%8] = (v&0xFF);
+ }else{
+ buf[i] = (v&0xFF);
+ }
v >>= 8;
}
return len;
@@ -1708,18 +1712,20 @@
pMem->flags = MEM_Int;
return 6;
}
- case 6: /* 8-byte signed integer */
- case 7: { /* IEEE floating point */
+ case 6: { /* 8-byte signed integer */
u64 x = (buf[0]<<24) | (buf[1]<<16) | (buf[2]<<8) | buf[3];
u32 y = (buf[4]<<24) | (buf[5]<<16) | (buf[6]<<8) | buf[7];
x = (x<<32) | y;
- if( serial_type==6 ){
- pMem->i = *(i64*)&x;
- pMem->flags = MEM_Int;
- }else{
- pMem->r = *(double*)&x;
- pMem->flags = MEM_Real;
- }
+ pMem->i = *(i64*)&x;
+ pMem->flags = MEM_Int;
+ return 8;
+ }
+ case 7: { /* IEEE floating point */
+ u64 x = (buf[4]<<24) | (buf[5]<<16) | (buf[6]<<8) | buf[7];
+ u32 y = (buf[0]<<24) | (buf[1]<<16) | (buf[2]<<8) | buf[3];
+ x = (x<<32) | y;
+ pMem->r = *(double*)&x;
+ pMem->flags = MEM_Real;
return 8;
}
default: {
>> [D. Richard Hipp] The code shown was for reading the database.
>> You'll also need to find and fix the spot where the database is written
> Obviously, but thanks for the heads-up anyway ;);)
The patch above includes that.
--
Best,
Frank.