Skip to content

Commit

Permalink
Stdx: Export backported HashMap
Browse files Browse the repository at this point in the history
  • Loading branch information
sentientwaffle committed Jun 13, 2023
1 parent 54c178b commit 21088cf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/lsm/table_mutable.zig
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ pub fn TableMutableType(comptime Table: type, comptime tree_name: [:0]const u8)
const TableMutable = @This();

const load_factor = 50;
/// TODO(Zig): Import from std. See https://github.com/ziglang/zig/pull/15989.
const Values = @import("../hash_map.zig").HashMapUnmanaged(
const Values = stdx.HashMapUnmanaged(
Value,
void,
Table.HashMapContextValue,
Expand Down
6 changes: 6 additions & 0 deletions src/stdx.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ const std = @import("std");
const builtin = @import("builtin");
const assert = std.debug.assert;

/// TODO(Zig): Remove these and import directly from std.
/// See https://github.com/ziglang/zig/pull/15989.
/// This backported HashMap is only needed when fetchRemove() will be used.
pub const HashMapUnmanaged = @import("./hash_map.zig").HashMapUnmanaged;
pub const AutoHashMapUnmanaged = @import("./hash_map.zig").AutoHashMapUnmanaged;

pub inline fn div_ceil(numerator: anytype, denominator: anytype) @TypeOf(numerator, denominator) {
comptime {
switch (@typeInfo(@TypeOf(numerator))) {
Expand Down
3 changes: 1 addition & 2 deletions src/vsr/superblock_client_sessions.zig
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ pub const ClientSessions = struct {
};

/// Values are indexes into `entries`.
/// TODO(Zig): Import from std. See https://github.com/ziglang/zig/pull/15989.
const EntriesByClient = @import("../hash_map.zig").AutoHashMapUnmanaged(u128, usize);
const EntriesByClient = stdx.AutoHashMapUnmanaged(u128, usize);

/// Free entries are zeroed, both in `entries` and on-disk.
entries: []Entry,
Expand Down

0 comments on commit 21088cf

Please sign in to comment.