Skip to content

Commit

Permalink
Fix bug in fp16_alt_to_fp32_value
Browse files Browse the repository at this point in the history
Wrong type for exp_offset constant didn't cause correctness issues as
the constant fit into the wrong type, but potentially caused poor
code-generation
  • Loading branch information
Maratyszcza committed Apr 12, 2020
1 parent ba1d31f commit 3c54eac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/fp16/fp16.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ static inline float fp16_alt_to_fp32_value(uint16_t h) {
* Note that this operation does not handle denormal inputs (where biased exponent == 0). However, they also do not
* operate on denormal inputs, and do not produce denormal results.
*/
const float exp_offset = UINT32_C(0x70) << 23;
const uint32_t exp_offset = UINT32_C(0x70) << 23;
const float normalized_value = fp32_from_bits((two_w >> 4) + exp_offset);

/*
Expand Down

0 comments on commit 3c54eac

Please sign in to comment.