RISC-V: Add support for riscv-*-*.
[official-gcc.git] / gcc / testsuite / gcc.c-torture / compile / udconvert.c
blob31b494fe08a126047bb0b9c748a07be60e13318d
1 double
2 unsigned_to_double1 (u)
3 unsigned u;
5 double d;
6 d = (int) u; /* convert as from a *signed* integer */
7 return ((int) u < 0)
8 ? d + 4294967296.0
9 : d;
12 /* Alternatively */
14 double
15 unsigned_to_double2 (u)
16 unsigned u;
18 double d;
19 u -= 2147483648; /* complement sign bit */
20 d = (int) u; /* convert as from a *signed* integer */
21 return d + 2147483648.0;
24 unsigned
25 double_to_unsigned (d)
26 double d;
28 d += 2147483648.0;
29 return ((int) d) - 2147483648;