mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-27 14:07:32 +00:00
Fix More Casts
Properly cast some more code that triggered cast-away-const errors. llvm-svn: 172469
This commit is contained in:
parent
1365ed4c63
commit
6830c63fcd
@ -72,15 +72,20 @@ namespace {
|
|||||||
/// getBlockAfter - Return the memory block immediately after this one.
|
/// getBlockAfter - Return the memory block immediately after this one.
|
||||||
///
|
///
|
||||||
MemoryRangeHeader &getBlockAfter() const {
|
MemoryRangeHeader &getBlockAfter() const {
|
||||||
return *(MemoryRangeHeader*)((char*)this+BlockSize);
|
return *reinterpret_cast<MemoryRangeHeader *>(
|
||||||
|
reinterpret_cast<char*>(
|
||||||
|
const_cast<MemoryRangeHeader *>(this))+BlockSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getFreeBlockBefore - If the block before this one is free, return it,
|
/// getFreeBlockBefore - If the block before this one is free, return it,
|
||||||
/// otherwise return null.
|
/// otherwise return null.
|
||||||
FreeRangeHeader *getFreeBlockBefore() const {
|
FreeRangeHeader *getFreeBlockBefore() const {
|
||||||
if (PrevAllocated) return 0;
|
if (PrevAllocated) return 0;
|
||||||
intptr_t PrevSize = ((intptr_t *)this)[-1];
|
intptr_t PrevSize = reinterpret_cast<intptr_t *>(
|
||||||
return (FreeRangeHeader*)((char*)this-PrevSize);
|
const_cast<MemoryRangeHeader *>(this))[-1];
|
||||||
|
return reinterpret_cast<FreeRangeHeader *>(
|
||||||
|
reinterpret_cast<char*>(
|
||||||
|
const_cast<MemoryRangeHeader *>(this))-PrevSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// FreeBlock - Turn an allocated block into a free block, adjusting
|
/// FreeBlock - Turn an allocated block into a free block, adjusting
|
||||||
|
Loading…
Reference in New Issue
Block a user