xref: /reactos/sdk/lib/crt/float/arm/_statusfp.c (revision 3e1f4074)
1 /*
2  * PROJECT:     ReactOS CRT library
3  * LICENSE:     MIT (https://spdx.org/licenses/MIT)
4  * PURPOSE:     Implementation of _statusfp
5  * COPYRIGHT:   Copyright 2021 Roman Masanin <36927roma@gmail.com>
6  */
7 
8 #include "fpscr.h"
9 
10 unsigned int _statusfp(void)
11 {
12     unsigned int flags = 0;
13     ARM_FPSCR fpscr;
14 
15     fpscr.raw = __getfp();
16 
17     if (fpscr.data.exception & ARM_CW_IM) flags |= _SW_INVALID;
18     if (fpscr.data.exception & ARM_CW_ZM) flags |= _SW_ZERODIVIDE;
19     if (fpscr.data.exception & ARM_CW_OM) flags |= _SW_OVERFLOW;
20     if (fpscr.data.exception & ARM_CW_UM) flags |= _SW_UNDERFLOW;
21     if (fpscr.data.exception & ARM_CW_PM) flags |= _SW_INEXACT;
22     if (fpscr.data.exception & ARM_CW_DM) flags |= _SW_DENORMAL;
23     return flags;
24 }
25