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 __fixtfti(a: f128) callconv(.C) i128 {
|
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(f128, i128, a);
|
|
|
|
}
|
|
|
|
|
|
|
|
test "import fixtfti" {
|
|
|
|
_ = @import("fixtfti_test.zig");
|
|
|
|
}
|