mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
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.
11 lines
268 B
Zig
11 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);
|
|
}
|