math.bitwise: removing bit-clear? since it is just "bit? not".

db4
John Benediktsson 2013-11-24 12:05:52 -08:00
parent eafc775bbb
commit 069d09807e
3 changed files with 2 additions and 24 deletions

View File

@ -51,24 +51,7 @@ HELP: bitroll
{ $example "USING: math.bitwise prettyprint ;" "0xffff0000 8 32 bitroll .h" "ff0000ff" }
} ;
HELP: bit-clear?
{ $values
{ "x" integer } { "n" integer }
{ "?" "a boolean" }
}
{ $description "Returns " { $link t } " if the nth bit is set to zero." }
{ $examples
{ $example "USING: math.bitwise prettyprint ;"
"0xff 8 bit-clear? ."
"t"
}
{ $example "USING: math.bitwise prettyprint ;"
"0xff 7 bit-clear? ."
"f"
}
} ;
{ bit? bit-clear? set-bit clear-bit } related-words
{ bit? set-bit clear-bit } related-words
HELP: bit-count
{ $values
@ -441,10 +424,9 @@ $nl
set-bit
clear-bit
}
"Testing if bits are set or clear:"
"Testing if bits are set:"
{ $subsections
bit?
bit-clear?
}
"Extracting bits from an integer:"
{ $subsections

View File

@ -75,9 +75,6 @@ SPECIALIZED-ARRAY: uint-4
[ 6 ] [ 5 next-even ] unit-test
[ 8 ] [ 6 next-even ] unit-test
[ f ] [ 0x1 0 bit-clear? ] unit-test
[ t ] [ 0x0 1 bit-clear? ] unit-test
[ -1 bit-count ] [ non-negative-integer-expected? ] must-fail-with
[ -1 bit-length ] [ non-negative-integer-expected? ] must-fail-with

View File

@ -10,7 +10,6 @@ IN: math.bitwise
! utilities
: clear-bit ( x n -- y ) 2^ bitnot bitand ; inline
: set-bit ( x n -- y ) 2^ bitor ; inline
: bit-clear? ( x n -- ? ) 2^ bitand zero? ; inline
: unmask ( x n -- ? ) bitnot bitand ; inline
: unmask? ( x n -- ? ) unmask zero? not ; inline
: mask ( x n -- ? ) bitand ; inline