Commit | Line | Data |
---|---|---|
7f918cf1 CE |
1 | #define MLton_Platform_Arch_host "arm" |
2 | ||
3 | /* Work around broken rounding mode control on ARM | |
4 | * | |
5 | * ARM CPUs can be running with either hardware or software. | |
6 | * Neither support rounding modes with fe{get,set}round. | |
7 | * Rounding direction is part of the instruction format. | |
8 | * | |
9 | * Unfortunately, due to vendor stupidity, every OS deals | |
10 | * with this differently: | |
11 | * Some pretend to support it and ignore calls. | |
12 | * Some throw an error even for the supported mode (TO_NEAREST). | |
13 | * All of them define all of the TO_* macros in defiance of the standard. | |
14 | * ... basically, the system libraries are useless. | |
15 | * | |
16 | * The solution for MLton: replace fe{get,set}round with our own honest | |
17 | * versions which accept TO_NEAREST and fail for other values. | |
18 | */ | |
19 | ||
20 | #undef fegetround | |
21 | #undef fesetround | |
22 | #define fegetround MLton_fegetround | |
23 | #define fesetround MLton_fesetround | |
24 | ||
25 | static inline int fegetround(void) { | |
26 | return FE_TONEAREST; | |
27 | } | |
28 | ||
29 | static inline int fesetround(int rounding_mode) { | |
30 | return (rounding_mode==FE_TONEAREST)?0:1; | |
31 | } |