Fix documentation and comments

This commit is contained in:
Hans Svensson 2021-09-12 16:24:08 +02:00
parent becafe4001
commit 9cb3158dfd
2 changed files with 4 additions and 4 deletions

View File

@ -1820,7 +1820,7 @@ Cyclic rotation of the elements to the left.
### Bitwise ### Bitwise
Bitwise operations on arbitary precision integers. Bitwise operations on arbitrary precision integers.
#### bsr #### bsr
``` ```

View File

@ -63,7 +63,7 @@ namespace Bitwise =
// bitwise 'not' for arbitrary precision integers // bitwise 'not' for arbitrary precision integers
function bnot(a : int) = bxor(a, -1) function bnot(a : int) = bxor(a, -1)
// Bitwise 'and' for positive integers // Bitwise 'and' for non-negative integers
function uband(a : int, b : int) : int = function uband(a : int, b : int) : int =
require(a >= 0 && b >= 0, "uband is only defined for non-negative integers") require(a >= 0 && b >= 0, "uband is only defined for non-negative integers")
switch((a, b)) switch((a, b))
@ -81,7 +81,7 @@ namespace Bitwise =
2 => uband__(a / 2, b / 2, val * 2, acc + val) 2 => uband__(a / 2, b / 2, val * 2, acc + val)
_ => uband__(a / 2, b / 2, val * 2, acc) _ => uband__(a / 2, b / 2, val * 2, acc)
// Bitwise or for positive integers // Bitwise 'or' for non-negative integers
function ubor(a, b) = function ubor(a, b) =
require(a >= 0 && b >= 0, "ubor is only defined for non-negative integers") require(a >= 0 && b >= 0, "ubor is only defined for non-negative integers")
switch((a, b)) switch((a, b))
@ -98,7 +98,7 @@ namespace Bitwise =
0 => ubor__(a / 2, b / 2, val * 2, acc) 0 => ubor__(a / 2, b / 2, val * 2, acc)
_ => ubor__(a / 2, b / 2, val * 2, acc + val) _ => ubor__(a / 2, b / 2, val * 2, acc + val)
//Bitwise xor for positive integers //Bitwise 'xor' for non-negative integers
function function
ubxor : (int, int) => int ubxor : (int, int) => int
ubxor(0, b) = b ubxor(0, b) = b