On 01/18/2018 08:43 AM, Alex Bennée wrote: > /* Expand fields based on the size of exponent and fraction */ > #define FRAC_PARAMS(E, F) \ > .exp_size = E, \ > .frac_size = F, \ > .frac_shift = DECOMPOSED_BINARY_POINT - F, \ > .frac_lsb = 1ull << (DECOMPOSED_BINARY_POINT - F), \ > .frac_lsbm1 = 1ull << ((DECOMPOSED_BINARY_POINT - F) - 1), \ > .round_mask = (1ull << (DECOMPOSED_BINARY_POINT - F)) - 1, \ > .roundeven_mask = (2ull << (DECOMPOSED_BINARY_POINT - F)) - 1 > > static const FloatFmt float16_params = { > .exp_bias = 0x0f, > .exp_max = 0x1f, > FRAC_PARAMS(5, 10) > };
You can compute exp_bias and exp_max from E as well. r~