mirror of
https://github.com/ziglang/zig.git
synced 2025-12-08 23:33:07 +00:00
We already have a LICENSE file that covers the Zig Standard Library. We no longer need to remind everyone that the license is MIT in every single file. Previously this was introduced to clarify the situation for a fork of Zig that made Zig's LICENSE file harder to find, and replaced it with their own license that required annual payments to their company. However that fork now appears to be dead. So there is no need to reinforce the copyright notice in every single file.
31 lines
826 B
Zig
31 lines
826 B
Zig
const std = @import("std");
|
|
|
|
pub fn __negsf2(a: f32) callconv(.C) f32 {
|
|
return negXf2(f32, a);
|
|
}
|
|
|
|
pub fn __negdf2(a: f64) callconv(.C) f64 {
|
|
return negXf2(f64, a);
|
|
}
|
|
|
|
pub fn __aeabi_fneg(arg: f32) callconv(.AAPCS) f32 {
|
|
@setRuntimeSafety(false);
|
|
return @call(.{ .modifier = .always_inline }, __negsf2, .{arg});
|
|
}
|
|
|
|
pub fn __aeabi_dneg(arg: f64) callconv(.AAPCS) f64 {
|
|
@setRuntimeSafety(false);
|
|
return @call(.{ .modifier = .always_inline }, __negdf2, .{arg});
|
|
}
|
|
|
|
fn negXf2(comptime T: type, a: T) T {
|
|
const Z = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
|
|
|
|
const significandBits = std.math.floatMantissaBits(T);
|
|
const exponentBits = std.math.floatExponentBits(T);
|
|
|
|
const signBit = (@as(Z, 1) << (significandBits + exponentBits));
|
|
|
|
return @bitCast(T, @bitCast(Z, a) ^ signBit);
|
|
}
|