1 /* ===-- fixdfti.c - Implement __fixdfti -----------------------------------===
3 * The LLVM Compiler Infrastructure
5 * This file is dual licensed under the MIT and the University of Illinois Open
6 * Source Licenses. See LICENSE.TXT for details.
8 * ===----------------------------------------------------------------------===
10 * This file implements __fixdfti for the compiler_rt library.
12 * ===----------------------------------------------------------------------===
19 /* Returns: convert a to a signed long long, rounding toward zero. */
21 /* Assumption: double is a IEEE 64 bit floating point type
22 * su_int is a 32 bit integral type
23 * value in double is representable in ti_int (no range checking performed)
26 /* seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm */
28 COMPILER_RT_ABI ti_int
33 int e
= ((fb
.u
.s
.high
& 0x7FF00000) >> 20) - 1023;
36 ti_int s
= (si_int
)(fb
.u
.s
.high
& 0x80000000) >> 31;
37 ti_int r
= 0x0010000000000000uLL
| (0x000FFFFFFFFFFFFFuLL
& fb
.u
.all
);
45 #endif /* CRT_HAS_128BIT */