fn hashMaybeSeed(comptime hash_fn: anytype, seed: anytype, buf: []const u8) @typeInfo(@TypeOf(hash_fn)).@"fn".return_type.? hash_fnseedbuf: []const u83
4
5
6
7
8
9
10
11
12
13
14fn hashMaybeSeed(comptime hash_fn: anytype, seed: anytype, buf: []const u8) @typeInfo(@TypeOf(hash_fn)).@"fn".return_type.? {
const HashFn = @typeInfo(@TypeOf(hash_fn)).@"fn";
if (HashFn.param_types.len > 1) {
if (@typeInfo(HashFn.param_types[0].?) == .int) {
return hash_fn(@intCast(seed), buf);
} else {
return hash_fn(buf, @intCast(seed));
}
} else {
return hash_fn(buf);
}
}