mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-13 23:18:58 +00:00
2cb3a7bf2d
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6729 91177308-0d34-0410-b5e6-96231b3b80d8
23 lines
467 B
C
23 lines
467 B
C
#include <stdio.h>
|
|
#include <math.h>
|
|
|
|
int target_isinf(double x) {
|
|
union {
|
|
double d;
|
|
struct {
|
|
unsigned mantissa2;
|
|
unsigned mantissa1 : 20;
|
|
unsigned exponent : 11;
|
|
unsigned sign : 1;
|
|
} big_endian;
|
|
} u;
|
|
|
|
u.d = x;
|
|
return (u.big_endian.exponent == 2047 && u.big_endian.mantissa1 == 0 && u.big_endian.mantissa2 == 0);
|
|
}
|
|
|
|
int main() {
|
|
printf("%d %d\n", target_isinf(1234.42), target_isinf(1.0/1.0e-1000));
|
|
return 0;
|
|
}
|