Changes in src/Parser/ExpressionNode.cc [0a2168f:a16764a6]
- File:
-
- 1 edited
-
src/Parser/ExpressionNode.cc (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/ExpressionNode.cc
r0a2168f ra16764a6 10 10 // Created On : Sat May 16 13:17:07 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Mar 3 18:22:33 201813 // Update Count : 7 9612 // Last Modified On : Wed Sep 27 22:51:55 2017 13 // Update Count : 781 14 14 // 15 15 … … 58 58 static inline bool checkD( char c ) { return c == 'd' || c == 'D'; } 59 59 static inline bool checkI( char c ) { return c == 'i' || c == 'I'; } 60 static inline bool checkB( char c ) { return c == 'b' || c == 'B'; }61 60 static inline bool checkX( char c ) { return c == 'x' || c == 'X'; } 62 61 … … 117 116 118 117 unsigned long long int v; // converted integral value 119 size_t last = str.length() - 1; // last subscriptof constant118 size_t last = str.length() - 1; // last character of constant 120 119 Expression * ret; 121 120 … … 130 129 } // if 131 130 132 // Cannot be "0" 133 134 if ( str[0] == '0' ) { // radix character ? 131 if ( str[0] == '0' ) { // octal/hex constant ? 135 132 dec = false; 136 if ( checkX( str[1] ) ) {// hex constant ?133 if ( last != 0 && checkX( str[1] ) ) { // hex constant ? 137 134 sscanf( (char *)str.c_str(), "%llx", &v ); 138 //printf( "%llx %llu\n", v, v );139 } else if ( checkB( str[1] ) ) { // binary constant ?140 v = 0;141 for ( unsigned int i = 2;; i += 1 ) { // compute value142 if ( str[i] == '1' ) v |= 1;143 if ( i == last ) break;144 v <<= 1;145 } // for146 135 //printf( "%llx %llu\n", v, v ); 147 136 } else { // octal constant
Note:
See TracChangeset
for help on using the changeset viewer.