diff options
Diffstat (limited to 'src/zisp/value')
| -rw-r--r-- | src/zisp/value/array.zig | 14 | ||||
| -rw-r--r-- | src/zisp/value/istr.zig | 4 | ||||
| -rw-r--r-- | src/zisp/value/sstr.zig | 4 |
3 files changed, 15 insertions, 7 deletions
diff --git a/src/zisp/value/array.zig b/src/zisp/value/array.zig index 67a5f37..629d31c 100644 --- a/src/zisp/value/array.zig +++ b/src/zisp/value/array.zig @@ -54,23 +54,23 @@ pub const ArrayHeader = packed struct(u64) { len_or_ptr: u48, is_slice: bool = false, is_ptr: bool = false, - type: enum(u2) { int, float, value, string }, + type: enum(u2) { int, flt, val, str }, info: packed union { int: packed struct(u12) { size: u10, signed: bool, endian: Endian = .native, }, - float: packed struct(u12) { + flt: packed struct(u12) { size: u10, _: bool, endian: Endian = .native, }, - value: packed struct(u12) { + val: packed struct(u12) { weak: bool, _: u11, }, - string: packed struct(u12) { + str: packed struct(u12) { encoding: enum(u11) { utf8, utf16, @@ -99,7 +99,7 @@ pub const ArrayHeader = packed struct(u64) { fn eltSize(self: *@This()) u16 { std.debug.assert(!self.is_ptr); return switch (self.type) { - .string => 1, + .str => 1, else => @panic("not implemented"), }; } @@ -172,8 +172,8 @@ pub fn newString(alloc: Alloc, s: []const u8) !Value { const arr: ArrayPtr = @ptrCast(ptr); arr.* = .{ .len_or_ptr = @intCast(s.len), - .type = .string, - .info = .{ .string = .{} }, + .type = .str, + .info = .{ .str = .{} }, }; const buf = arr.bufContent(); @memcpy(buf[0..s.len], s); diff --git a/src/zisp/value/istr.zig b/src/zisp/value/istr.zig index 90eccb6..551ea1e 100644 --- a/src/zisp/value/istr.zig +++ b/src/zisp/value/istr.zig @@ -1,3 +1,7 @@ +//! Intermediate-length String +//! +//! Prefixed with a 1-byte length. Typically interned in an IstrSet. + const std = @import("std"); const gc = @import("../gc.zig"); diff --git a/src/zisp/value/sstr.zig b/src/zisp/value/sstr.zig index edc61a8..59995f3 100644 --- a/src/zisp/value/sstr.zig +++ b/src/zisp/value/sstr.zig @@ -1,3 +1,7 @@ +//! Short String +//! +//! Stored as an immediate in a NaN. Max length 6 bytes, cannot contain NUL. + const std = @import("std"); const value = @import("../value.zig"); |
