aboutsummaryrefslogtreecommitdiff
path: root/docs/operators.md
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/operators.md
parent3743913ce2c5bc37f899d437c09b60cbb3bc6dea (diff)
Clean up behavior and syntax for unsigned bit shifts (<<<, >>>)
Diffstat (limited to 'docs/operators.md')
-rw-r--r--docs/operators.md10
1 files changed, 7 insertions, 3 deletions
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