all repos — min @ 3e9724e3bb3a868a43ae67a746be13390c478f58

A small but practical concatenative programming language.

Added docs for new bitwise symbols.
h3rald h3rald@h3rald.com
Sun, 08 Oct 2023 10:41:23 +0200
commit

3e9724e3bb3a868a43ae67a746be13390c478f58

parent

a6f96659a51fabc205ab421ddee9b05a0519e844

3 files changed, 13 insertions(+), 7 deletions(-)

jump to
M minpkg/lib/min_num.nimminpkg/lib/min_num.nim

@@ -293,10 +293,4 @@ def.symbol("bitparity") do (i: In):

let args = i.expect("int") i.push (args[0].intVal.parityBits).newVal - def.symbol("bitmask") do (i: In): - let args = i.expect("int", "int") - var val = args[0].intVal - val.mask(args[1].intVal) - i.push val.newVal - def.finalize("num")
M next-release.mdnext-release.md

@@ -7,7 +7,7 @@ ### New Features

* Added support for binary (0b) octal (0o), and hexadecimal (0x) integers in parser. * Added `base` and `base?` symbols to set and get the current number base (dec, hex, bin or oct). -* Added `bitparity`, `bitclear`, `bitflip`, `bitset`, `bitmask` symbols for biwise operations. +* Added `bitparity`, `bitclear`, `bitflip`, `bitset`, symbols for biwise operations. * Added `to-(hex|bin|dec|oct)` and `from-(hex|bin|dec|oct)` symbols to convert integers to and from different string representations. * Added `help`, `compile` and `eval` commands to the min executable.
M site/contents/reference-num.mdsite/contents/reference-num.md

@@ -25,11 +25,23 @@

{#op||bitand||{{i1}} {{i2}}||{{i3}}|| Computes the bitwise *and* of integer {{i1}} and {{i2}}.#} +{#op||bitclear||{{i1}} {{q}}||{{i2}}|| +Sets the bytes specified via their position in {{i1}} through {{q}} to 0. #} + +{#op||bitflip||{{i1}} {{q}}||{{i2}}|| +Flips the bytes specified via their position in {{i1}} through {{q}}. #} + {#op||bitnot||{{i1}}||{{i2}}|| Computes the bitwise *complement* of {{i1}}.#} {#op||bitor||{{i1}} {{i2}}||{{i3}}|| Computes the bitwise *or* of integers {{i1}} and {{i2}}.#} + +{#op||bitparity||{{i1}}||{{i2}}|| +Calculate the bit parity in {{i1}}. If the number of 1-bits is odd, the parity is 1, otherwise 0.#} + +{#op||bitset||{{i1}} {{q}}||{{i2}}|| +Sets the bytes specified via their position in {{i1}} through {{q}} to 0. #} {#op||bitxor||{{i1}} {{i2}}||{{i3}}|| Computes the bitwise *xor* of integers {{i1}} and {{i2}}.#}