Changeset 0a2168f for src/Parser/ExpressionNode.cc
- Timestamp:
- Mar 4, 2018, 10:32:08 AM (5 years ago)
- Branches:
- aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- ea46db7
- Parents:
- 82c367d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/ExpressionNode.cc
r82c367d r0a2168f 10 10 // Created On : Sat May 16 13:17:07 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Sep 27 22:51:55 201713 // Update Count : 7 8112 // Last Modified On : Sat Mar 3 18:22:33 2018 13 // Update Count : 796 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'; } 60 61 static inline bool checkX( char c ) { return c == 'x' || c == 'X'; } 61 62 … … 116 117 117 118 unsigned long long int v; // converted integral value 118 size_t last = str.length() - 1; // last characterof constant119 size_t last = str.length() - 1; // last subscript of constant 119 120 Expression * ret; 120 121 … … 129 130 } // if 130 131 131 if ( str[0] == '0' ) { // octal/hex constant ? 132 // Cannot be "0" 133 134 if ( str[0] == '0' ) { // radix character ? 132 135 dec = false; 133 if ( last != 0 && checkX( str[1] ) ) {// hex constant ?136 if ( checkX( str[1] ) ) { // hex constant ? 134 137 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 value 142 if ( str[i] == '1' ) v |= 1; 143 if ( i == last ) break; 144 v <<= 1; 145 } // for 135 146 //printf( "%llx %llu\n", v, v ); 136 147 } else { // octal constant
Note: See TracChangeset
for help on using the changeset viewer.