aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-11-03 16:06:26 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-11-03 16:06:26 -0500
commit39a58bc129fd9461d54b837bc1650c4c650aa333 (patch)
treed3a7e9b3be33856cc8343f6cb273f9a14c28effd /docs
parent3743913ce2c5bc37f899d437c09b60cbb3bc6dea (diff)
Clean up behavior and syntax for unsigned bit shifts (<<<, >>>)
Diffstat (limited to 'docs')
-rw-r--r--docs/integers.md5
-rw-r--r--docs/operators.md10
2 files changed, 10 insertions, 5 deletions
diff --git a/docs/integers.md b/docs/integers.md
index ef30b74d..1c30aee0 100644
--- a/docs/integers.md
+++ b/docs/integers.md
@@ -21,8 +21,9 @@ truncated form of the input value.
Integers support the standard math operations (`x+y`, `x-y`, `x*y`, `x/y`) as
well as powers/exponentiation (`x^y`), modulus (`x mod y` and `x mod1 y`), and
-bitwise operations: `x and y`, `x or y`, `x xor y`, `x << y`, and `x >> y`. The
-operators `and`, `or`, and `xor` are _bitwise_, not logical operators.
+bitwise operations: `x and y`, `x or y`, `x xor y`, `x << y`, `x >> y`, `x >>>
+y` (unsigned right shift), and `x <<< y` (unsighted left shift). The operators
+`and`, `or`, and `xor` are _bitwise_, not logical operators.
# Integer Functions
diff --git a/docs/operators.md b/docs/operators.md
index 4afa3ad3..25f78689 100644
--- a/docs/operators.md
+++ b/docs/operators.md
@@ -10,6 +10,7 @@ Tomo supports a number of operators, both infix and prefix:
is particularly useful for doing wraparound behavior on 1-indexed arrays.
- `++`: concatenation (for text and arrays)
- `<<`, `>>`: bitwise left shift and right shift for integers
+- `<<<`, `>>>`: unsigned bitwise left shift and right shift for integers
- `_min_`/`_max_`: minimum and maximum (see below)
- `<`, `<=`, `>`, `>=`, `==`, `!=`: comparisons
- `<>`: the signed comparison operator (see below)
@@ -283,8 +284,10 @@ and will return a value of the same type.
#### Bit Operations
```
-func left_shift(T, Int)->T
-func right_shift(T, Int)->T
+func left_shifted(T, Int)->T
+func right_shifted(T, Int)->T
+func unsigned_left_shifted(T, Int)->T
+func unsigned_right_shifted(T, Int)->T
func bit_and(T, T)->T
func bit_or(T, T)->T
func bit_xor(T, T)->T
@@ -292,7 +295,8 @@ func bit_xor(T, T)->T
In a bit shifting expression, `a >> b` or `a << b`, if `a` has type `T` and `b`
is an `Int`, then the method `left_shift()` or `right_shift()` will be invoked.
-A value of type `T` will be returned.
+A value of type `T` will be returned. The same is true for `>>>`
+(`unsigned_right_shift()`) and `<<<` (`unsigned_left_shift`).
In a bitwise binary operation `a and b`, `a or b`, or `a xor b`, then the
method `bit_and()`, `bit_or()`, or `bit_xor()` will be invoked, assuming that