0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #include "ieee754sp.h"
0013
0014 int ieee754sp_2008class(union ieee754sp x)
0015 {
0016 COMPXSP;
0017
0018 EXPLODEXSP;
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 switch(xc) {
0036 case IEEE754_CLASS_SNAN:
0037 return 0x01;
0038 case IEEE754_CLASS_QNAN:
0039 return 0x02;
0040 case IEEE754_CLASS_INF:
0041 return 0x04 << (xs ? 0 : 4);
0042 case IEEE754_CLASS_NORM:
0043 return 0x08 << (xs ? 0 : 4);
0044 case IEEE754_CLASS_DNORM:
0045 return 0x10 << (xs ? 0 : 4);
0046 case IEEE754_CLASS_ZERO:
0047 return 0x20 << (xs ? 0 : 4);
0048 default:
0049 pr_err("Unknown class: %d\n", xc);
0050 return 0;
0051 }
0052 }