.githooks/
compiler/
kernel/
lib/
examples/
std/
arch/
bits/
char/
collections/
fs/
hash/
lang/
mem/
sys/
arch.rad
68 B
bits.rad
1.6 KiB
char.rad
1.5 KiB
collections.rad
39 B
fmt.rad
11.6 KiB
fs.rad
11.0 KiB
hash.rad
41 B
intrinsics.rad
467 B
io.rad
1.7 KiB
lang.rad
335 B
mem.rad
12.0 KiB
mem.ras
919 B
process.rad
6.2 KiB
std.manifest
4.9 KiB
std.rad
349 B
sys.rad
1.0 KiB
testing.rad
2.4 KiB
tests.rad
26.6 KiB
vec.rad
3.2 KiB
scripts/
seed/
sublime/
test/
vim/
.gitignore
333 B
.gitsigners
224 B
AGENTS.md
8.3 KiB
CONTRIBUTING
2.1 KiB
LICENSE
1.1 KiB
Makefile
2.5 KiB
README
3.4 KiB
STYLE
3.2 KiB
std.lib
2.1 KiB
std.lib.test
1.1 KiB
lib/std/bits.rad
raw
| 1 | //! Fixed-width bit operations. Rotation counts wrap modulo the value width. |
| 2 | |
| 3 | @test mod tests; |
| 4 | |
| 5 | /// Rotate a 32-bit value to the left. The count is reduced modulo 32. |
| 6 | @intrinsic export fn rotateLeft32(value: u32, count: u32) -> u32; |
| 7 | |
| 8 | /// Rotate a 32-bit value to the right. The count is reduced modulo 32. |
| 9 | @intrinsic export fn rotateRight32(value: u32, count: u32) -> u32; |
| 10 | |
| 11 | /// Count high zero bits in a 32-bit value. Return 32 for zero. |
| 12 | @intrinsic export fn leadingZeros32(value: u32) -> u32; |
| 13 | |
| 14 | /// Count low zero bits in a 32-bit value. Return 32 for zero. |
| 15 | @intrinsic export fn trailingZeros32(value: u32) -> u32; |
| 16 | |
| 17 | /// Count the set bits in a 32-bit value. |
| 18 | @intrinsic export fn popCount32(value: u32) -> u32; |
| 19 | |
| 20 | /// Reverse the byte order of a 32-bit value. |
| 21 | @intrinsic export fn byteSwap32(value: u32) -> u32; |
| 22 | |
| 23 | /// Rotate a 64-bit value to the left. The count is reduced modulo 64. |
| 24 | @intrinsic export fn rotateLeft64(value: u64, count: u32) -> u64; |
| 25 | |
| 26 | /// Rotate a 64-bit value to the right. The count is reduced modulo 64. |
| 27 | @intrinsic export fn rotateRight64(value: u64, count: u32) -> u64; |
| 28 | |
| 29 | /// Count high zero bits in a 64-bit value. Return 64 for zero. |
| 30 | @intrinsic export fn leadingZeros64(value: u64) -> u32; |
| 31 | |
| 32 | /// Count low zero bits in a 64-bit value. Return 64 for zero. |
| 33 | @intrinsic export fn trailingZeros64(value: u64) -> u32; |
| 34 | |
| 35 | /// Count the set bits in a 64-bit value. |
| 36 | @intrinsic export fn popCount64(value: u64) -> u32; |
| 37 | |
| 38 | /// Reverse the byte order of a 64-bit value. |
| 39 | @intrinsic export fn byteSwap64(value: u64) -> u64; |
| 40 | |
| 41 | /// Reverse the byte order of a 16-bit value. |
| 42 | @intrinsic export fn byteSwap16(value: u16) -> u16; |