zig/lib/compiler_rt/strlen.zig
Alex Rønne Petersen e9ac2ce116
compiler-rt: move strlen from libzigc to here
LLVM 21 has started recognizing strlen-like idioms and optimizing them to strlen
calls, so we need this function provided in compiler-rt for libc-less
compilations.
2025-08-30 06:36:41 +02:00

10 lines
268 B
Zig

const std = @import("std");
const common = @import("common.zig");
comptime {
@export(&strlen, .{ .name = "strlen", .linkage = common.linkage, .visibility = common.visibility });
}
fn strlen(s: [*:0]const c_char) callconv(.c) usize {
return std.mem.len(s);
}