Compare commits
No commits in common. "0c854093693c86571c9bb667ebcf5825acae908f" and "470c774836b611f760fde4fecd3ae8d4b1d6eac9" have entirely different histories.
0c85409369
...
470c774836
10
src/lib.zig
10
src/lib.zig
|
@ -11,8 +11,8 @@ pub const Emulator = struct {
|
||||||
writeFn: *const fn (*anyopaque, u32, u8) void,
|
writeFn: *const fn (*anyopaque, u32, u8) void,
|
||||||
|
|
||||||
// FIXME: Expensive copy
|
// FIXME: Expensive copy
|
||||||
registersFn: *const fn (*anyopaque) [16]u32,
|
registersFn: *const fn (*const anyopaque) [16]u32,
|
||||||
cpsrFn: *const fn (*anyopaque) u32,
|
cpsrFn: *const fn (*const anyopaque) u32,
|
||||||
|
|
||||||
pub fn init(ptr: anytype) Self {
|
pub fn init(ptr: anytype) Self {
|
||||||
const Ptr = @TypeOf(ptr);
|
const Ptr = @TypeOf(ptr);
|
||||||
|
@ -33,16 +33,16 @@ pub const Emulator = struct {
|
||||||
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 = @ptrCast(Ptr, @alignCast(alignment, pointer));
|
||||||
|
|
||||||
return @call(.{ .modifier = .always_inline }, ptr_info.Pointer.child.write, .{ self, addr, value });
|
return @call(.{ .modifier = .always_inline }, ptr_info.Pointer.child.read, .{ self, addr, value });
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn registersImpl(pointer: *anyopaque) [16]u32 {
|
pub fn registersImpl(pointer: *const anyopaque) [16]u32 {
|
||||||
const self = @ptrCast(Ptr, @alignCast(alignment, pointer));
|
const self = @ptrCast(Ptr, @alignCast(alignment, pointer));
|
||||||
|
|
||||||
return @call(.{ .modifier = .always_inline }, ptr_info.Pointer.child.registers, .{self});
|
return @call(.{ .modifier = .always_inline }, ptr_info.Pointer.child.registers, .{self});
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn cpsrImpl(pointer: *anyopaque) u32 {
|
pub fn cpsrImpl(pointer: *const anyopaque) u32 {
|
||||||
const self = @ptrCast(Ptr, @alignCast(alignment, pointer));
|
const self = @ptrCast(Ptr, @alignCast(alignment, pointer));
|
||||||
|
|
||||||
return @call(.{ .modifier = .always_inline }, ptr_info.Pointer.child.cpsr, .{self});
|
return @call(.{ .modifier = .always_inline }, ptr_info.Pointer.child.cpsr, .{self});
|
||||||
|
|
Loading…
Reference in New Issue