_primes_bitpacked.nx
buildroot/runtime/_primes_bitpacked.nx
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
imports: syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 12 | const SIEVE_SIZE: i64 = 1000000 |
| 13 | const N_PASSES: i64 = 100 |
functions
| 15 | func bit_get(buf: *u8, i: i64) -> i64 called by 1: one_pass |
| 22 | func bit_set(buf: *u8, i: i64) -> i64 called by 1: one_pass |
| 31 | func one_pass(buf: *u8, half: i64, byte_count: i64) -> i64 |
| 74 | func main() -> i64 calls 1: one_pass |