Compare commits

..

No commits in common. "52278ab8e0366d0dd75f443cba59dbc30e1d4e55" and "f99e1eab67e65f8c89321dc5a92dce876e3ac72a" have entirely different histories.

3 changed files with 13 additions and 39 deletions

View File

@ -38,9 +38,17 @@ pub fn build(builder: *std.Build) void {
ona_exe.addModule("ona", ona_module);
ona_exe.addModule("kym", kym_module);
ona_exe.install();
// ona_exe.addIncludeDir("./ext");
ona_exe.linkSystemLibrary("SDL2");
ona_exe.linkLibC();
builder.installArtifact(ona_exe);
const run_cmd = ona_exe.run();
run_cmd.step.dependOn(builder.getInstallStep());
if (builder.args) |args| run_cmd.addArgs(args);
builder.step("run", "Run Ona application").dependOn(&run_cmd.step);
}
}

View File

@ -164,22 +164,13 @@ pub fn equals(this: []const u8, that: []const u8) bool {
var null_context = @as(usize, 0);
pub const null_allocator = Allocator.bind(&null_context, struct {
fn reallocate(context: *usize, options: AllocationOptions) ?[]u8 {
debug.assert(context.* == 0);
debug.assert(options.allocation == null);
return null;
}
});
pub const null_writer = Writer.bind(&null_context, struct {
fn write(context: *usize, buffer: []const u8) usize {
pub fn write(context: *usize, buffer: []const u8) usize {
debug.assert(context.* == 0);
return buffer.len;
}
}.write);
});
pub fn overlaps(pointer: [*]u8, memory_range: []u8) bool {
return (pointer >= memory_range.ptr) and (pointer < (memory_range.ptr + memory_range.len));

View File

@ -97,33 +97,8 @@ pub fn Dense(comptime key: Key, comptime Element: type) type {
};
}
pub fn remove(self: *Self, slot: KeySlot) bool {
const redirect = &self.slots[slot.index];
if (slot.salt != redirect.salt) {
return false;
}
const free_index = redirect.index;
self.values = self.values[0 .. (self.values.len - 1)];
if (self.values.len > 0) {
const free_data = &self.data[free_index];
const free_erase = &self.erase[free_index];
const last_data = &self.data[self.values.len];
const last_erase = &self.erase[self.values.len];
free_data.* = last_data.*;
free_erase.* = last_erase.*;
self.slots[free_erase.*].index = free_index;
}
redirect.salt = math.max(redirect.salt +% 1, 1);
redirect.index = self.next_free;
self.next_free = slot.index;
return true;
pub fn remove(_: *Self, _: u128) bool {
// TODO: Implement.
}
};
}