1 //===------------------------ valarray.cpp --------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #include "valarray" 11 12 _LIBCPP_BEGIN_NAMESPACE_STD 13 14 template valarray<size_t>::valarray(size_t); 15 template valarray<size_t>::~valarray(); 16 template void valarray<size_t>::resize(size_t, size_t); 17 18 void __init(size_t __start)19gslice::__init(size_t __start) 20 { 21 valarray<size_t> __indices(__size_.size()); 22 size_t __k = __size_.size() != 0; 23 for (size_t __i = 0; __i < __size_.size(); ++__i) 24 __k *= __size_[__i]; 25 __1d_.resize(__k); 26 if (__1d_.size()) 27 { 28 __k = 0; 29 __1d_[__k] = __start; 30 while (true) 31 { 32 size_t __i = __indices.size() - 1; 33 while (true) 34 { 35 if (++__indices[__i] < __size_[__i]) 36 { 37 ++__k; 38 __1d_[__k] = __1d_[__k-1] + __stride_[__i]; 39 for (size_t __j = __i + 1; __j != __indices.size(); ++__j) 40 __1d_[__k] -= __stride_[__j] * (__size_[__j] - 1); 41 break; 42 } 43 else 44 { 45 if (__i == 0) 46 return; 47 __indices[__i--] = 0; 48 } 49 } 50 } 51 } 52 } 53 54 _LIBCPP_END_NAMESPACE_STD 55