// The version of this port, the same for both flavours (rpmalloc2 and Default_Allocator). // // VERSION is upstream's version followed by this port's revision. Raise VERSION_REVISION with every // change to a file that install.jai installs: an installed copy whose revision is lower is behind, // and install.jai updates it. Raise it here, in VERSION, and in CAPS_VERSION_STRING in module.jai and // Default_Allocator/module.jai; compile-time asserts fail the build until all four agree. To see what // an installed copy is, read this file in it, or the CAPS name its allocator reports // ("rpmalloc 2.0.1-jai.N (Jai port)"). VERSION :: "2.0.1-jai.16"; VERSION_REVISION :: 16; RPMALLOC_VERSION :: "2.0.1"; // The upstream rpmalloc release this is a port of. #assert #run version_is(VERSION, RPMALLOC_VERSION, VERSION_REVISION) "VERSION must be RPMALLOC_VERSION \"-jai.\" VERSION_REVISION"; #scope_module // For the compile-time version asserts, here and in both module.jai files. #jai not tprint: they run // as the target's code, and the x64 tprint uses SIMD assembly that a compiler on another CPU cannot // execute (a Linux x64 build on Apple silicon failed). Plain loops run anywhere, and nothing allocates. // Is `version` exactly upstream "-jai." revision? version_is :: (version: string, upstream: string, revision: int) -> bool { PREFIX :: "-jai."; if !text_starts(version, 0, upstream) || !text_starts(version, upstream.count, PREFIX) return false; at := upstream.count + PREFIX.count; if at >= version.count return false; n := 0; for i: at..version.count-1 { c := version[i]; if c < #char "0" || c > #char "9" return false; n = n * 10 + (c - #char "0"); } return n == revision; } // Is `text` exactly before, middle, after joined? text_is :: (text: string, before: string, middle: string, after: string) -> bool { if text.count != before.count + middle.count + after.count return false; return text_starts(text, 0, before) && text_starts(text, before.count, middle) && text_starts(text, before.count + middle.count, after); } text_starts :: (text: string, at: int, part: string) -> bool { if at + part.count > text.count return false; for 0..part.count-1 if text[at + it] != part[it] return false; return true; }