Add documentation for bitwise functions

This commit is contained in:
Kilian Vounckx 2023-06-17 20:25:36 +02:00
parent 402a89237d
commit 5512dd9675
No known key found for this signature in database
GPG key ID: 9E8B0D7D30F20264

View file

@ -976,10 +976,21 @@ remChecked = \a, b ->
isMultipleOf : Int a, Int a -> Bool
## Does a "bitwise and". Each bit of the output is 1 if the corresponding bit
## of x AND of y is 1, otherwise it's 0.
bitwiseAnd : Int a, Int a -> Int a
## Does a "bitwise or". Each bit of the output is 0 if the corresponding bit
## of x AND of y is 0, otherwise it's 1.
bitwiseXor : Int a, Int a -> Int a
## Does a "bitwise exclusive or". Each bit of the output is the same as the
## corresponding bit in x if that bit in y is 0, and it's the complement of
## the bit in x if that bit in y is 1.
bitwiseOr : Int a, Int a -> Int a
## Returns the complement of x - the number you get by switching each 1 for a
## 0 and each 0 for a 1. This is the same as -x - 1.
bitwiseNot : Int a -> Int a
bitwiseNot = \n ->
bitwiseXor n (subWrap 0 1)