diff options
author | Chris Wilson <chris+github@qwirx.com> | 2011-10-23 15:51:52 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2011-10-23 15:51:52 +0000 |
commit | a23059ee905303defdb87803fa52d24ccdb83279 (patch) | |
tree | 8fd150c51a99c7e09bbffa648c49e06898ff66ed | |
parent | 54d73c51d78add1cfb1ef6a831402cdd95f9bac9 (diff) |
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!
-rw-r--r-- | lib/backupstore/BackupStoreFile.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/backupstore/BackupStoreFile.h b/lib/backupstore/BackupStoreFile.h index b390320e..8398429a 100644 --- a/lib/backupstore/BackupStoreFile.h +++ b/lib/backupstore/BackupStoreFile.h @@ -162,9 +162,9 @@ public: uint8_t *a = (uint8_t*)malloc((Size) + (BACKUPSTOREFILE_CODING_BLOCKSIZE * 3)); if(a == 0) return 0; // Align to main block size - ASSERT(sizeof(unsigned long) >= sizeof(void*)); // make sure casting the right pointer size + ASSERT(sizeof(uint64_t) >= sizeof(void*)); // make sure casting the right pointer size uint8_t adjustment = BACKUPSTOREFILE_CODING_BLOCKSIZE - - (uint8_t)(((unsigned long)a) % BACKUPSTOREFILE_CODING_BLOCKSIZE); + - (uint8_t)(((uint64_t)a) % BACKUPSTOREFILE_CODING_BLOCKSIZE); uint8_t *b = (a + adjustment); // Store adjustment *b = adjustment; @@ -174,8 +174,8 @@ public: inline static void CodingChunkFree(void *Block) { // Check alignment is as expected - ASSERT(sizeof(unsigned long) >= sizeof(void*)); // make sure casting the right pointer size - ASSERT((uint8_t)(((unsigned long)Block) % BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET); + ASSERT(sizeof(uint64_t) >= sizeof(void*)); // make sure casting the right pointer size + ASSERT((uint8_t)(((uint64_t)Block) % BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET); uint8_t *a = (uint8_t*)Block; a -= BACKUPSTOREFILE_CODING_OFFSET; // Adjust downwards... |