diff options
author | Baitinq <manuelpalenzuelamerino@gmail.com> | 2025-01-04 16:31:15 +0100 |
---|---|---|
committer | Baitinq <manuelpalenzuelamerino@gmail.com> | 2025-01-04 16:31:15 +0100 |
commit | 8cd2efc033820381ff86685999f14480252beec3 (patch) | |
tree | 041138ff952ebcc517a2a94b8b2b79f6aaca40c9 | |
parent | Copy memory in hashmap (diff) | |
download | c-hashtable-8cd2efc033820381ff86685999f14480252beec3.tar.gz c-hashtable-8cd2efc033820381ff86685999f14480252beec3.tar.bz2 c-hashtable-8cd2efc033820381ff86685999f14480252beec3.zip |
clean
-rw-r--r-- | src/main.zig | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/main.zig b/src/main.zig index a1a049f..bf600df 100644 --- a/src/main.zig +++ b/src/main.zig @@ -58,20 +58,14 @@ test "fuzzing" { var i: usize = 1; while (i + 2 < source.len) : (i += 2) { const operation: u8 = source[i]; - const rawkey = try allocator.alloc(u8, 2); //TODO: Do we actually need this? - rawkey[0] = source[i + 1]; - rawkey[1] = 0; // Null terminator + const key: [*c]u8 = @constCast(@as([2]u8, .{ source[i + 1], 0 })[0..]); const value: u8 = source[i + 2]; - std.debug.print("Rawkey: {any}\n", .{rawkey.ptr}); - - const key: [*c]u8 = @ptrCast(rawkey); - - std.debug.print("Key: ptr {any} - value {d}\n", .{ key, key.* }); + // std.debug.print("Key: ptr {any} - value {d}\n", .{ key, key.* }); switch (operation % 3) { 0 => { - // std.debug.print("Getting key {any}\n", .{key}); + std.debug.print("Getting key {any}\n", .{key}); const ret: ?*u8 = @ptrCast(hashtable.hashtable_get(ht, key)); const reference_ret: ?*u8 = reference_hashmap.get(key); // std.debug.print("Reference get value: {any}\n", .{reference_ret}); |