RGB should not be packed, so that it has align = 1

This commit is contained in:
Mitchell Hashimoto
2022-09-23 13:10:51 -07:00
parent a1d238e385
commit 1a2b684b0e
2 changed files with 3 additions and 5 deletions

View File

@ -73,9 +73,6 @@ const b64_encoder = std.base64.Base64Encoder.init(b64_alphabet, null);
const b64_alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".*; const b64_alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".*;
test { test {
// Unknown why this fails
if (builtin.zig_backend != .stage1) return error.SkipZigTest;
var td = try init(); var td = try init();
defer td.deinit(); defer td.deinit();

View File

@ -94,12 +94,13 @@ pub const Name = enum(u8) {
}; };
/// RGB /// RGB
pub const RGB = packed struct { pub const RGB = struct {
r: u8 = 0, r: u8 = 0,
g: u8 = 0, g: u8 = 0,
b: u8 = 0, b: u8 = 0,
test { test "size" {
try std.testing.expectEqual(@as(usize, 24), @bitSizeOf(RGB));
try std.testing.expectEqual(@as(usize, 3), @sizeOf(RGB)); try std.testing.expectEqual(@as(usize, 3), @sizeOf(RGB));
} }
}; };