code wiki / (root) / nx_vec.nx

nx_vec.nx

buildroot/runtime/nx_vec.nx

3015 B110 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind orphan librarytopic vec
docsdependenciesstructsconstsfunctions

about

vec.nx -- dynamic-array of i64 (Phase G7 in the roadmap). Specialised to i64 for now; generics will generalise to Vec<T> once parse.nx grows multi-param + full monomorphization support. That migration is API-compatible: rename occurrences of i64 in element positions only. Growth: geometric 2x on push (classical amortized O(1)). Backing storage via sys_mmap; never freed (compiler run-once, servers long-running will switch to a per-request arena later). No bounds-check-on-get to match kernel-code convention; call vec_get only after checking vec_len.

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_vec.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

structs

23struct Vec

consts

none

functions

31func vec_new(initial_cap: i64) -> *Vec
calls 1: sys_mmap
44func vec_len(v: *Vec) -> i64
49func vec_get(v: *Vec, i: i64) -> i64
54func vec_set(v: *Vec, i: i64, x: i64) -> i64
62func vec_grow(v: *Vec, want: i64) -> i64
called by 1: vec_push calls 1: sys_mmap
78func vec_push(v: *Vec, x: i64) -> i64
calls 1: vec_grow
89func vec_pop(v: *Vec) -> i64
97func vec_truncate(v: *Vec, n: i64) -> i64
103func vec_index_of(v: *Vec, needle: i64) -> i64