DoxigAlpha

hash

Function parameters

Parameters

#
a:Cache.Path

Useful to make `Path` a key in `std.ArrayHashMap`.

Types

#
TableAdapter
Useful to make `Path` a key in `std.ArrayHashMap`.

Functions in this namespace

Functions

#
fmtEscapeChar
Deprecated, use double quoted escape to print paths.
formatEscapeChar
Deprecated, use double quoted escape to print paths.

Source

Implementation

#
pub fn hash(self: TableAdapter, a: Cache.Path) u32 {
    _ = self;
    const seed = switch (@typeInfo(@TypeOf(a.root_dir.handle.fd))) {
        .pointer => @intFromPtr(a.root_dir.handle.fd),
        .int => @as(u32, @bitCast(a.root_dir.handle.fd)),
        else => @compileError("unimplemented hash function"),
    };
    return @truncate(Hash.hash(seed, a.sub_path));
}