From 204fa8959a8f9d5457705f338eb0461e54155796 Mon Sep 17 00:00:00 2001 From: Krzysztof Wolicki Date: Tue, 27 Jan 2026 20:49:30 +0100 Subject: [PATCH] Make functions on EnumMap always take a pointer to avoid copies of big EnumMaps --- lib/std/enums.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/std/enums.zig b/lib/std/enums.zig index 76deff5421ad8272804a9fba751442c4a4bc83bc..6e21713e6d28c33e2088e88b3c98e5b75a2e5756 100644 --- a/lib/std/enums.zig +++ b/lib/std/enums.zig @@ -504,25 +504,25 @@ pub fn EnumMap(comptime E: type, comptime V: type) type { } /// The number of items in the map. - pub fn count(self: Self) usize { + pub fn count(self: *const Self) usize { return self.bits.count(); } /// Checks if the map contains an item. - pub fn contains(self: Self, key: Key) bool { + pub fn contains(self: *const Self, key: Key) bool { return self.bits.isSet(Indexer.indexOf(key)); } /// Gets the value associated with a key. /// If the key is not in the map, returns null. - pub fn get(self: Self, key: Key) ?Value { + pub fn get(self: *const Self, key: Key) ?Value { const index = Indexer.indexOf(key); return if (self.bits.isSet(index)) self.values[index] else null; } /// Gets the value associated with a key, which must /// exist in the map. - pub fn getAssertContains(self: Self, key: Key) Value { + pub fn getAssertContains(self: *const Self, key: Key) Value { const index = Indexer.indexOf(key); assert(self.bits.isSet(index)); return self.values[index]; -- 2.54.0