]> gitweb.factorcode.org Git - factor.git/commitdiff
fixed signed number decoding problem
authorSascha Matzke <sascha.matzke@didolo.org>
Mon, 6 Jul 2009 07:05:20 +0000 (09:05 +0200)
committerSascha Matzke <sascha.matzke@didolo.org>
Thu, 9 Jul 2009 11:36:19 +0000 (13:36 +0200)
extra/bson/reader/reader.factor

index 7e218fa79c44edc45ffc4388431ccbeb01de9c08..e6ae0060b67ac9fd7a5e7a08509875b325f14691 100644 (file)
@@ -1,6 +1,6 @@
-USING: accessors assocs bson.constants byte-arrays byte-vectors fry io
-io.binary io.encodings.string io.encodings.utf8 kernel math namespaces
-sequences serialize arrays calendar io.encodings ;
+USING: accessors assocs bson.constants calendar fry io io.binary
+io.encodings io.encodings.utf8 kernel math math.bitwise namespaces
+sequences serialize ;
 
 FROM: kernel.private => declare ;
 FROM: io.encodings.private => (read-until) ;
@@ -44,20 +44,17 @@ GENERIC: element-read ( type -- cont? )
 GENERIC: element-data-read ( type -- object )
 GENERIC: element-binary-read ( length type -- object )
 
-: byte-array>number ( seq -- number )
-    byte-array>bignum >integer ; inline
-
 : get-state ( -- state )
     state get ; inline
 
 : read-int32 ( -- int32 )
-    4 read byte-array>number ; inline
+    4 read signed-le> ; inline
 
 : read-longlong ( -- longlong )
-    8 read byte-array>number ; inline
+    8 read signed-le> ; inline
 
 : read-double ( -- double )
-    8 read byte-array>number bits>double ; inline
+    8 read le> bits>double ; inline
 
 : read-byte-raw ( -- byte-raw )
     1 read ; inline