math.bitwise: fix docs for mask and unmask (they don't return a boolean).
parent
bffeeed589
commit
ebbfa17b47
|
@ -184,7 +184,7 @@ HELP: >signed
|
||||||
HELP: mask
|
HELP: mask
|
||||||
{ $values
|
{ $values
|
||||||
{ "x" integer } { "n" integer }
|
{ "x" integer } { "n" integer }
|
||||||
{ "?" "a boolean" }
|
{ "y" integer }
|
||||||
}
|
}
|
||||||
{ $description "After the operation, only the bits that were set in both the mask and the original number are set." }
|
{ $description "After the operation, only the bits that were set in both the mask and the original number are set." }
|
||||||
{ $examples
|
{ $examples
|
||||||
|
@ -297,7 +297,7 @@ HELP: shift-mod
|
||||||
HELP: unmask
|
HELP: unmask
|
||||||
{ $values
|
{ $values
|
||||||
{ "x" integer } { "n" integer }
|
{ "x" integer } { "n" integer }
|
||||||
{ "?" "a boolean" }
|
{ "y" integer }
|
||||||
}
|
}
|
||||||
{ $description "Clears the bits in " { $snippet "x" } " if they are set in the mask " { $snippet "n" } "." }
|
{ $description "Clears the bits in " { $snippet "x" } " if they are set in the mask " { $snippet "n" } "." }
|
||||||
{ $examples
|
{ $examples
|
||||||
|
|
|
@ -10,9 +10,9 @@ IN: math.bitwise
|
||||||
! utilities
|
! utilities
|
||||||
: clear-bit ( x n -- y ) 2^ bitnot bitand ; inline
|
: clear-bit ( x n -- y ) 2^ bitnot bitand ; inline
|
||||||
: set-bit ( x n -- y ) 2^ bitor ; inline
|
: set-bit ( x n -- y ) 2^ bitor ; inline
|
||||||
: unmask ( x n -- ? ) bitnot bitand ; inline
|
: unmask ( x n -- y ) bitnot bitand ; inline
|
||||||
: unmask? ( x n -- ? ) unmask zero? not ; inline
|
: unmask? ( x n -- ? ) unmask zero? not ; inline
|
||||||
: mask ( x n -- ? ) bitand ; inline
|
: mask ( x n -- y ) bitand ; inline
|
||||||
: mask? ( x n -- ? ) [ mask ] [ = ] bi ; inline
|
: mask? ( x n -- ? ) [ mask ] [ = ] bi ; inline
|
||||||
: wrap ( m n -- m' ) 1 - bitand ; inline
|
: wrap ( m n -- m' ) 1 - bitand ; inline
|
||||||
: on-bits ( m -- n ) dup 0 <= [ drop 0 ] [ 2^ 1 - ] if ; inline
|
: on-bits ( m -- n ) dup 0 <= [ drop 0 ] [ 2^ 1 - ] if ; inline
|
||||||
|
|
Loading…
Reference in New Issue