Commit a81408c9 by Paolo Carlini Committed by Paolo Carlini

PR libstdc++/21244 (cont^2)

2005-06-29  Paolo Carlini  <pcarlini@suse.de>

	PR libstdc++/21244 (cont^2)
	* include/ext/bitmap_allocator.h: Convert everywhere
	bits_per_block to size_t.

From-SVN: r101438
parent c64de75f
2005-06-29 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/21244 (cont^2)
* include/ext/bitmap_allocator.h: Convert everywhere
bits_per_block to size_t.
2005-06-29 Jonathan Wakely <redi@gcc.gnu.org> 2005-06-29 Jonathan Wakely <redi@gcc.gnu.org>
* include/bits/basic_string.h, include/bits/locale_facets.h: Fix * include/bits/basic_string.h, include/bits/locale_facets.h: Fix
......
...@@ -401,8 +401,8 @@ namespace __gnu_cxx ...@@ -401,8 +401,8 @@ namespace __gnu_cxx
enum enum
{ {
bits_per_byte = 8, bits_per_byte = 8,
bits_per_block = sizeof(size_t) * bits_per_byte bits_per_block = sizeof(size_t) * size_t(bits_per_byte)
}; };
template<typename _ForwardIterator, typename _Tp, typename _Compare> template<typename _ForwardIterator, typename _Tp, typename _Compare>
...@@ -459,7 +459,7 @@ namespace __gnu_cxx ...@@ -459,7 +459,7 @@ namespace __gnu_cxx
template<typename _AddrPair> template<typename _AddrPair>
inline size_t inline size_t
__num_bitmaps(_AddrPair __ap) __num_bitmaps(_AddrPair __ap)
{ return __num_blocks(__ap) / bits_per_block; } { return __num_blocks(__ap) / size_t(bits_per_block); }
// _Tp should be a pointer type. // _Tp should be a pointer type.
template<typename _Tp> template<typename _Tp>
...@@ -570,7 +570,7 @@ namespace __gnu_cxx ...@@ -570,7 +570,7 @@ namespace __gnu_cxx
_Counter_type _Counter_type
_M_offset() const throw() _M_offset() const throw()
{ return _M_data_offset * bits_per_block; } { return _M_data_offset * size_t(bits_per_block); }
}; };
...@@ -620,7 +620,7 @@ namespace __gnu_cxx ...@@ -620,7 +620,7 @@ namespace __gnu_cxx
_M_last_bmap_in_block = _M_curr_bmap _M_last_bmap_in_block = _M_curr_bmap
- ((_M_vbp[_M_curr_index].second - ((_M_vbp[_M_curr_index].second
- _M_vbp[_M_curr_index].first + 1) - _M_vbp[_M_curr_index].first + 1)
/ bits_per_block - 1); / size_t(bits_per_block) - 1);
} }
// Dangerous Function! Use with extreme care. Pass to this // Dangerous Function! Use with extreme care. Pass to this
...@@ -660,7 +660,7 @@ namespace __gnu_cxx ...@@ -660,7 +660,7 @@ namespace __gnu_cxx
_Index_type _Index_type
_M_offset() const throw() _M_offset() const throw()
{ {
return bits_per_block return size_t(bits_per_block)
* ((reinterpret_cast<size_t*>(this->_M_base()) * ((reinterpret_cast<size_t*>(this->_M_base())
- _M_curr_bmap) - 1); - _M_curr_bmap) - 1);
} }
...@@ -938,7 +938,8 @@ namespace __gnu_cxx ...@@ -938,7 +938,8 @@ namespace __gnu_cxx
_S_check_for_free_blocks(); _S_check_for_free_blocks();
#endif #endif
const size_t __num_bitmaps = _S_block_size / balloc::bits_per_block; const size_t __num_bitmaps = (_S_block_size
/ size_t(balloc::bits_per_block));
const size_t __size_to_allocate = sizeof(size_t) const size_t __size_to_allocate = sizeof(size_t)
+ _S_block_size * sizeof(_Alloc_block) + _S_block_size * sizeof(_Alloc_block)
+ __num_bitmaps * sizeof(size_t); + __num_bitmaps * sizeof(size_t);
...@@ -1136,11 +1137,12 @@ namespace __gnu_cxx ...@@ -1136,11 +1137,12 @@ namespace __gnu_cxx
} }
// Get the position of the iterator that has been found. // Get the position of the iterator that has been found.
const size_t __rotate = __displacement % balloc::bits_per_block; const size_t __rotate = (__displacement
% size_t(balloc::bits_per_block));
size_t* __bitmapC = size_t* __bitmapC =
reinterpret_cast<size_t*> reinterpret_cast<size_t*>
(_S_mem_blocks[__diff].first) - 1; (_S_mem_blocks[__diff].first) - 1;
__bitmapC -= (__displacement / balloc::bits_per_block); __bitmapC -= (__displacement / size_t(balloc::bits_per_block));
balloc::__bit_free(__bitmapC, __rotate); balloc::__bit_free(__bitmapC, __rotate);
size_t* __puse_count = reinterpret_cast<size_t*> size_t* __puse_count = reinterpret_cast<size_t*>
...@@ -1267,7 +1269,7 @@ namespace __gnu_cxx ...@@ -1267,7 +1269,7 @@ namespace __gnu_cxx
template<typename _Tp> template<typename _Tp>
size_t bitmap_allocator<_Tp>::_S_block_size = size_t bitmap_allocator<_Tp>::_S_block_size =
2 * balloc::bits_per_block; 2 * size_t(balloc::bits_per_block);
template<typename _Tp> template<typename _Tp>
typename __gnu_cxx::bitmap_allocator<_Tp>::_BPVector::size_type typename __gnu_cxx::bitmap_allocator<_Tp>::_BPVector::size_type
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment