Add add compiler_rt routines for float to signed integer conversion
And add std.math.f128_* constants.
The routines are:
__fixdfdi, __fixdfsi, __fixdfti,
__fixsfdi, __fixsfsi, __fixsfti,
__fixtfdi, __fixtfsi, __fixtfti.
These all call fixint which is a generic zig function that does the
conversion:
pub fn fixint(comptime fp_t: type, comptime fixint_t: type, a: fp_t) fixint_t
There are also a set tests:
__fixdfdi_test, __fixdfsi_test, __fixdfti_test,
__fixsfdi_test, __fixsfsi_test, __fixsfti_test,
__fixtfdi_test, __fixtfsi_test, __fixtfti_test.
2018-12-05 16:50:33 -08:00
|
|
|
const fixint = @import("fixint.zig").fixint;
|
|
|
|
const builtin = @import("builtin");
|
|
|
|
|
2020-01-06 12:34:50 -08:00
|
|
|
pub fn __fixsfsi(a: f32) callconv(.C) i32 {
|
Add add compiler_rt routines for float to signed integer conversion
And add std.math.f128_* constants.
The routines are:
__fixdfdi, __fixdfsi, __fixdfti,
__fixsfdi, __fixsfsi, __fixsfti,
__fixtfdi, __fixtfsi, __fixtfti.
These all call fixint which is a generic zig function that does the
conversion:
pub fn fixint(comptime fp_t: type, comptime fixint_t: type, a: fp_t) fixint_t
There are also a set tests:
__fixdfdi_test, __fixdfsi_test, __fixdfti_test,
__fixsfdi_test, __fixsfsi_test, __fixsfti_test,
__fixtfdi_test, __fixtfsi_test, __fixtfti_test.
2018-12-05 16:50:33 -08:00
|
|
|
@setRuntimeSafety(builtin.is_test);
|
|
|
|
return fixint(f32, i32, a);
|
|
|
|
}
|
|
|
|
|
2020-01-07 08:44:20 -08:00
|
|
|
pub fn __aeabi_f2iz(a: f32) callconv(.AAPCS) i32 {
|
|
|
|
@setRuntimeSafety(false);
|
|
|
|
return @call(.{ .modifier = .always_inline }, __fixsfsi, .{a});
|
|
|
|
}
|
|
|
|
|
Add add compiler_rt routines for float to signed integer conversion
And add std.math.f128_* constants.
The routines are:
__fixdfdi, __fixdfsi, __fixdfti,
__fixsfdi, __fixsfsi, __fixsfti,
__fixtfdi, __fixtfsi, __fixtfti.
These all call fixint which is a generic zig function that does the
conversion:
pub fn fixint(comptime fp_t: type, comptime fixint_t: type, a: fp_t) fixint_t
There are also a set tests:
__fixdfdi_test, __fixdfsi_test, __fixdfti_test,
__fixsfdi_test, __fixsfsi_test, __fixsfti_test,
__fixtfdi_test, __fixtfsi_test, __fixtfti_test.
2018-12-05 16:50:33 -08:00
|
|
|
test "import fixsfsi" {
|
|
|
|
_ = @import("fixsfsi_test.zig");
|
|
|
|
}
|