[go: nahoru, domu]

Skip to content

Commit

Permalink
Fix compiler warnings (unused variable and signed/unsigned comparison)
Browse files Browse the repository at this point in the history
  • Loading branch information
Marat Dukhan committed Jul 8, 2017
1 parent 0ea6095 commit 2bd1470
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion include/fp16/fp16.h
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,6 @@ static inline uint16_t fp16_alt_from_fp32_value(float f) {
const float bias = fp32_from_bits((shl1_bias >> 1) + ((exp_difference + 2) << 23));
const float base = fp32_from_bits((shl1_base >> 1) + (2 << 23)) + bias;

const uint32_t bias_difference = 0x7F - 0xF;
const uint32_t exp_f = fp32_to_bits(base) >> 13;
return (sign >> 16) | ((exp_f & UINT32_C(0x00007C00)) + (fp32_to_bits(base) & UINT32_C(0x00000FFF)));
}
Expand Down
6 changes: 3 additions & 3 deletions test/ieee-to-fp32-bits.cc
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ TEST(FP16_IEEE_TO_FP32_BITS, positive_nan) {
"F32(F16) = 0x" << std::setw(8) << nan_f32;

/* Check mantissa */
EXPECT_NE(nan_f32 & UINT32_C(0x007FFFFF), 0) <<
EXPECT_NE(nan_f32 & UINT32_C(0x007FFFFF), UINT32_C(0)) <<
std::hex << std::uppercase << std::setfill('0') <<
"F16 = 0x" << std::setw(4) << nan_f16 << ", " <<
"F32(F16) = 0x" << std::setw(8) << nan_f32;
Expand All @@ -261,7 +261,7 @@ TEST(FP16_IEEE_TO_FP32_BITS, negative_nan) {
const uint32_t nan_f32 = fp16_ieee_to_fp32_bits(nan_f16);

/* Check sign */
EXPECT_NE(nan_f32 & UINT32_C(0x80000000), 0) <<
EXPECT_NE(nan_f32 & UINT32_C(0x80000000), UINT32_C(0)) <<
std::hex << std::uppercase << std::setfill('0') <<
"F16 = 0x" << std::setw(4) << nan_f16 << ", " <<
"F32(F16) = 0x" << std::setw(8) << nan_f32;
Expand All @@ -273,7 +273,7 @@ TEST(FP16_IEEE_TO_FP32_BITS, negative_nan) {
"F32(F16) = 0x" << std::setw(8) << nan_f32;

/* Check mantissa */
EXPECT_NE(nan_f32 & UINT32_C(0x007FFFFF), 0) <<
EXPECT_NE(nan_f32 & UINT32_C(0x007FFFFF), UINT32_C(0)) <<
std::hex << std::uppercase << std::setfill('0') <<
"F16 = 0x" << std::setw(4) << nan_f16 << ", " <<
"F32(F16) = 0x" << std::setw(8) << nan_f32;
Expand Down

0 comments on commit 2bd1470

Please sign in to comment.