Minor fixes

This commit is contained in:
2026-09-12 23:52:43 +02:00
parent 8dbac71007
commit 70076f2268
2 changed files with 7 additions and 7 deletions

View File

@@ -170,7 +170,7 @@ pub fn isCompatible(comptime ZigType: type, c_type: Type) bool {
.unsigned_long => zig_int.signedness == .unsigned and zig_int.bits == 64,
.unsigned_long_long => zig_int.signedness == .unsigned and zig_int.bits == 64,
.char => zig_int.bits = 8,
.char => zig_int.bits == 8,
else => false,
},

View File

@@ -451,7 +451,7 @@ pub const ChunkType = enum(u32) {
_,
fn fromName(name: *const [4]u8) u32 {
return @bitCast(name.*);
return std.mem.bytesToValue(u32, name);
}
pub fn fromBytes(bytes: *const [4]u8) ChunkType {
@@ -459,18 +459,18 @@ pub const ChunkType = enum(u32) {
}
pub fn toBytes(self: ChunkType) [4]u8 {
return @bitCast(@intFromEnum(self));
return std.mem.toBytes(self);
}
pub fn ancillary(self: ChunkType) bool {
pub fn isAncillary(self: ChunkType) bool {
return self.toBytes()[0] & 0b0010_0000 != 0;
}
pub fn private(self: ChunkType) bool {
pub fn isPrivate(self: ChunkType) bool {
return self.toBytes()[1] & 0b0010_0000 != 0;
}
pub fn safeToCopy(self: ChunkType) bool {
pub fn isSafeToCopy(self: ChunkType) bool {
return self.toBytes()[3] & 0b0010_0000 != 0;
}
@@ -493,7 +493,7 @@ pub const StandardKeyword = enum {
Description,
/// Copyright notice
Copyright,
/// Time Time of original image creation
/// Time of original image creation
Creation,
/// Software used to create the image
Software,