chore: update to latest zig

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

View File

@ -3,8 +3,8 @@
.version = "0.1.0", .version = "0.1.0",
.dependencies = .{ .dependencies = .{
.@"zig-network" = .{ .@"zig-network" = .{
.url = "https://github.com/MasterQ32/zig-network/archive/86c315be67c7567195cc426615d81202a39bbb91.tar.gz", .url = "https://github.com/MasterQ32/zig-network/archive/02ffa0fc310ff0746f06c9bfb73b008ce4fca200.tar.gz",
.hash = "1220746fef79fb9774d76a0a5d746ccf30cfc847bce4a3a7388c3451817b7ab92869", .hash = "1220fe0d4ca564aa15f3fd7f9f84ba04e031bb70c3a1432257e0d35c74b183550c24",
}, },
}, },
} }

View File

@ -293,7 +293,7 @@ pub fn checksum(input: []const u8) u8 {
var sum: usize = 0; var sum: usize = 0;
for (input) |char| sum += char; for (input) |char| sum += char;
return @truncate(u8, sum); return @truncate(sum);
} }
fn verify(input: []const u8, chksum: u8) bool { 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) @compileError("ptr must be a pointer");
if (ptr_info.Pointer.size != .One) @compileError("ptr must be a single-item pointer"); if (ptr_info.Pointer.size != .One) @compileError("ptr must be a single-item pointer");
const alignment = ptr_info.Pointer.alignment;
const gen = struct { const gen = struct {
pub fn readImpl(pointer: *anyopaque, addr: u32) u8 { 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 }); return @call(.always_inline, ptr_info.Pointer.child.read, .{ self, addr });
} }
pub fn writeImpl(pointer: *anyopaque, addr: u32, value: u8) void { 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 }); return @call(.always_inline, ptr_info.Pointer.child.write, .{ self, addr, value });
} }
pub fn registersImpl(pointer: *anyopaque) *[16]u32 { 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}); return @call(.always_inline, ptr_info.Pointer.child.registers, .{self});
} }
pub fn cpsrImpl(pointer: *anyopaque) u32 { 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}); return @call(.always_inline, ptr_info.Pointer.child.cpsr, .{self});
} }
pub fn stepImpl(pointer: *anyopaque) void { 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}); return @call(.always_inline, ptr_info.Pointer.child.step, .{self});
} }