]> gitweb.factorcode.org Git - factor.git/commitdiff
move signed-le> to io.binary, clean up using list for math.bitwise
authorDoug Coleman <doug.coleman@gmail.com>
Thu, 23 Jul 2009 20:54:57 +0000 (15:54 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Thu, 23 Jul 2009 20:54:57 +0000 (15:54 -0500)
basis/math/bitwise/bitwise.factor
core/io/binary/binary.factor

index cea944a6e8eebef23a355176152b5b754a5ed9bc..bed065a800c0fc4eaf3f5de5eb71dec9eca366af 100755 (executable)
@@ -1,8 +1,7 @@
 ! Copyright (C) 2007, 2008 Slava Pestov, Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: arrays assocs kernel math sequences accessors
-math.bits sequences.private words namespaces macros
-hints combinators fry io.binary combinators.smart ;
+USING: arrays assocs combinators combinators.smart fry kernel
+macros math math.bits sequences sequences.private words ;
 IN: math.bitwise
 
 ! utilities
@@ -104,14 +103,6 @@ PRIVATE>
 : bit-count ( x -- n )
     dup 0 < [ bitnot ] when (bit-count) ; inline
 
-! Signed byte array to integer conversion
-: signed-le> ( bytes -- x )
-    [ le> ] [ length 8 * 1 - on-bits ] bi
-    2dup > [ bitnot bitor ] [ drop ] if ;
-
-: signed-be> ( bytes -- x )
-    <reversed> signed-le> ;
-
 : >signed ( x n -- y )
     2dup neg 1 + shift 1 = [ 2^ - ] [ drop ] if ;
 
index d2e50c2a6aa0fbeabe2889165b98ca7b917cd623..cf2781aac074c1022d45e99f79fb63f2d4760a14 100644 (file)
@@ -24,3 +24,10 @@ IN: io.binary
 : h>b/b ( h -- b1 b2 )
     [ mask-byte ]
     [ -8 shift mask-byte ] bi ;
+
+: signed-le> ( bytes -- x )
+    [ le> ] [ length 8 * 1 - 2^ 1 - ] bi
+    2dup > [ bitnot bitor ] [ drop ] if ;
+
+: signed-be> ( bytes -- x )
+    <reversed> signed-le> ;