mirror of git://gcc.gnu.org/git/gcc.git
stl_bvector.h (hash<vector<bool, [...]): Move definition...
2010-03-02 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/stl_bvector.h (hash<vector<bool, _Alloc>>:: operator()(const vector<bool, _Alloc>&)): Move definition... * include/bits/vector.tcc: ... here. From-SVN: r157178
This commit is contained in:
parent
d903b2a134
commit
f54e96d971
|
@ -1044,42 +1044,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
||||||
operator()(const _GLIBCXX_STD_D::vector<bool, _Alloc>& __b) const;
|
operator()(const _GLIBCXX_STD_D::vector<bool, _Alloc>& __b) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename _Alloc>
|
|
||||||
size_t
|
|
||||||
hash<_GLIBCXX_STD_D::vector<bool, _Alloc>>::
|
|
||||||
operator()(const _GLIBCXX_STD_D::vector<bool, _Alloc>& __b) const
|
|
||||||
{
|
|
||||||
size_t __hash = 0;
|
|
||||||
using _GLIBCXX_STD_D::_S_word_bit;
|
|
||||||
using _GLIBCXX_STD_D::_Bit_type;
|
|
||||||
|
|
||||||
const size_t __words = __b.size() / _S_word_bit;
|
|
||||||
if (__words)
|
|
||||||
{
|
|
||||||
const char* __data
|
|
||||||
= reinterpret_cast<const char*>(__b._M_impl._M_start._M_p);
|
|
||||||
const size_t __size = __words * sizeof(_Bit_type);
|
|
||||||
__hash = std::_Fnv_hash::hash(__data, __size);
|
|
||||||
}
|
|
||||||
|
|
||||||
const size_t __extrabits = __b.size() % _S_word_bit;
|
|
||||||
if (__extrabits)
|
|
||||||
{
|
|
||||||
_Bit_type __hiword = *__b._M_impl._M_finish._M_p;
|
|
||||||
__hiword &= ~((~static_cast<_Bit_type>(0)) << __extrabits);
|
|
||||||
|
|
||||||
const char* __data = reinterpret_cast<const char*>(&__hiword);
|
|
||||||
const size_t __size
|
|
||||||
= (__extrabits + __CHAR_BIT__ - 1) / __CHAR_BIT__;
|
|
||||||
if (__words)
|
|
||||||
__hash = std::_Fnv_hash::hash(__data, __size, __hash);
|
|
||||||
else
|
|
||||||
__hash = std::_Fnv_hash::hash(__data, __size);
|
|
||||||
}
|
|
||||||
|
|
||||||
return __hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
_GLIBCXX_END_NAMESPACE
|
_GLIBCXX_END_NAMESPACE
|
||||||
|
|
||||||
#endif // __GXX_EXPERIMENTAL_CXX0X__
|
#endif // __GXX_EXPERIMENTAL_CXX0X__
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Vector implementation (out of line) -*- C++ -*-
|
// Vector implementation (out of line) -*- C++ -*-
|
||||||
|
|
||||||
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
||||||
// Free Software Foundation, Inc.
|
// Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
// This file is part of the GNU ISO C++ Library. This library is free
|
// This file is part of the GNU ISO C++ Library. This library is free
|
||||||
|
@ -678,4 +678,48 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
|
||||||
|
|
||||||
_GLIBCXX_END_NESTED_NAMESPACE
|
_GLIBCXX_END_NESTED_NAMESPACE
|
||||||
|
|
||||||
|
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
||||||
|
|
||||||
|
_GLIBCXX_BEGIN_NAMESPACE(std)
|
||||||
|
|
||||||
|
template<typename _Alloc>
|
||||||
|
size_t
|
||||||
|
hash<_GLIBCXX_STD_D::vector<bool, _Alloc>>::
|
||||||
|
operator()(const _GLIBCXX_STD_D::vector<bool, _Alloc>& __b) const
|
||||||
|
{
|
||||||
|
size_t __hash = 0;
|
||||||
|
using _GLIBCXX_STD_D::_S_word_bit;
|
||||||
|
using _GLIBCXX_STD_D::_Bit_type;
|
||||||
|
|
||||||
|
const size_t __words = __b.size() / _S_word_bit;
|
||||||
|
if (__words)
|
||||||
|
{
|
||||||
|
const char* __data
|
||||||
|
= reinterpret_cast<const char*>(__b._M_impl._M_start._M_p);
|
||||||
|
const size_t __size = __words * sizeof(_Bit_type);
|
||||||
|
__hash = std::_Fnv_hash::hash(__data, __size);
|
||||||
|
}
|
||||||
|
|
||||||
|
const size_t __extrabits = __b.size() % _S_word_bit;
|
||||||
|
if (__extrabits)
|
||||||
|
{
|
||||||
|
_Bit_type __hiword = *__b._M_impl._M_finish._M_p;
|
||||||
|
__hiword &= ~((~static_cast<_Bit_type>(0)) << __extrabits);
|
||||||
|
|
||||||
|
const char* __data = reinterpret_cast<const char*>(&__hiword);
|
||||||
|
const size_t __size
|
||||||
|
= (__extrabits + __CHAR_BIT__ - 1) / __CHAR_BIT__;
|
||||||
|
if (__words)
|
||||||
|
__hash = std::_Fnv_hash::hash(__data, __size, __hash);
|
||||||
|
else
|
||||||
|
__hash = std::_Fnv_hash::hash(__data, __size);
|
||||||
|
}
|
||||||
|
|
||||||
|
return __hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
_GLIBCXX_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // __GXX_EXPERIMENTAL_CXX0X__
|
||||||
|
|
||||||
#endif /* _VECTOR_TCC */
|
#endif /* _VECTOR_TCC */
|
||||||
|
|
Loading…
Reference in New Issue