int main(int argc, char **argv) { int hex, w; uint32_t a, b, c, top; uint64_t a64, b64, c64; uint64_t a128[2], b128[2], c128[2]; char *format; if (argc != 4) usage(NULL); if (sscanf(argv[3], "%d", &w) == 0) usage("Bad w\n"); if (w <= 0 || (w > 32 && w != 64 && w != 128)) usage("Bad w"); hex = (strchr(argv[3], 'h') != NULL); if (!hex && w == 128) usage(NULL); if (w <= 32) { format = (hex) ? "%x" : "%u"; if (sscanf(argv[1], format, &a) == 0) usage("Bad a\n"); if (sscanf(argv[2], format, &b) == 0) usage("Bad b\n"); if (w < 32) { top = (w == 31) ? 0x80000000 : (1 << w); if (w != 32 && a >= top) usage("a is too large\n"); if (w != 32 && b >= top) usage("b is too large\n"); } c = a ^ b; printf(format, c); printf("\n"); } else if (w == 64) { format = (hex) ? "%llx" : "%llu"; if (sscanf(argv[1], format, &a64) == 0) usage("Bad a\n"); if (sscanf(argv[2], format, &b64) == 0) usage("Bad b\n"); c64 = a64 ^ b64; printf(format, c64); printf("\n"); } else if (w == 128) { if (read_128(argv[1], a128) == 0) usage("Bad a\n"); if (read_128(argv[2], b128) == 0) usage("Bad b\n"); c128[0] = a128[0] ^ b128[0]; c128[1] = a128[1] ^ b128[1]; print_128(c128); } exit(0); }
// Read those entries which define body elements bool InputIges::readBodyElements() { //-Go to the start position of the parameter (= data) section. infile.seekg(paramSecStart - infile.tellg(), ios::cur); paramSecLine = 1; // Loop through directory entries IgesDirectory::iterator pos = directory->begin(); while (pos != directory->end()) { IgesDirectoryEntry* de = (*pos++).second; // If this entry is not in the model at all! if ( de->body == NULL ) { continue; } bool ok; switch(de->entNbr) { case 100: ok = read_100(de); break; case 106: ok = read_106(de); break; case 110: ok = read_110(de); break; case 126: ok = read_126(de); break; case 128: ok = read_128(de); break; default: ok = true; break; } if (!ok) { return false; } } return true; }