json-as
Version:
The only JSON library you'll need for AssemblyScript. SIMD enabled
14 lines (11 loc) • 379 B
text/typescript
import { bs } from "../../../lib/as-bs";
import { itoa_buffered } from "util/number";
// @ts-ignore: inline
export function serializeInteger<T extends number>(data: T): void {
bs.ensureSize(sizeof<T>() << 3);
const bytesWritten = itoa_buffered(bs.offset, data) << 1;
bs.growSize(bytesWritten);
bs.offset += bytesWritten;
}
// 32 {"x":,"y":,"z"}
// 18 3.41.28.3