move >signed to math.bitwise

db4
Doug Coleman 2009-02-14 00:31:17 -06:00
parent b4e7592ba3
commit b638a35fd7
2 changed files with 5 additions and 4 deletions

View File

@ -1,7 +1,7 @@
! Copyright (C) 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: alien.c-types namespaces io.binary fry
kernel math grouping sequences ;
kernel math grouping sequences math.bitwise ;
IN: endian
SINGLETONS: big-endian little-endian ;
@ -9,9 +9,6 @@ SINGLETONS: big-endian little-endian ;
: compute-native-endianness ( -- class )
1 <int> *char 0 = big-endian little-endian ? ;
: >signed ( x n -- y )
2dup neg 1+ shift 1 = [ 2^ - ] [ drop ] if ;
SYMBOL: native-endianness
native-endianness [ compute-native-endianness ] initialize

View File

@ -102,3 +102,7 @@ PRIVATE>
: signed-be> ( bytes -- x )
<reversed> signed-le> ;
: >signed ( x n -- y )
2dup neg 1+ shift 1 = [ 2^ - ] [ drop ] if ;