diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-01-19 10:14:11 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-01-19 10:14:11 -0800 |
commit | 5399641d167285d7d7eb641a6911b4bac812ff40 (patch) | |
tree | 0650648615d869cb7f993bdec19d9c330089fab2 /tests/libcxx/include | |
parent | 17cde1d9d7685eb2b33e6964bd87145f518d62f4 (diff) |
clean up libcxx test
Diffstat (limited to 'tests/libcxx/include')
99 files changed, 0 insertions, 97565 deletions
diff --git a/tests/libcxx/include/__bit_reference b/tests/libcxx/include/__bit_reference deleted file mode 100644 index bef27625..00000000 --- a/tests/libcxx/include/__bit_reference +++ /dev/null @@ -1,1225 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___BIT_REFERENCE -#define _LIBCPP___BIT_REFERENCE - -#include <__config> -#include <algorithm> - -#pragma GCC system_header - -_LIBCPP_BEGIN_NAMESPACE_STD - -template <class _C, bool _IsConst> class __bit_iterator; -template <class _C> class __bit_const_reference; - -template <class _C> -class __bit_reference -{ - typedef typename _C::__storage_type __storage_type; - typedef typename _C::__storage_pointer __storage_pointer; - - __storage_pointer __seg_; - __storage_type __mask_; - -#if defined(__clang__) - friend typename _C::__self; -#else - friend class _C::__self; -#endif - friend class __bit_const_reference<_C>; - friend class __bit_iterator<_C, false>; -public: - _LIBCPP_INLINE_VISIBILITY operator bool() const {return static_cast<bool>(*__seg_ & __mask_);} - _LIBCPP_INLINE_VISIBILITY bool operator ~() const {return !static_cast<bool>(*this);} - - _LIBCPP_INLINE_VISIBILITY - __bit_reference& operator=(bool __x) - { - if (__x) - *__seg_ |= __mask_; - else - *__seg_ &= ~__mask_; - return *this; - } - - _LIBCPP_INLINE_VISIBILITY - __bit_reference& operator=(const __bit_reference& __x) {return operator=(static_cast<bool>(__x));} - - _LIBCPP_INLINE_VISIBILITY void flip() {*__seg_ ^= __mask_;} - _LIBCPP_INLINE_VISIBILITY __bit_iterator<_C, false> operator&() const - {return __bit_iterator<_C, false>(__seg_, static_cast<unsigned>(__ctz(__mask_)));} -private: - _LIBCPP_INLINE_VISIBILITY - __bit_reference(__storage_pointer __s, __storage_type __m) : __seg_(__s), __mask_(__m) {} -}; - -template <class _C, class _D> -_LIBCPP_INLINE_VISIBILITY inline -void -swap(__bit_reference<_C> __x, __bit_reference<_D> __y) -{ - bool __t = __x; - __x = __y; - __y = __t; -} - -template <class _C> -_LIBCPP_INLINE_VISIBILITY inline -void -swap(__bit_reference<_C> __x, bool& __y) -{ - bool __t = __x; - __x = __y; - __y = __t; -} - -template <class _C> -_LIBCPP_INLINE_VISIBILITY inline -void -swap(bool& __x, __bit_reference<_C> __y) -{ - bool __t = __x; - __x = __y; - __y = __t; -} - -template <class _C> -class __bit_const_reference -{ - typedef typename _C::__storage_type __storage_type; - typedef typename _C::__const_storage_pointer __storage_pointer; - - __storage_pointer __seg_; - __storage_type __mask_; - -#if defined(__clang__) - friend typename _C::__self; -#else - friend class _C::__self; -#endif - friend class __bit_iterator<_C, true>; -public: - _LIBCPP_INLINE_VISIBILITY - __bit_const_reference(const __bit_reference<_C>& __x) - : __seg_(__x.__seg_), __mask_(__x.__mask_) {} - - _LIBCPP_INLINE_VISIBILITY operator bool() const {return static_cast<bool>(*__seg_ & __mask_);} - - _LIBCPP_INLINE_VISIBILITY __bit_iterator<_C, true> operator&() const - {return __bit_iterator<_C, true>(__seg_, static_cast<unsigned>(__ctz(__mask_)));} -private: - _LIBCPP_INLINE_VISIBILITY - __bit_const_reference(__storage_pointer __s, __storage_type __m) : __seg_(__s), __mask_(__m) {} - - __bit_const_reference& operator=(const __bit_const_reference& __x); -}; - -// find - -template <class _C> -__bit_iterator<_C, false> -__find_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n) -{ - typedef __bit_iterator<_C, false> _It; - typedef typename _It::__storage_type __storage_type; - static const unsigned __bits_per_word = _It::__bits_per_word; - // do first partial word - if (__first.__ctz_ != 0) - { - __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_); - __storage_type __dn = _STD::min(__clz_f, __n); - __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); - __storage_type __b = *__first.__seg_ & __m; - if (__b) - return _It(__first.__seg_, static_cast<unsigned>(_STD::__ctz(__b))); - __n -= __dn; - ++__first.__seg_; - } - // do middle whole words - for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word) - if (*__first.__seg_) - return _It(__first.__seg_, static_cast<unsigned>(_STD::__ctz(*__first.__seg_))); - // do last partial word - if (__n > 0) - { - __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); - __storage_type __b = *__first.__seg_ & __m; - if (__b) - return _It(__first.__seg_, static_cast<unsigned>(_STD::__ctz(__b))); - } - return _It(__first.__seg_, static_cast<unsigned>(__n)); -} - -template <class _C> -__bit_iterator<_C, false> -__find_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n) -{ - typedef __bit_iterator<_C, false> _It; - typedef typename _It::__storage_type __storage_type; - static const unsigned __bits_per_word = _It::__bits_per_word; - // do first partial word - if (__first.__ctz_ != 0) - { - __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_); - __storage_type __dn = _STD::min(__clz_f, __n); - __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); - __storage_type __b = ~(*__first.__seg_ & __m); - if (__b) - return _It(__first.__seg_, static_cast<unsigned>(_STD::__ctz(__b))); - __n -= __dn; - ++__first.__seg_; - } - // do middle whole words - for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word) - { - __storage_type __b = ~*__first.__seg_; - if (__b) - return _It(__first.__seg_, static_cast<unsigned>(_STD::__ctz(__b))); - } - // do last partial word - if (__n > 0) - { - __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); - __storage_type __b = ~(*__first.__seg_ & __m); - if (__b) - return _It(__first.__seg_, static_cast<unsigned>(_STD::__ctz(__b))); - } - return _It(__first.__seg_, static_cast<unsigned>(__n)); -} - -template <class _C, class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -__bit_iterator<_C, false> -find(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, const _Tp& __value) -{ - if (static_cast<bool>(__value)) - return __find_bool_true(__first, static_cast<typename _C::size_type>(__last - __first)); - return __find_bool_false(__first, static_cast<typename _C::size_type>(__last - __first)); -} - -// count - -template <class _C> -typename __bit_iterator<_C, false>::difference_type -__count_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n) -{ - typedef __bit_iterator<_C, false> _It; - typedef typename _It::__storage_type __storage_type; - typedef typename _It::difference_type difference_type; - static const unsigned __bits_per_word = _It::__bits_per_word; - difference_type __r = 0; - // do first partial word - if (__first.__ctz_ != 0) - { - __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_); - __storage_type __dn = _STD::min(__clz_f, __n); - __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); - __r = _STD::__pop_count(*__first.__seg_ & __m); - __n -= __dn; - ++__first.__seg_; - } - // do middle whole words - for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word) - __r += _STD::__pop_count(*__first.__seg_); - // do last partial word - if (__n > 0) - { - __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); - __r += _STD::__pop_count(*__first.__seg_ & __m); - } - return __r; -} - -template <class _C> -typename __bit_iterator<_C, false>::difference_type -__count_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n) -{ - typedef __bit_iterator<_C, false> _It; - typedef typename _It::__storage_type __storage_type; - typedef typename _It::difference_type difference_type; < |