Changeset 3028


Ignore:
Timestamp:
23/10/2011 16:51:52 (7 months ago)
Author:
chris
Message:

Adjust for platforms where sizeof(long) < sizeof(void *), apparently
including Visual Studio 64-bit where sizeof(long) == 4. I don't fully
understand the code, so I hope this adjustment is correct!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/trunk/lib/backupstore/BackupStoreFile.h

    r2983 r3028  
    163163                if(a == 0) return 0; 
    164164                // Align to main block size 
    165                 ASSERT(sizeof(unsigned long) >= sizeof(void*)); // make sure casting the right pointer size 
     165                ASSERT(sizeof(uint64_t) >= sizeof(void*));      // make sure casting the right pointer size 
    166166                uint8_t adjustment = BACKUPSTOREFILE_CODING_BLOCKSIZE 
    167                                                           - (uint8_t)(((unsigned long)a) % BACKUPSTOREFILE_CODING_BLOCKSIZE); 
     167                          - (uint8_t)(((uint64_t)a) % BACKUPSTOREFILE_CODING_BLOCKSIZE); 
    168168                uint8_t *b = (a + adjustment); 
    169169                // Store adjustment 
     
    175175        { 
    176176                // Check alignment is as expected 
    177                 ASSERT(sizeof(unsigned long) >= sizeof(void*)); // make sure casting the right pointer size 
    178                 ASSERT((uint8_t)(((unsigned long)Block) % BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET); 
     177                ASSERT(sizeof(uint64_t) >= sizeof(void*));      // make sure casting the right pointer size 
     178                ASSERT((uint8_t)(((uint64_t)Block) % BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET); 
    179179                uint8_t *a = (uint8_t*)Block; 
    180180                a -= BACKUPSTOREFILE_CODING_OFFSET; 
Note: See TracChangeset for help on using the changeset viewer.