revert between 56095 -> 55830 in arch
[AROS.git] / arch / arm-all / arm-aeabi / i2d.c
blob79398e3f49711febc80d36b340d516007dcd4732
1 /*
2 Copyright (C) 2009-2015, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <inttypes.h>
8 uint64_t __aeabi_ui2d(uint32_t val)
10 int exp = 0;
11 uint64_t result = 0;
13 if (val == 0)
14 return 0;
16 exp = 32 - __builtin_clz(val);
18 result = ((uint64_t)val) << (53 - exp);
19 result &= (uint64_t)0x000fffffffffffff;
21 exp += 0x3fe;
23 result |= (uint64_t)exp << 52;
25 return result;
28 uint64_t __aeabi_i2d(int32_t val)
30 if (val == 0)
31 return 0;
33 if (val < 0)
34 return (uint64_t)0x8000000000000000 | __aeabi_ui2d((uint32_t)-val);
35 else
36 return __aeabi_ui2d((uint32_t)val);