chore: update to latest zig

This commit is contained in:
Rekai Nyangadzayi Musuka 2023-07-10 21:45:15 -05:00
parent 39a4260ffd
commit dc159b4aeb
3 changed files with 8 additions and 10 deletions

View File

@ -3,8 +3,8 @@
.version = "0.1.0",
.dependencies = .{
.@"zig-network" = .{
.url = "https://github.com/MasterQ32/zig-network/archive/86c315be67c7567195cc426615d81202a39bbb91.tar.gz",
.hash = "1220746fef79fb9774d76a0a5d746ccf30cfc847bce4a3a7388c3451817b7ab92869",
.url = "https://github.com/MasterQ32/zig-network/archive/7b5f76ea09626b96755c027bf4bd5b7e45297027.tar.gz",
.hash = "122090e7cb4459c2224399a45c56f47462733b919aa547c96b8c14ee705bfa22976e",
},
},
}

View File

@ -293,7 +293,7 @@ pub fn checksum(input: []const u8) u8 {
var sum: usize = 0;
for (input) |char| sum += char;
return @truncate(u8, sum);
return @truncate(sum);
}
fn verify(input: []const u8, chksum: u8) bool {

View File

@ -35,35 +35,33 @@ pub const Emulator = struct {
if (ptr_info != .Pointer) @compileError("ptr must be a pointer");
if (ptr_info.Pointer.size != .One) @compileError("ptr must be a single-item pointer");
const alignment = ptr_info.Pointer.alignment;
const gen = struct {
pub fn readImpl(pointer: *anyopaque, addr: u32) u8 {
const self = @ptrCast(Ptr, @alignCast(alignment, pointer));
const self: Ptr = @ptrCast(@alignCast(pointer));
return @call(.always_inline, ptr_info.Pointer.child.read, .{ self, addr });
}
pub fn writeImpl(pointer: *anyopaque, addr: u32, value: u8) void {
const self = @ptrCast(Ptr, @alignCast(alignment, pointer));
const self: Ptr = @ptrCast(@alignCast(pointer));
return @call(.always_inline, ptr_info.Pointer.child.write, .{ self, addr, value });
}
pub fn registersImpl(pointer: *anyopaque) *[16]u32 {
const self = @ptrCast(Ptr, @alignCast(alignment, pointer));
const self: Ptr = @ptrCast(@alignCast(pointer));
return @call(.always_inline, ptr_info.Pointer.child.registers, .{self});
}
pub fn cpsrImpl(pointer: *anyopaque) u32 {
const self = @ptrCast(Ptr, @alignCast(alignment, pointer));
const self: Ptr = @ptrCast(@alignCast(pointer));
return @call(.always_inline, ptr_info.Pointer.child.cpsr, .{self});
}
pub fn stepImpl(pointer: *anyopaque) void {
const self = @ptrCast(Ptr, @alignCast(alignment, pointer));
const self: Ptr = @ptrCast(@alignCast(pointer));
return @call(.always_inline, ptr_info.Pointer.child.step, .{self});
}