13 lines
396 B
Zig
13 lines
396 B
Zig
|
const std = @import("std");
|
||
|
const Allocator = std.mem.Allocator;
|
||
|
|
||
|
const c = @cImport({
|
||
|
@cInclude("bdz.h");
|
||
|
});
|
||
|
|
||
|
pub fn search_packed(packed_mphf: []const u8, key: []const u8) error{Overflow}!u32 {
|
||
|
const bdz_start = @intToPtr(?*anyopaque, @ptrToInt(&packed_mphf[4]));
|
||
|
const len = try std.math.cast(c_uint, key.len);
|
||
|
return @as(u32, c.bdz_search_packed(bdz_start, key.ptr, len));
|
||
|
}
|