Skip to content
Open
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
5705f06
chore: add xjb-as to util
JairusSW Jun 9, 2026
c778be9
chore: add liceses to NOTICE
JairusSW Jun 9, 2026
1fdc61d
chore: update changed tests
JairusSW Jun 9, 2026
09c3ef8
chore: simplify and use smaller tables
JairusSW Jun 16, 2026
7cd14a4
chore: use table from number instead
JairusSW Jun 16, 2026
e0646ff
chore: update notice
JairusSW Jun 16, 2026
650a7c3
chore: clean up
JairusSW Jun 16, 2026
759c01f
chore: clean up
JairusSW Jun 16, 2026
fa93c15
chore: rename to dtoa.ts and remove XJB_SIMD toggle
JairusSW Jun 17, 2026
d41ce13
Update std/assembly/util/dtoa.ts
JairusSW Jun 17, 2026
4aa4210
Update std/assembly/util/dtoa.ts
JairusSW Jun 17, 2026
48f3ee5
Update std/assembly/util/dtoa.ts
JairusSW Jun 17, 2026
5dd492b
Update std/assembly/util/dtoa.ts
JairusSW Jun 17, 2026
b1bcc18
Update std/assembly/util/dtoa.ts
JairusSW Jun 17, 2026
4bdb432
chore: update import and update test outputs
JairusSW Jun 17, 2026
76c4b11
Update std/assembly/util/dtoa.ts
JairusSW Jun 17, 2026
b9cf897
Update std/assembly/util/dtoa.ts
JairusSW Jun 17, 2026
87c12f1
Update std/assembly/util/dtoa.ts
JairusSW Jun 17, 2026
c97a0e9
Update std/assembly/util/dtoa.ts
JairusSW Jun 17, 2026
9721226
chore: add lazy decorators where needed, update styling, etc
JairusSW Jun 17, 2026
2dfdb0f
use let
MaxGraey Jun 18, 2026
f322f2d
Apply suggestion from @MaxGraey
MaxGraey Jun 18, 2026
422a611
chore: add some comments for more esoteric literals
JairusSW Jun 18, 2026
e7b2dd8
Merge branch 'jairus/switch-to-xjb' of github.com:JairusSW/assemblysc…
JairusSW Jun 18, 2026
795b262
chore: use named constants instead of esoteric literals
JairusSW Jun 18, 2026
209ed02
chore: dedupe constants
JairusSW Jun 18, 2026
fe03f90
chore: standardize naming convention
JairusSW Jun 18, 2026
29ac707
core: more styling stuff
JairusSW Jun 18, 2026
d5b0607
chore: remove dbl ternary
JairusSW Jun 18, 2026
8044b88
reformat
MaxGraey Jun 18, 2026
43dbf58
chore: use more descriptive names
JairusSW Jun 24, 2026
c5c6e07
Merge branch 'jairus/switch-to-xjb' of github.com:JairusSW/assemblysc…
JairusSW Jun 24, 2026
d93842f
fix: correct dtoa digit counts and shortest formatting
JairusSW Sep 21, 2026
644040a
Merge origin/main into jairus/switch-to-xjb
JairusSW Sep 21, 2026
a28f957
fix: finalize float formatting and review cleanup
JairusSW Sep 21, 2026
c13739d
Avoid emitting unused dtoa globals in debug output
JairusSW Sep 21, 2026
42ff464
Optimize float formatting fast paths and validate scalar/SIMD output
JairusSW Sep 21, 2026
859401d
Cover f32 exact-integer fast-path boundary
JairusSW Sep 21, 2026
cf6bad1
Optimize SIMD digit packing and normalized f64 formatting
JairusSW Sep 21, 2026
f516ed4
Use SIMD digit packing for long integer formatting
JairusSW Sep 21, 2026
c9f8b9c
Use full dtoa power cache in speed builds
JairusSW Sep 21, 2026
fdbc7ed
Speed up subnormal f32 digit scaling
JairusSW Sep 21, 2026
1079de4
Use compact power cache in all builds
JairusSW Sep 21, 2026
ed4390a
Reuse float power cache for common doubles
JairusSW Sep 21, 2026
055a82d
Share minor powers with float cache
JairusSW Sep 21, 2026
f39d7b7
Use one shared power table in every build
JairusSW Sep 21, 2026
dcab81e
Trim shared power table to common f64 range
JairusSW Sep 21, 2026
881a8ec
Use compact power cache outside common exponents
JairusSW Sep 21, 2026
84f5f2f
Test exact dtoa output and compact powers
JairusSW Sep 21, 2026
660bd25
Speed up exact-integer string formatting
JairusSW Sep 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: rename to dtoa.ts and remove XJB_SIMD toggle
  • Loading branch information
JairusSW committed Jun 17, 2026
commit fa93c15f309d1463e0ecf6878a21855697ac36eb
16 changes: 5 additions & 11 deletions std/assembly/util/xjb.ts → std/assembly/util/dtoa.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { POWERS10 } from "./string";
import { DIGITS } from "./number";

// @ts-expect-error: may exist
export const HAS_SIMD: bool = isDefined(XJB_SIMD) ? <bool>XJB_SIMD : (isDefined(ASC_FEATURE_SIMD) && ASC_FEATURE_SIMD);

// High 64 bits of the 128-bit product x * y. Matches umul128.
// @ts-expect-error: decorator
@inline export function mulhi64(a: u64, b: u64): u64 {
Comment thread
JairusSW marked this conversation as resolved.
Outdated
Expand Down Expand Up @@ -44,11 +41,8 @@ export const HAS_SIMD: bool = isDefined(XJB_SIMD) ? <bool>XJB_SIMD : (isDefined(
export let gPow10Hi: u64 = 0;
export let gPow10Lo: u64 = 0;

// Compact pow10 (Dougall Johnson's method, ported from vitaut/zmij): rather than a
// 9888-byte table of 128-bit significands, store two small anchor sets and rebuild
// any of the 618 powers on load. 10**i = top-128-bits(major[(i+10)/28] * minor[(i+10)%28])
// minus a per-power round-down bit. ~672 bytes, bit-identical to the full table,
// one 128x64 multiply per load - the size/speed point xjb's *_comp variant targets.
// Compact pow10 (Dougall Johnson's method, ported from vitaut/zmij)
// 10**i = top-128-bits(major[(i+10)/28] * minor[(i+10)%28]) minus a per-power round-down bit.

// 28 normalized exact powers 10**0..10**27 - the within-stride minor factors.
const POW10_MINOR = memory.data<u64>([
Expand Down Expand Up @@ -231,7 +225,7 @@ export let gDigNum: i32 = 0;

// @ts-expect-error: decorator
@inline export function toDigits64(value: u64): void {
if (HAS_SIMD) return toDigits64Simd(value);
if (ASC_FEATURE_SIMD) return toDigits64Simd(value);
toDigits64Swar(value);
}
Comment thread
JairusSW marked this conversation as resolved.

Expand All @@ -253,7 +247,7 @@ export const MAX_FIXED_DEC_EXP = 20;
// @ts-expect-error: decorator
@inline export function putBlock8(p: usize, ascii: u64, off: usize = 0): void {
Comment thread
JairusSW marked this conversation as resolved.
Outdated
const base = p + off;
if (HAS_SIMD) {
if (ASC_FEATURE_SIMD) {
v128.store(base, i16x8.extend_low_i8x16_u(i64x2.splat(ascii)));
} else {
store<u16>(base, <u16>(ascii & 0xff));
Expand Down Expand Up @@ -706,7 +700,7 @@ export const FLOAT_MAX_DIGITS10 = 9;
// to_digits<32>: a single u64 of 8 ASCII digits (value < 1e8).
// @ts-expect-error: decorator
@inline export function toDigits32(value: u64): void {
if (HAS_SIMD) return toDigits32Simd(value);
if (ASC_FEATURE_SIMD) return toDigits32Simd(value);
toBcd8(value);
gDigHi = gBcd + ZEROS;
gDigNum = gBcdLen;
Expand Down