Files
scriptc/packages/compiler/src/format-integer.ts
Chris Tate 3af05d9fbc feat(compiler): lower the complete frontend statically
- Complete frontend lowering with zero rejected statements, dynamic islands, or skipped functions.
- Support contextual construction, presence guards, and union record copies used by the compiler.
- Add native CommonJS resolution and cross-platform file URL handling while preserving Node host behavior.
2026-09-28 23:49:13 -05:00

13 lines
529 B
TypeScript

/** Exact integer spelling shared by frontend inspection and code emission.
* Division preserves all safe integer bits without general radix conversion. */
export function unsignedHex(value: number): string {
if (!Number.isSafeInteger(value) || value < 0) throw new RangeError("hexadecimal value must be a nonnegative safe integer");
const digits = "0123456789abcdef";
let result = "";
do {
result = digits.charAt(value % 16) + result;
value = Math.floor(value / 16);
} while (value !== 0);
return result;
}