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 #undef _LIBCPP_EXTERN_TEMPLATE 11 #define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__; 12 13 #include "valarray" 14 15 _LIBCPP_BEGIN_NAMESPACE_STD 16 17 template valarray<size_t>::valarray(size_t); 18 template valarray<size_t>::~valarray(); 19 template void valarray<size_t>::resize(size_t, size_t); 20 21 void 22 gslice::__init(size_t __start) 23 { 24 valarray<size_t> __indices(__size_.size()); 25 size_t __k = __size_.size() != 0; 26 for (size_t __i = 0; __i < __size_.size(); ++__i) 27 __k *= __size_[__i]; 28 __1d_.resize(__k); 29 if (__1d_.size()) 30 { 31 __k = 0; 32 __1d_[__k] = __start; 33 while (true) 34 { 35 size_t __i = __indices.size() - 1; 36 while (true) 37 { 38 if (++__indices[__i] < __size_[__i]) 39 { 40 ++__k; 41 __1d_[__k] = __1d_[__k-1] + __stride_[__i]; 42 for (size_t __j = __i + 1; __j != __indices.size(); ++__j) 43 __1d_[__k] -= __stride_[__j] * (__size_[__j] - 1); 44 break; 45 } 46 else 47 { 48 if (__i == 0) 49 return; 50 __indices[__i--] = 0; 51 } 52 } 53 } 54 } 55 } 56 57 _LIBCPP_END_NAMESPACE_STD 58