From d8077d782d63bc596829a93029d6119ded71e075 Mon Sep 17 00:00:00 2001 From: kayomn Date: Sat, 3 Jun 2023 20:05:47 +0000 Subject: [PATCH] Amend code review comments --- source/coral/slab.zig | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/source/coral/slab.zig b/source/coral/slab.zig index 42db01c..c80f969 100644 --- a/source/coral/slab.zig +++ b/source/coral/slab.zig @@ -7,11 +7,11 @@ const math = @import("./math.zig"); const std = @import("std"); /// -/// Addressable mapping of integer values of type described by `index_int` to values of type `Value`. +/// Addressable mapping of integers described by `index_int` to values of type `Value`. /// -/// Slab maps are similar to slot maps in that they have O(1) insertion and removal, use a fragmented flat table -/// structure instead. This reduces memory usage in some cases and can be useful for data that does not need to be -/// quickly iterated over, as values ordering is not guaranteed. +/// Slab maps are similar to slot maps in that they have O(1) insertion and removal, however, use a flat table layout +/// instead of parallel arrays. This reduces memory usage in some cases and can be useful for data that does not need to +/// be quickly iterated over, as values ordering is not guaranteed. /// /// *Note* `index_int` values may be as big or as small as desired per the use-case of the consumer, however, integers /// smaller than `usize` may result in the map reporting it is out of memory due to exhausting the addressable space @@ -37,7 +37,7 @@ pub fn Map(comptime index_int: std.builtin.Type.Int, comptime Value: type) type const Index = math.Int(index_int); /// - /// Slab type. + /// Slab map type. /// const Self = @This(); @@ -78,6 +78,7 @@ pub fn Map(comptime index_int: std.builtin.Type.Int, comptime Value: type) type self.table = &.{}; self.count = 0; + self.free_index = 0; } ///