code wiki / (root) / _primes_bitpacked.nx

_primes_bitpacked.nx

buildroot/runtime/_primes_bitpacked.nx

2372 B86 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tooltopic primes
docsdependenciesstructsconstsfunctions

about

_primes_bitpacked.nx -- bit-packed Sieve of Eratosthenes. 1 bit per odd number (vs 1 byte in byte-sieve). Memory: SIEVE_SIZE/16 bytes vs SIEVE_SIZE/2 bytes. Cache-friendlier; better passes/sec. Bit i represents odd number (2*i + 3), as in byte sieve. Byte b at bit-offset (i % 8): bit b of byte (i / 8). Bit set = COMPOSITE.

dependencies 1 imports · 0 importers

syscalls.nx _primes_bitpacked.nx

imports: syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main one_pass bit_get bit_set

structs

none

consts

12const SIEVE_SIZE: i64 = 1000000
13const N_PASSES: i64 = 100

functions

15func bit_get(buf: *u8, i: i64) -> i64
called by 1: one_pass
22func bit_set(buf: *u8, i: i64) -> i64
called by 1: one_pass
31func one_pass(buf: *u8, half: i64, byte_count: i64) -> i64
called by 1: main calls 2: bit_getbit_set
74func main() -> i64
calls 1: one_pass