Skip to content

Commit a6f6263

Browse files
committed
Changes to fnan2 to be consistent wih llvm#161546
1 parent 73e7571 commit a6f6263

File tree

1 file changed

+6
-5
lines changed
  • compiler-rt/lib/builtins/arm

1 file changed

+6
-5
lines changed

compiler-rt/lib/builtins/arm/fnan2.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,23 @@
1515
//
1616
//===----------------------------------------------------------------------===//
1717

18-
unsigned __compiler_rt_fnan2(unsigned a, unsigned b) {
18+
#include <stdint.h>
19+
20+
uint32_t __compiler_rt_fnan2(uint32_t a, uint32_t b) {
1921
// Make shifted-left copies of a and b to discard the sign bit. Then add 1 at
2022
// the bit position where the quiet vs signalling bit ended up. This squashes
2123
// all the signalling NaNs to the top of the range of 32-bit values, from
2224
// 0xff800001 to 0xffffffff inclusive; meanwhile, all the quiet NaN values
2325
// wrap round to the bottom, from 0 to 0x007fffff inclusive. So we can detect
2426
// a signalling NaN by asking if it's greater than 0xff800000, and a quiet
2527
// one by asking if it's less than 0x00800000.
26-
unsigned aadj = (a << 1) + 0x00800000;
27-
unsigned badj = (b << 1) + 0x00800000;
28+
uint32_t aadj = (a << 1) + 0x00800000;
29+
uint32_t badj = (b << 1) + 0x00800000;
2830
if (aadj > 0xff800000) // a is a signalling NaN?
2931
return a | 0x00400000; // if so, return it with the quiet bit set
3032
if (badj > 0xff800000) // b is a signalling NaN?
3133
return b | 0x00400000; // if so, return it with the quiet bit set
3234
if (aadj < 0x00800000) // a is a quiet NaN?
3335
return a; // if so, return it
34-
else /* expect (badj < 0x00800000) */
35-
return b; // in that case b must be a quiet NaN
36+
return b; // otherwise we expect b must be a quiet NaN
3637
}

0 commit comments

Comments
 (0)