1.1 --- a/epoc32/include/stdapis/stlport/stl/_valarray.c Tue Mar 16 16:12:26 2010 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,203 +0,0 @@
1.4 -/*
1.5 - *
1.6 - * © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved.
1.7 - *
1.8 - * Copyright (c) 1994
1.9 - * Hewlett-Packard Company
1.10 - *
1.11 - * Copyright (c) 1996,1997
1.12 - * Silicon Graphics Computer Systems, Inc.
1.13 - *
1.14 - * Copyright (c) 1997
1.15 - * Moscow Center for SPARC Technology
1.16 - *
1.17 - * Copyright (c) 1999
1.18 - * Boris Fomitchev
1.19 - *
1.20 - * This material is provided "as is", with absolutely no warranty expressed
1.21 - * or implied. Any use is at your own risk.
1.22 - *
1.23 - * Permission to use or copy this software for any purpose is hereby granted
1.24 - * without fee, provided the above notices are retained on all copies.
1.25 - * Permission to modify the code and to distribute modified code is granted,
1.26 - * provided the above notices are retained, and a notice that the code was
1.27 - * modified is included with the above copyright notice.
1.28 - *
1.29 - */
1.30 -#ifndef _STLP_VALARRAY_C
1.31 -#define _STLP_VALARRAY_C
1.32 -
1.33 -#ifndef _STLP_VALARRAY_H
1.34 -# include <stl/_valarray.h>
1.35 -#endif
1.36 -
1.37 -_STLP_BEGIN_NAMESPACE
1.38 -
1.39 -template <class _Tp>
1.40 -_Valarray_bool valarray<_Tp>:: operator!() const {
1.41 - _Valarray_bool __tmp(this->size(), _Valarray_bool::_NoInit());
1.42 - for (size_t __i = 0; __i < this->size(); ++__i)
1.43 - __tmp[__i] = !(*this)[__i];
1.44 - return __tmp;
1.45 -}
1.46 -
1.47 -// Behavior is undefined if __x and *this have different sizes
1.48 -template <class _Tp>
1.49 -valarray<_Tp>& valarray<_Tp>::operator=(const slice_array<_Tp>& __x)
1.50 -{
1.51 - size_t __index = __x._M_slice.start();
1.52 - for (size_t __i = 0;
1.53 - __i < __x._M_slice.size();
1.54 - ++__i, __index += __x._M_slice.stride())
1.55 - (*this)[__i] = (*(__x._M_array))[__index];
1.56 - return *this;
1.57 -}
1.58 -
1.59 -template <class _Tp>
1.60 -valarray<_Tp> valarray<_Tp>::operator[](slice __slice) const {
1.61 - valarray<_Tp> __tmp(__slice.size(), _NoInit());
1.62 - size_t __index = __slice.start();
1.63 - for (size_t __i = 0;
1.64 - __i < __slice.size();
1.65 - ++__i, __index += __slice.stride())
1.66 - __tmp[__i] = (*this)[__index];
1.67 - return __tmp;
1.68 -}
1.69 -
1.70 -template <class _Size>
1.71 -bool _Gslice_Iter_tmpl<_Size>::_M_incr() {
1.72 - size_t __dim = _M_indices.size() - 1;
1.73 - ++_M_step;
1.74 - while (true) {
1.75 - _M_1d_idx += _M_gslice._M_strides[__dim];
1.76 - if (++_M_indices[__dim] != _M_gslice._M_lengths[__dim])
1.77 - return true;
1.78 - else if (__dim != 0) {
1.79 - _M_1d_idx -=
1.80 - _M_gslice._M_strides[__dim] * _M_gslice._M_lengths[__dim];
1.81 - _M_indices[__dim] = 0;
1.82 - --__dim;
1.83 - }
1.84 - else
1.85 - return false;
1.86 - }
1.87 -}
1.88 -
1.89 -// Behavior is undefined if __x and *this have different sizes, or if
1.90 -// __x was constructed from a degenerate gslice.
1.91 -template <class _Tp>
1.92 -valarray<_Tp>& valarray<_Tp>::operator=(const gslice_array<_Tp>& __x)
1.93 -{
1.94 - if (this->size() != 0) {
1.95 - _Gslice_Iter __i(__x._M_gslice);
1.96 - do
1.97 - (*this)[__i._M_step] = __x._M_array[__i._M_1d_idx];
1.98 - while(__i._M_incr());
1.99 - }
1.100 - return *this;
1.101 -}
1.102 -
1.103 -template <class _Tp>
1.104 -valarray<_Tp> valarray<_Tp>::operator[](gslice __slice) const
1.105 -{
1.106 - valarray<_Tp> __tmp(__slice._M_size(), _NoInit());
1.107 - if (__tmp.size() != 0) {
1.108 - _Gslice_Iter __i(__slice);
1.109 - do __tmp[__i._M_step] = (*this)[__i._M_1d_idx]; while(__i._M_incr());
1.110 - }
1.111 - return __tmp;
1.112 -}
1.113 -
1.114 -template <class _Tp>
1.115 -valarray<_Tp> valarray<_Tp>::operator[](const _Valarray_bool& __mask) const
1.116 -{
1.117 - size_t _p_size = 0;
1.118 - {
1.119 - for (size_t __i = 0; __i < __mask.size(); ++__i)
1.120 - if (__mask[__i]) ++_p_size;
1.121 - }
1.122 -
1.123 - valarray<_Tp> __tmp(_p_size, _NoInit());
1.124 - size_t __idx = 0;
1.125 - {
1.126 - for (size_t __i = 0; __i < __mask.size(); ++__i)
1.127 - if (__mask[__i]) __tmp[__idx++] = (*this)[__i];
1.128 - }
1.129 -
1.130 - return __tmp;
1.131 -}
1.132 -
1.133 -template <class _Tp>
1.134 -valarray<_Tp>& valarray<_Tp>::operator=(const indirect_array<_Tp>& __x) {
1.135 - for (size_t __i = 0; __i < __x._M_addr.size(); ++__i)
1.136 - (*this)[__i] = __x._M_array[__x._M_addr[__i]];
1.137 - return *this;
1.138 -}
1.139 -
1.140 -template <class _Tp>
1.141 -valarray<_Tp>
1.142 -valarray<_Tp>::operator[](const _Valarray_size_t& __addr) const
1.143 -{
1.144 - valarray<_Tp> __tmp(__addr.size(), _NoInit());
1.145 - for (size_t __i = 0; __i < __addr.size(); ++__i)
1.146 - __tmp[__i] = (*this)[__addr[__i]];
1.147 - return __tmp;
1.148 -}
1.149 -
1.150 -//----------------------------------------------------------------------
1.151 -// Other valarray noninline member functions
1.152 -
1.153 -// Shift and cshift
1.154 -
1.155 -template <class _Tp>
1.156 -valarray<_Tp> valarray<_Tp>::shift(int __n) const
1.157 -{
1.158 - valarray<_Tp> __tmp(this->size());
1.159 -
1.160 - if (__n >= 0) {
1.161 - if (__n < this->size())
1.162 - copy(this->_M_first + __n, this->_M_first + this->size(),
1.163 - __tmp._M_first);
1.164 - }
1.165 - else {
1.166 - if (-__n < this->size())
1.167 - copy(this->_M_first, this->_M_first + this->size() + __n,
1.168 - __tmp._M_first - __n);
1.169 - }
1.170 - return __tmp;
1.171 -}
1.172 -
1.173 -template <class _Tp>
1.174 -valarray<_Tp> valarray<_Tp>::cshift(int __m) const
1.175 -{
1.176 - valarray<_Tp> __tmp(this->size());
1.177 -
1.178 -#ifdef __SYMBIAN32__
1.179 - if (!this->size())
1.180 - return __tmp;
1.181 -#endif
1.182 -
1.183 - // Reduce __m to an equivalent number in the range [0, size()). We
1.184 - // have to be careful with negative numbers, since the sign of a % b
1.185 - // is unspecified when a < 0.
1.186 - long __n = __m;
1.187 - if (this->size() < (numeric_limits<long>::max)())
1.188 - __n %= long(this->size());
1.189 - if (__n < 0)
1.190 - __n += this->size();
1.191 -
1.192 - copy(this->_M_first, this->_M_first + __n,
1.193 - __tmp._M_first + (this->size() - __n));
1.194 - copy(this->_M_first + __n, this->_M_first + this->size(),
1.195 - __tmp._M_first);
1.196 -
1.197 - return __tmp;
1.198 -}
1.199 -
1.200 -_STLP_END_NAMESPACE
1.201 -
1.202 -#endif /* _STLP_VALARRAY_C */
1.203 -
1.204 -// Local Variables:
1.205 -// mode:C++
1.206 -// End: