]> gitweb.factorcode.org Git - factor.git/commitdiff
Fix bit-array>integer byte ordering
authorSamuel Tardieu <sam@rfc1149.net>
Wed, 7 Jan 2009 22:16:27 +0000 (23:16 +0100)
committerSamuel Tardieu <sam@rfc1149.net>
Wed, 7 Jan 2009 22:16:27 +0000 (23:16 +0100)
basis/bit-arrays/bit-arrays-tests.factor
basis/bit-arrays/bit-arrays.factor

index 24c27fa15bcfa45042c53ec674f3ea8e59ffae60..1de49d353d7684fb3a306b36ebaf1fc89c06cc3b 100644 (file)
@@ -78,3 +78,5 @@ IN: bit-arrays.tests
 } bit-array>integer ] unit-test
 
 [ 49 ] [ 49 <bit-array> dup set-bits [ ] count ] unit-test
+
+[ HEX: 100 ] [ ?{ f f f f f f f f t } bit-array>integer ] unit-test
index 18796fbfed44fb1bc84cffa150381db84ee1f0c5..f1ba71ce1e02861bd79af83aeaff13b9639636b0 100644 (file)
@@ -83,7 +83,7 @@ M: bit-array byte-length length 7 + -3 shift ;
     ] if ;
 
 : bit-array>integer ( bit-array -- n )
-    0 swap underlying>> dup length [
+    0 swap underlying>> dup length <reversed> [
         alien-unsigned-1 swap 8 shift bitor
     ] with each ;