Permalink
Browse files

math.bitwise: bits is clearer this way.

  • Loading branch information...
1 parent f638f3d commit e948df41c6e6a568048550394e94490bac4f243b @mrjbq7 mrjbq7 committed Oct 14, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 basis/math/bitwise/bitwise.factor
@@ -15,9 +15,9 @@ IN: math.bitwise
: mask ( x n -- ? ) bitand ; inline
: mask? ( x n -- ? ) mask 0 > ; inline
: wrap ( m n -- m' ) 1 - bitand ; inline
-: bits ( m n -- m' ) 2^ wrap ; inline
-: mask-bit ( m n -- m' ) 2^ mask ; inline
: on-bits ( m -- n ) 2^ 1 - ; inline
+: bits ( m n -- m' ) on-bits mask ; inline
+: mask-bit ( m n -- m' ) 2^ mask ; inline
: toggle-bit ( m n -- m' ) 2^ bitxor ; inline
: >signed ( x n -- y )
[ bits ] keep 2dup neg 1 + shift 1 = [ 2^ - ] [ drop ] if ;

0 comments on commit e948df4

Please sign in to comment.