ReadonlyhighHigh 32 bits (unsigned).
ReadonlylowLow 32 bits (unsigned).
Static ReadonlyZEROThe 64-bit zero. Long is immutable (readonly halves), so this single shared
instance is safe to reuse anywhere a zero default is needed — generated code
uses it for fixed-count array defaults and pad-fill instead of
Long.fromValue(0), which would run bigint arithmetic per call on the hot
decode/encode path.
Materialise as a bigint. signed reads the high bit as two's complement.
Decimal string (signed interprets the high bit as two's complement).
StaticfromSplit a bigint into its low/high 32-bit halves (two's complement).
StaticfromStaticfromFrom an integer number (|n| < 2^53); sign handled via bigint once.
Staticfrom
A 64-bit integer value carried as two unsigned 32-bit halves.
SofaBuffers accepts
bigintat every 64-bit surface for ergonomics, but abigintin the encode/decode hot path is expensive — especially on JavaScriptCore (Bun), where profiling showed thebigintsplit/materialise and zig-zag operations dominating the 64-bit array codecs.Longlets a caller (and the generated code) stay entirely onnumberarithmetic: the codec reads.low/.highdirectly, and anybigint↔Longconversion happens once at the API boundary rather than once per encode.Values are stored as raw two's-complement bits; the same
Longserves an unsigned or signed field — Long.toBigInt takes the signedness.