Skip to content

Commit ebdaeac

Browse files
committed
refactor: separate sign_bit from out_e
Signed-off-by: krishna2803 <[email protected]>
1 parent 08900aa commit ebdaeac

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

libc/src/math/generic/cbrtf16.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ LLVM_LIBC_FUNCTION(float16, cbrtf16, (float16 x)) {
9595
FloatBits xf_bits(xf);
9696

9797
unsigned x_e = static_cast<unsigned>(xf_bits.get_exponent());
98-
unsigned out_e = (x_e / 3 + 127) | sign_bit;
98+
unsigned out_e = x_e / 3 + 127;
9999

100100
unsigned shift_e = x_e % 3;
101101

@@ -155,8 +155,8 @@ LLVM_LIBC_FUNCTION(float16, cbrtf16, (float16 x)) {
155155
fputil::clear_except_if_required(FE_INEXACT);
156156
}
157157

158-
uint32_t r_bits =
159-
r_m | (static_cast<uint32_t>(out_e) << FloatBits::FRACTION_LEN);
158+
uint32_t r_bits = r_m | (static_cast<uint32_t>(out_e | sign_bit)
159+
<< FloatBits::FRACTION_LEN);
160160

161161
return static_cast<float16>(FloatBits(r_bits).get_val());
162162
}

0 commit comments

Comments
 (0)