epoc32/include/stdapis/stlportv5/stl/_valarray.c
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
     1.1 --- a/epoc32/include/stdapis/stlportv5/stl/_valarray.c	Wed Mar 31 12:27:01 2010 +0100
     1.2 +++ b/epoc32/include/stdapis/stlportv5/stl/_valarray.c	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -1,6 +1,5 @@
     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 @@ -11,13 +10,13 @@
    1.11   * Copyright (c) 1997
    1.12   * Moscow Center for SPARC Technology
    1.13   *
    1.14 - * Copyright (c) 1999 
    1.15 + * Copyright (c) 1999
    1.16   * Boris Fomitchev
    1.17   *
    1.18   * This material is provided "as is", with absolutely no warranty expressed
    1.19   * or implied. Any use is at your own risk.
    1.20   *
    1.21 - * Permission to use or copy this software for any purpose is hereby granted 
    1.22 + * Permission to use or copy this software for any purpose is hereby granted
    1.23   * without fee, provided the above notices are retained on all copies.
    1.24   * Permission to modify the code and to distribute modified code is granted,
    1.25   * provided the above notices are retained, and a notice that the code was
    1.26 @@ -49,7 +48,7 @@
    1.27    for (size_t __i = 0;
    1.28         __i < __x._M_slice.size();
    1.29         ++__i, __index += __x._M_slice.stride())
    1.30 -    (*this)[__i] = (*(__x._M_array))[__index];
    1.31 +    (*this)[__i] = __x._M_array[__index];
    1.32    return *this;
    1.33  }
    1.34  
    1.35 @@ -68,13 +67,12 @@
    1.36  bool _Gslice_Iter_tmpl<_Size>::_M_incr() {
    1.37    size_t __dim = _M_indices.size() - 1;
    1.38    ++_M_step;
    1.39 -  while (true) {
    1.40 +  for (;;) {
    1.41      _M_1d_idx += _M_gslice._M_strides[__dim];
    1.42      if (++_M_indices[__dim] != _M_gslice._M_lengths[__dim])
    1.43        return true;
    1.44      else if (__dim != 0) {
    1.45 -      _M_1d_idx -=
    1.46 -	_M_gslice._M_strides[__dim] * _M_gslice._M_lengths[__dim];
    1.47 +      _M_1d_idx -= _M_gslice._M_strides[__dim] * _M_gslice._M_lengths[__dim];
    1.48        _M_indices[__dim] = 0;
    1.49        --__dim;
    1.50      }
    1.51 @@ -98,7 +96,7 @@
    1.52  }
    1.53  
    1.54  template <class _Tp>
    1.55 -valarray<_Tp> valarray<_Tp>::operator[](gslice __slice) const
    1.56 +valarray<_Tp> valarray<_Tp>::operator[](const gslice& __slice) const
    1.57  {
    1.58    valarray<_Tp> __tmp(__slice._M_size(), _NoInit());
    1.59    if (__tmp.size() != 0) {
    1.60 @@ -172,11 +170,9 @@
    1.61  {
    1.62    valarray<_Tp> __tmp(this->size());
    1.63    
    1.64 -#ifdef __SYMBIAN32__
    1.65 -	if (!this->size())
    1.66 -		return __tmp;
    1.67 -#endif	
    1.68 -	
    1.69 +  if( this->size() == 0 )
    1.70 + 	  return __tmp;
    1.71 +
    1.72    // Reduce __m to an equivalent number in the range [0, size()).  We
    1.73    // have to be careful with negative numbers, since the sign of a % b
    1.74    // is unspecified when a < 0.