chore: update dependencies
This commit is contained in:
parent
f8c2479ed9
commit
11727fe46d
|
@ -3,8 +3,8 @@
|
||||||
.version = "0.1.0",
|
.version = "0.1.0",
|
||||||
.dependencies = .{
|
.dependencies = .{
|
||||||
.@"zba-util" = .{
|
.@"zba-util" = .{
|
||||||
.url = "https://git.musuka.dev/paoda/zba-util/archive/e616cf09e53f5c402c8f040d14baa211683e70e3.tar.gz",
|
.url = "https://git.musuka.dev/paoda/zba-util/archive/73577e9a6369f8393f25a73dfe73dcfaf8caf4a8.tar.gz",
|
||||||
.hash = "1220b80b2c0989dcc47275ab9d7d70da4858ef3c1fe1f934e8d838e65028127f6ef3",
|
.hash = "1220dad50e323a5edd843ed15aa0840dc876ca743049869727e759201e89d63bfa34",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,13 +26,13 @@ fn BitType(comptime FieldType: type, comptime ValueType: type, comptime shamt: u
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn read(self: anytype) ValueType {
|
pub fn read(self: anytype) ValueType {
|
||||||
return @bitCast(ValueType, @truncate(u1, self.bits.field().* >> shamt));
|
return @as(ValueType, @bitCast(@as(u1, @truncate(self.bits.field().* >> shamt))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Since these are mostly used with MMIO, I want to avoid
|
// Since these are mostly used with MMIO, I want to avoid
|
||||||
// reading the memory just to write it again, also races
|
// reading the memory just to write it again, also races
|
||||||
pub fn write(self: anytype, val: ValueType) void {
|
pub fn write(self: anytype, val: ValueType) void {
|
||||||
if (@bitCast(bool, val)) {
|
if (@as(bool, @bitCast(val))) {
|
||||||
self.set();
|
self.set();
|
||||||
} else {
|
} else {
|
||||||
self.unset();
|
self.unset();
|
||||||
|
@ -67,17 +67,17 @@ pub fn Bitfield(comptime FieldType: type, comptime shamt: usize, comptime num_bi
|
||||||
dummy: FieldType,
|
dummy: FieldType,
|
||||||
|
|
||||||
fn field(self: anytype) PtrCastPreserveCV(@This(), @TypeOf(self), FieldType) {
|
fn field(self: anytype) PtrCastPreserveCV(@This(), @TypeOf(self), FieldType) {
|
||||||
return @ptrCast(PtrCastPreserveCV(@This(), @TypeOf(self), FieldType), self);
|
return @as(PtrCastPreserveCV(@This(), @TypeOf(self), FieldType), @ptrCast(self));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn write(self: anytype, val: ValueType) void {
|
pub fn write(self: anytype, val: ValueType) void {
|
||||||
self.field().* &= ~self_mask;
|
self.field().* &= ~self_mask;
|
||||||
self.field().* |= @intCast(FieldType, val) << shamt;
|
self.field().* |= @as(FieldType, @intCast(val)) << shamt;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn read(self: anytype) ValueType {
|
pub fn read(self: anytype) ValueType {
|
||||||
const val: FieldType = self.field().*;
|
const val: FieldType = self.field().*;
|
||||||
return @intCast(ValueType, (val & self_mask) >> shamt);
|
return @as(ValueType, @intCast((val & self_mask) >> shamt));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue