diff options
author | lloyd <[email protected]> | 2007-07-23 15:44:04 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2007-07-23 15:44:04 +0000 |
commit | e2f1f734277146d817ab284dea21e4013cb5b937 (patch) | |
tree | 21ad6ee775e36aa7fb24a504077200c22b1f15b8 /src/mem_pool.cpp | |
parent | 211c4929ae92106794984d872a0cae1a873baa29 (diff) |
Avoid C-style casts (as detected by GCC's -Wold-style-cast) and instead use
static_cast or reinterpret_cast, as needed.
Diffstat (limited to 'src/mem_pool.cpp')
-rw-r--r-- | src/mem_pool.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/mem_pool.cpp b/src/mem_pool.cpp index faf399ec6..29930b8a1 100644 --- a/src/mem_pool.cpp +++ b/src/mem_pool.cpp @@ -48,7 +48,7 @@ bool Pooling_Allocator::Memory_Block::contains(void* ptr, u32bit length) const throw() { return ((buffer <= ptr) && - (buffer_end >= (byte*)ptr + length * BLOCK_SIZE)); + (buffer_end >= static_cast<byte*>(ptr) + length * BLOCK_SIZE)); } /************************************************* @@ -70,7 +70,7 @@ byte* Pooling_Allocator::Memory_Block::alloc(u32bit n) throw() } } - bitmap_type mask = ((bitmap_type)1 << n) - 1; + bitmap_type mask = (static_cast<bitmap_type>(1) << n) - 1; u32bit offset = 0; while(bitmap & mask) @@ -96,16 +96,16 @@ byte* Pooling_Allocator::Memory_Block::alloc(u32bit n) throw() *************************************************/ void Pooling_Allocator::Memory_Block::free(void* ptr, u32bit blocks) throw() { - clear_mem((byte*)ptr, blocks * BLOCK_SIZE); + clear_mem(static_cast<byte*>(ptr), blocks * BLOCK_SIZE); - const u32bit offset = ((byte*)ptr - buffer) / BLOCK_SIZE; + const u32bit offset = (static_cast<byte*>(ptr) - buffer) / BLOCK_SIZE; if(offset == 0 && blocks == BITMAP_SIZE) bitmap = ~bitmap; else { for(u32bit j = 0; j != blocks; ++j) - bitmap &= ~((bitmap_type)1 << (j+offset)); + bitmap &= ~(static_cast<bitmap_type>(1) << (j+offset)); } } |