Skip to content

Commit

Permalink
Pass model by reference instead of by value (eliminates copying 4KB o…
Browse files Browse the repository at this point in the history
…n each call), hate this syntax tbh
  • Loading branch information
mitiko committed Nov 14, 2022
1 parent 2eebc16 commit da88f07
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gallop.zig
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const Model = struct {
const Self = @This();

pub fn init() Self { return Self { .ctx = 0, .data = .{Counter.init()}**(1<<12) }; }
pub fn p(self: Self) u16 { return self.data[self.ctx].p(); }
pub fn p(self: *Self) u16 { return self.data[self.ctx].p(); }
pub fn update(self: *Self, bit: u1) void {
self.data[self.ctx].update(bit);
self.ctx <<= 1; self.ctx |= bit;
Expand Down

0 comments on commit da88f07

Please sign in to comment.