mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-07 22:34:28 +00:00
stage2: add log and logf to freestanding libc
This commit is contained in:
parent
f5471299d8
commit
f2f1c63daf
2 changed files with 15 additions and 11 deletions
|
|
@ -17,9 +17,13 @@ comptime {
|
||||||
if (builtin.zig_backend != .stage1) {
|
if (builtin.zig_backend != .stage1) {
|
||||||
@export(memset, .{ .name = "memset", .linkage = .Strong });
|
@export(memset, .{ .name = "memset", .linkage = .Strong });
|
||||||
@export(memcpy, .{ .name = "memcpy", .linkage = .Strong });
|
@export(memcpy, .{ .name = "memcpy", .linkage = .Strong });
|
||||||
|
|
||||||
@export(trunc, .{ .name = "trunc", .linkage = .Strong });
|
@export(trunc, .{ .name = "trunc", .linkage = .Strong });
|
||||||
@export(truncf, .{ .name = "truncf", .linkage = .Strong });
|
@export(truncf, .{ .name = "truncf", .linkage = .Strong });
|
||||||
@export(truncl, .{ .name = "truncl", .linkage = .Strong });
|
@export(truncl, .{ .name = "truncl", .linkage = .Strong });
|
||||||
|
|
||||||
|
@export(log, .{ .name = "log", .linkage = .Strong });
|
||||||
|
@export(logf, .{ .name = "logf", .linkage = .Strong });
|
||||||
} else {
|
} else {
|
||||||
_ = @import("c_stage1.zig");
|
_ = @import("c_stage1.zig");
|
||||||
}
|
}
|
||||||
|
|
@ -80,17 +84,25 @@ fn memcpy(noalias dest: ?[*]u8, noalias src: ?[*]const u8, len: usize) callconv(
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn trunc(a: f64) f64 {
|
fn trunc(a: f64) callconv(.C) f64 {
|
||||||
return math.trunc(a);
|
return math.trunc(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn truncf(a: f32) f32 {
|
fn truncf(a: f32) callconv(.C) f32 {
|
||||||
return math.trunc(a);
|
return math.trunc(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn truncl(a: c_longdouble) c_longdouble {
|
fn truncl(a: c_longdouble) callconv(.C) c_longdouble {
|
||||||
if (!long_double_is_f128) {
|
if (!long_double_is_f128) {
|
||||||
@panic("TODO implement this");
|
@panic("TODO implement this");
|
||||||
}
|
}
|
||||||
return math.trunc(a);
|
return math.trunc(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn log(a: f64) callconv(.C) f64 {
|
||||||
|
return math.ln(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn logf(a: f32) callconv(.C) f32 {
|
||||||
|
return math.ln(a);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -708,14 +708,6 @@ export fn exp2f(a: f32) f32 {
|
||||||
return math.exp2(a);
|
return math.exp2(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
export fn log(a: f64) f64 {
|
|
||||||
return math.ln(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
export fn logf(a: f32) f32 {
|
|
||||||
return math.ln(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
export fn log2(a: f64) f64 {
|
export fn log2(a: f64) f64 {
|
||||||
return math.log2(a);
|
return math.log2(a);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue