cbe: rewrite CType

Closes #14904
This commit is contained in:
Jacob Young
2024-03-28 20:41:58 -04:00
parent 6f10b11658
commit 5a41704f7e
45 changed files with 3681 additions and 3627 deletions

View File

@@ -712,7 +712,7 @@ pub const Key = union(enum) {
pub fn fieldName(
self: AnonStructType,
ip: *const InternPool,
index: u32,
index: usize,
) OptionalNullTerminatedString {
if (self.names.len == 0)
return .none;
@@ -3879,20 +3879,13 @@ pub const Alignment = enum(u6) {
none = std.math.maxInt(u6),
_,
pub fn toByteUnitsOptional(a: Alignment) ?u64 {
pub fn toByteUnits(a: Alignment) ?u64 {
return switch (a) {
.none => null,
else => @as(u64, 1) << @intFromEnum(a),
};
}
pub fn toByteUnits(a: Alignment, default: u64) u64 {
return switch (a) {
.none => default,
else => @as(u64, 1) << @intFromEnum(a),
};
}
pub fn fromByteUnits(n: u64) Alignment {
if (n == 0) return .none;
assert(std.math.isPowerOfTwo(n));