Files
ziran/tests/benchmarks/codec_kernels_layout.zi
T
waozi 1c897d763f Add checked edits, Unicode normalization and owned JSON, file and process APIs
ziran edit previews and applies checked source edits, and ziran compact and
expand give .zi files a lossless compact transport. Diagnostics bound each
message and report truncation. The standard library adds Unicode 17 NFC,
lowercase and properties, owned JSON documents with Into accessors and
erasers, file identity snapshots, 32-argument process channels with optional
stderr discard, socket write shutdown, longer Curl header values and fallible
image resampling. Checks cover the new APIs, and stale tests now match the
bounded diagnostics, the 4 ms kernel timestamp tick and the check runner.
2026-11-05 11:47:14 -03:00

32 lines
1010 B
Ziran

// Logical size_of and actual native record operations are separate evidence.
Probe :: struct { prefix: u8; pointer: *u8; tail: u32; }
// Exercise a real slice value as well as its size (emits native Slice support).
#program_export
ReadSlice :: (bytes: []u8) -> s64 { return cast(s64)bytes.count }
#program_export
PointerSize :: () -> s64 { return size_of(*u8) }
#program_export
WordSize :: () -> s64 { return size_of(usize) }
#program_export
SliceSize :: () -> s64 { return size_of([]u8) }
#program_export
RecordSize :: () -> s64 { return size_of(Probe) }
#program_export
Sizes :: () -> s64 {
return PointerSize() * 1000000 + WordSize() * 10000 +
SliceSize() * 100 + RecordSize()
}
#program_export
ReadProbe :: (probe: *Probe) -> s64 {
return cast(s64)probe.prefix + cast(s64)probe.pointer.* + cast(s64)probe.tail
}
#program_export
RoundTrip :: () -> s64 {
byte: u8 = 19
probe: Probe
probe.prefix = 7
probe.pointer = *byte
probe.tail = 16
return ReadProbe(*probe)
}