Changeset 463cb33 for src/Parser
- Timestamp:
- Jul 16, 2020, 2:59:56 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- c82af9f
- Parents:
- 519f11c (diff), 3f06c05 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 edited
-
src/Parser/ExpressionNode.cc (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/ExpressionNode.cc
r519f11c r463cb33 10 10 // Created On : Sat May 16 13:17:07 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jul 13 21:12:02202013 // Update Count : 104 312 // Last Modified On : Wed Jul 15 08:24:08 2020 13 // Update Count : 1046 14 14 // 15 15 … … 222 222 } else { // octal int128 constant 223 223 unsigned int len = str.length(); 224 char buf[32];225 __int128 val = v;226 227 224 if ( len > 1 + 43 || (len == 1 + 43 && str[0] > '3') ) SemanticError( yylloc, "128-bit octal constant to large " + str ); 228 225 if ( len <= 1 + 21 ) { // value < 21 octal digitis … … 230 227 } else { 231 228 sscanf( &str[len - 21], "%llo", &v ); 232 val = v; // store bits229 __int128 val = v; // accumulate bits 233 230 str[len - 21] ='\0'; // shorten string 234 231 sscanf( &str[len == 43 ? 1 : 0], "%llo", &v ); … … 240 237 } // if 241 238 v = val >> 64; v2 = (uint64_t)val; // replace octal constant with 2 hex constants 239 char buf[32]; 242 240 sprintf( buf, "%#llx", v2 ); 243 241 str2 = buf; … … 256 254 #define P10_UINT64 10'000'000'000'000'000'000ULL // 19 zeroes 257 255 unsigned int len = str.length(); 258 char buf[32];259 __int128 val = v;260 261 256 if ( str.length() == 39 && str > (Unsigned ? "340282366920938463463374607431768211455" : "170141183460469231731687303715884105727") ) 262 257 SemanticError( yylloc, "128-bit decimal constant to large " + str ); … … 265 260 } else { 266 261 sscanf( &str[len - 19], "%llu", &v ); 267 val = v; // store bits262 __int128 val = v; // accumulate bits 268 263 str[len - 19] ='\0'; // shorten string 269 264 sscanf( &str[len == 39 ? 1 : 0], "%llu", &v ); … … 275 270 } // if 276 271 v = val >> 64; v2 = (uint64_t)val; // replace decimal constant with 2 hex constants 272 char buf[32]; 277 273 sprintf( buf, "%#llx", v2 ); 278 274 str2 = buf;
Note:
See TracChangeset
for help on using the changeset viewer.