- Timestamp:
- Nov 22, 1999, 12:23:47 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Poubelle/archTOI.old/archeopsfile.cc
r581 r617 347 347 longueur_block(peekBlock) != long_block[type_block(peekBlock)]) { 348 348 cout << "invalid block, bad type or length" << endl; 349 //cout << "addr = " << peekPos << endl; 349 350 memset(peekBlock, 0, sizeof(block_type_modele)); // don't keep trash... 350 351 peekPos = searchNextBlock(peekPos); … … 435 436 } 436 437 438 439 #ifdef __DECCXX 440 #define SWAP 441 #endif 442 #if ((defined(Linux) || defined(linux)) && !defined(powerpc)) 443 #define SWAP 444 #endif 445 446 447 typedef unsigned int4 uint_4; 448 typedef unsigned short uint_2; 449 450 static inline void bswap4(void* p) 451 { 452 uint_4 tmp = *(uint_4*)p; 453 *(uint_4*)p = ((tmp >> 24) & 0x000000FF) | 454 ((tmp >> 8) & 0x0000FF00) | 455 ((tmp & 0x0000FF00) << 8) | 456 ((tmp & 0x000000FF) << 24); 457 } 458 459 static inline void bswap2(void* p) 460 { 461 uint_2 tmp = *(uint_2*)p; 462 *(uint_2*)p = ((tmp >> 8) & 0x00FF) | 463 ((tmp & 0x00FF) << 8); 464 } 465 466 437 467 long ArcheopsFile::searchNextBlock(long pos) { 438 468 static char* buffer = 0; … … 445 475 #endif 446 476 } 477 //printf("searchNext %o len = %d value = %x \n", pos, longmax, debswp); 447 478 long read = longmax; 448 479 while (read == longmax) { … … 455 486 #endif 456 487 for (long i=4; i<read; i++) { 488 // printf("%o %x\n", pos+i, *(__unaligned int4*)(buffer+i)); 457 489 if (*(__unaligned int4*)(buffer+i) == debswp) { 458 490 cout << "trying to skip " << i << " bytes to pos="<<pos+i << endl; … … 620 652 } 621 653 622 typedef unsigned int4 uint_4;623 typedef unsigned short uint_2;624 625 static inline void bswap4(void* p)626 {627 uint_4 tmp = *(uint_4*)p;628 *(uint_4*)p = ((tmp >> 24) & 0x000000FF) |629 ((tmp >> 8) & 0x0000FF00) |630 ((tmp & 0x0000FF00) << 8) |631 ((tmp & 0x000000FF) << 24);632 }633 634 static inline void bswap2(void* p)635 {636 uint_2 tmp = *(uint_2*)p;637 *(uint_2*)p = ((tmp >> 8) & 0x00FF) |638 ((tmp & 0x00FF) << 8);639 }640 641 #ifdef __DECCXX642 #define SWAP643 #endif644 #if defined(Linux) || defined(linux)645 #define SWAP646 #endif647 648 654 #ifdef SWAP 649 655 void ArcheopsFile::swapEntete(block_type_modele* blk) {
Note:
See TracChangeset
for help on using the changeset viewer.