Skip to content

Commit 5e65f49

Browse files
Omar Almatovrbuchner-aril
authored andcommitted
(2/4) Add macros to support new OCP f8 modes
1 parent 993fc48 commit 5e65f49

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

softfloat/internals.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ int_fast64_t softfloat_roundMToI64( bool, uint32_t *, uint_fast8_t, bool );
8686
/*----------------------------------------------------------------------------
8787
*---------------------------------------------------------------------------*/
8888
#define f8ExpWidth softfloat_fp8ExpWidths[softfloat_fp8Mode]
89+
#define isE4M3NaNF8UI( a ) ((bool) ((((uint8_t) a) & 0x7F) == 0x7F))
90+
#define isE5M2NaNF8UI( a ) ((bool) ((((uint8_t) a) & 0x7C) > 0x7C))
91+
#define isE5M2InfF8UI( a ) ((bool) ((((uint8_t) a) & 0x7C) == 0x7C))
92+
#define signInfE5M2F8UI( sign ) (((uint8_t) (sign)<<7) | 0x7C)
8993

9094
/*----------------------------------------------------------------------------
9195
*----------------------------------------------------------------------------*/

softfloat/specialize.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ struct commonNaN { char _unused; };
113113
| NaN, and returns the bit pattern of this value as an unsigned integer.
114114
*----------------------------------------------------------------------------*/
115115
#define softfloat_commonNaNToF8UI( aPtr ) ((uint_fast8_t) defaultNaNF8UI)
116+
#define softfloat_commonNaNToE4M3F8UI( aPtr ) ((uint_fast8_t) 0xFF)
117+
#define softfloat_commonNaNToE5M2F8UI( aPtr ) ((uint_fast8_t) 0XFF)
116118

117119
/*----------------------------------------------------------------------------
118120
| Returns true when 16-bit unsigned integer `uiA' has the bit pattern of a

0 commit comments

Comments
 (0)