Hi, Max:
On 1/8/2026 11:16 PM, Max Chou wrote: > This commit provides the basic operation support for the OCP float4 data > type(e2m1). > > Signed-off-by: Max Chou <[email protected]> > --- > include/fpu/softfloat-types.h | 7 +++++- > include/fpu/softfloat.h | 45 +++++++++++++++++++++++++++++++++-- > 2 files changed, 49 insertions(+), 3 deletions(-) > > diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h > index 835dd33bf1..82a54e9e6d 100644 > --- a/include/fpu/softfloat-types.h > +++ b/include/fpu/softfloat-types.h > @@ -120,7 +120,7 @@ typedef struct { > typedef uint16_t bfloat16; > > /* > - * Software OCP(Open Compute Project) 8-bit floating point types > + * Software OCP(Open Compute Project) floating point types > */ > typedef uint8_t float8_e4m3; > typedef uint8_t float8_e5m2; > @@ -131,6 +131,11 @@ typedef uint8_t float8_e5m2; > #define const_float8_e4m3(x) (x) > #define const_float8_e5m2(x) (x) > > +typedef uint8_t float4_e2m1; > +#define float4_e2m1_val(x) (x & 0xf) > +#define make_float4_e2m1(x) (x & 0xf) > +#define const_float4_e2m1(x) (x & 0xf) > + I recommend adding parentheses around the parameter `x`: #define float4_e2m1_val(x) ((x) & 0xf) #define make_float4_e2m1(x) ((x) & 0xf) #define const_float4_e2m1(x) ((x) & 0xf) Thanks, Chao
