Files
ww/lib/math/math.ww
Hojun-Cho aadc6618f0 lib: banner purge + WHY-only comment sweep (rule 8)
Every // ---- section banner dies (132 -> 0): names carry the WHAT.
Narration deleted (filename restatements, run-with lines, what-the-
next-line-does); every ref/hare cite, task cite, divergence, ABI/
layout contract, and ownership qualifier kept (borrowed-view lines
restored where the sweep over-cut). Comment-only proven: all 442
walk-workdir .s and 32 import-probe .s byte-identical before/after;
libbyteid 56-roster all-ID.
2026-08-08 21:10:18 +09:00

16 lines
375 B
Plaintext

// Subset of Hare's math::; only the absolute-value pair for the signed
// integer types we currently care about. The return type is unsigned
// so that abs(I32_MIN) doesn't overflow.
package math;
export fn absi32(n: i32) u32 = {
if (n < 0) { return (-n): u32; };
return n: u32;
};
export fn absi64(n: i64) u64 = {
if (n < 0) { return (-n): u64; };
return n: u64;
};