| 923 | |
| 924 | |
| 925 | static void |
| 926 | icvProcessSpecialDouble( CvFileStorage* fs, char* buf, double* value, char** endptr ) |
| 927 | { |
| 928 | char c = buf[0]; |
| 929 | int inf_hi = 0x7ff00000; |
| 930 | |
| 931 | if( c == '-' || c == '+' ) |
| 932 | { |
| 933 | inf_hi = c == '-' ? 0xfff00000 : 0x7ff00000; |
| 934 | c = *++buf; |
| 935 | } |
| 936 | |
| 937 | if( c != '.' ) |
| 938 | CV_PARSE_ERROR( "Bad format of floating-point constant" ); |
| 939 | |
| 940 | union{double d; uint64 i;} v; |
| 941 | v.d = 0.; |
| 942 | if( toupper(buf[1]) == 'I' && toupper(buf[2]) == 'N' && toupper(buf[3]) == 'F' ) |
| 943 | v.i = (uint64)inf_hi << 32; |
| 944 | else if( toupper(buf[1]) == 'N' && toupper(buf[2]) == 'A' && toupper(buf[3]) == 'N' ) |
| 945 | v.i = (uint64)-1; |
| 946 | else |
| 947 | CV_PARSE_ERROR( "Bad format of floating-point constant" ); |
| 948 | *value = v.d; |
| 949 | |
| 950 | *endptr = buf + 4; |
| 951 | } |
| 952 | |
| 953 | |
| 954 | static double icv_strtod( CvFileStorage* fs, char* ptr, char** endptr ) |