| 262 | } |
| 263 | |
| 264 | static inline uint32_t get_cop1_cs() { |
| 265 | uint32_t rounding_mode = 0; |
| 266 | switch (fegetround()) { |
| 267 | // round to nearest value |
| 268 | case FE_TONEAREST: |
| 269 | default: |
| 270 | rounding_mode = 0; |
| 271 | break; |
| 272 | // round to zero (truncate) |
| 273 | case FE_TOWARDZERO: |
| 274 | rounding_mode = 1; |
| 275 | break; |
| 276 | // round to positive infinity (ceil) |
| 277 | case FE_UPWARD: |
| 278 | rounding_mode = 2; |
| 279 | break; |
| 280 | // round to negative infinity (floor) |
| 281 | case FE_DOWNWARD: |
| 282 | rounding_mode = 3; |
| 283 | break; |
| 284 | } |
| 285 | return rounding_mode; |
| 286 | } |
| 287 | |
| 288 | static inline void set_cop1_cs(uint32_t val) { |
| 289 | uint32_t rounding_mode = val & 0x3; |
nothing calls this directly
no outgoing calls
no test coverage detected