Remove duplicated bit shift
parent
332ca4af10
commit
bb4d3e2b71
|
@ -10,7 +10,7 @@ def Float32.new(i : UInt16)
|
||||||
half_man = (i & 0x03FF).to_u32
|
half_man = (i & 0x03FF).to_u32
|
||||||
|
|
||||||
# Check for an infinity or NaN when all exponent bits set
|
# Check for an infinity or NaN when all exponent bits set
|
||||||
if (i & 0x7C00) == 0x7C00
|
if half_exp == 0x7C00
|
||||||
# Check for signed infinity if mantissa is zero
|
# Check for signed infinity if mantissa is zero
|
||||||
if half_man == 0
|
if half_man == 0
|
||||||
return ((half_sign << 16) | 0x7F80_0000).unsafe_as(Float32)
|
return ((half_sign << 16) | 0x7F80_0000).unsafe_as(Float32)
|
||||||
|
|
Loading…
Reference in New Issue