terminal/new: remove more functions

This commit is contained in:
Mitchell Hashimoto
2024-02-16 21:06:15 -08:00
parent 1a3c617289
commit 6b2ec38a05

View File

@ -39,6 +39,8 @@ const mem = std.mem;
const Allocator = mem.Allocator;
const Wyhash = std.hash.Wyhash;
const Offset = @import("size.zig").Offset;
pub fn AutoHashMapUnmanaged(comptime K: type, comptime V: type) type {
return HashMapUnmanaged(K, V, AutoContext(K), default_max_load_percentage);
}
@ -247,10 +249,6 @@ pub fn HashMapUnmanaged(
found_existing: bool,
};
fn isUnderMaxLoadPercentage(size: Size, cap: Size) bool {
return size * 100 < max_load_percentage * cap;
}
/// Initialize a hash map with a given capacity and a buffer. The
/// buffer must fit within the size defined by `layoutForCapacity`.
pub fn init(new_capacity: Size, buf: []u8) Self {
@ -815,14 +813,6 @@ pub fn HashMapUnmanaged(
@memset(@as([*]u8, @ptrCast(self.metadata.?))[0 .. @sizeOf(Metadata) * self.capacity()], 0);
}
// This counts the number of occupied slots (not counting tombstones), which is
// what has to stay under the max_load_percentage of capacity.
fn load(self: *const Self) Size {
const max_load = (self.capacity() * max_load_percentage) / 100;
assert(max_load >= self.available);
return @as(Size, @truncate(max_load - self.available));
}
fn growIfNeeded2(self: *Self, new_count: Size) Allocator.Error!void {
if (new_count > self.available) return error.OutOfMemory;
}