code wiki / (root) / nx_css_number_parse.nx

nx_css_number_parse.nx

buildroot/runtime/nx_css_number_parse.nx

4015 B111 linesdepth 2pulls 2 transitivereach 91 importersview sourcekind librarytopic css
docsdependenciesstructsconstsfunctions

about

nx_css_number_parse.nx -- decode a CSS NUMBER token body into a fixed-point integer in thousandths (Q3 millis). Phase 2.5 bridge primitive between value-as-bytes (from nx_css_tokenize / nx_css_parse / nx_css_apply) and integer arithmetic in the eventual nx_layout pipeline. "16" -> 16000 "1.5" -> 1500 "0.25" -> 250 "0" -> 0 "100" -> 100000 "1.234" -> 1234 (rounds toward zero past 3 decimal places) Why thousandths: matches the CSS spec resolution (browsers carry values at 1/96 inch precision; thousandths give us four-decimal- digit headroom for ratio math while staying in pure integer arithmetic per bits-up substrate -- no FP unit needed). What it does NOT handle (Phase 2b improvements): - negative numbers (margin: -10px) -- needs leading-minus parser - exponent notation (1e3) -- rare in CSS - "+" sign prefix - calc() expressions Per cardinal feedback-honest-perf-verdict-no-aspirational-claims: gap list is EXACT. genealogy_id: w3c_css_values_module_level_4_number_syntax lineage_id: nishi_browser_css_number_parse_v1 nx_safety_envelope: intended_use: "CSS number decode -- layout/paint input" sil_target: SIL1 evidence: [W3C_CSS_Values_canonical_basis, bounded_decimal_digits, integer_only_no_FP] verdict: NOT_YET_EVALUATED

dependencies 1 imports · 7 importers

nx_syscalls.nx nx_css_number_parse.nx nx_css_dimension_to_px.nx nx_css_dimension_to_px_test.nx nx_css_number_parse_test.nx nx_layout_block.nx nx_layout_block_horizontal_test.nx nx_layout_block_test.nx nx_paint_box_borders.nx

imports: nx_syscalls.nx

imported by: nx_css_dimension_to_px.nxnx_css_dimension_to_px_test.nxnx_css_number_parse_test.nxnx_layout_block.nxnx_layout_block_horizontal_test.nxnx_layout_block_test.nxnx_paint_box_borders.nx

structs

none

consts

41const NX_CSS_NUMBER_PARSE_ERROR: i64 = 9223372036854775807 // i64.max; OOB sentinel

functions

50func nx_css_number_parse(src: *u8, off: i64, len: i64) -> i64