Skip to content

Commit 059ecbd

Browse files
authored
style: add punctuation and remove empty lines
Signed-off-by: Athan <[email protected]>
1 parent fa95f32 commit 059ecbd

File tree

1 file changed

+6
-10
lines changed
  • lib/node_modules/@stdlib/number/float16/base/to-float32/src

1 file changed

+6
-10
lines changed

lib/node_modules/@stdlib/number/float16/base/to-float32/src/main.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,44 +51,40 @@ float stdlib_base_float16_to_float32( const stdlib_float16_t x ) {
5151

5252
f16 = stdlib_float16_to_bits( x );
5353

54-
// Extract sign bit and shift left 16 bits
54+
// Extract sign bit and shift left 16 bits:
5555
sign = ((uint32_t)(f16 & STDLIB_CONSTANT_FLOAT16_SIGN_MASK)) << 16;
5656

57-
// Extract exponent bits
57+
// Extract exponent bits:
5858
f16Exponent = (f16 & STDLIB_CONSTANT_FLOAT16_EXPONENT_MASK) >> STDLIB_CONSTANT_FLOAT16_NUM_SIGNIFICAND_BITS;
5959

60-
// Extract mantissa bits
60+
// Extract mantissa bits:
6161
f16Mantissa = f16 & STDLIB_CONSTANT_FLOAT16_SIGNIFICAND_MASK;
6262

63-
// Handle special cases
63+
// Handle special cases...
6464
if ( f16Exponent == 0 ) {
6565
if ( f16Mantissa == 0 ) {
6666
f32 = sign;
6767
memcpy( &result, &f32, sizeof(float) );
6868
return result;
6969
}
70-
71-
// Denormalized number - convert to normalized float32
70+
// Denormalized number which should be converted to normalized a float32...
7271
f32Exponent = 1;
7372
while ( ( f16Mantissa & 0x0400 ) == 0 ) {
7473
f16Mantissa <<= 1;
7574
f32Exponent -= 1;
7675
}
77-
7876
f16Mantissa &= STDLIB_CONSTANT_FLOAT16_SIGNIFICAND_MASK;
7977
f32Exponent = 127 - 15 + f32Exponent;
8078
f32 = sign | (f32Exponent << 23) | (f16Mantissa << 13);
8179
memcpy( &result, &f32, sizeof(float) );
8280
return result;
8381
}
84-
82+
// Check for Infinity or NaN:
8583
if (f16Exponent == FLOAT16_MAX_EXPONENT) {
86-
// Infinity or NaN
8784
f32 = sign | STDLIB_CONSTANT_FLOAT32_EXPONENT_MASK | (f16Mantissa << 13);
8885
memcpy( &result, &f32, sizeof(float) );
8986
return result;
9087
}
91-
9288
// Normal case: convert exponent from float16 bias (15) to float32 bias (127)
9389
f32Exponent = f16Exponent - 15 + 127;
9490
f32 = sign | (f32Exponent << 23) | (f16Mantissa << 13);

0 commit comments

Comments
 (0)