MCPcopy Create free account
hub / github.com/creatale/node-dv / icvProcessSpecialDouble

Function icvProcessSpecialDouble

deps/opencv/modules/core/src/persistence.cpp:925–951  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

923
924
925static void
926icvProcessSpecialDouble( 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
954static double icv_strtod( CvFileStorage* fs, char* ptr, char** endptr )

Callers 1

icv_strtodFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected