prefixMatch
Function parameters
Parameters
- s:[16]u8
- d:[16]u8
Type definitions in this namespace
Types
Functions in this namespace
Functions
- tcpConnectToHost
- All memory allocated with `allocator` will be freed before this function returns.
- getAddressList
- Call `AddressList.deinit` on the result.
Error sets in this namespace
Error Sets
= switch (native_os) { .windows => builtin.os.version_range.windows.isAtLeast(.win10_rs4) orelse false, .wasi => false, else => true, }
Values
- has_unix_sockets
- = switch (native_os) { .windows => builtin.os.version_range.windows.isAtLeast(.win10_rs4) orelse false, .wasi => false, else => true, }
Source
Implementation
fn prefixMatch(s: [16]u8, d: [16]u8) u8 {
// TODO: This FIXME inherited from porting from musl libc.
// I don't want this to go into zig std lib 1.0.0.
// FIXME: The common prefix length should be limited to no greater
// than the nominal length of the prefix portion of the source
// address. However the definition of the source prefix length is
// not clear and thus this limiting is not yet implemented.
var i: u8 = 0;
while (i < 128 and ((s[i / 8] ^ d[i / 8]) & (@as(u8, 128) >> @as(u3, @intCast(i % 8)))) == 0) : (i += 1) {}
return i;
}