3 typedef __PTRDIFF_TYPE__ ptrdiff_t;
4 extern "C" void abort ();
10 typedef ptrdiff_t difference_type;
17 T &operator [] (const difference_type &) const;
18 I &operator = (const I &);
23 I &operator += (const difference_type &);
24 I &operator -= (const difference_type &);
25 I operator + (const difference_type &) const;
26 I operator - (const difference_type &) const;
27 template <typename S> friend bool operator == (I<S> &, I<S> &);
28 template <typename S> friend bool operator == (const I<S> &, const I<S> &);
29 template <typename S> friend bool operator < (I<S> &, I<S> &);
30 template <typename S> friend bool operator < (const I<S> &, const I<S> &);
31 template <typename S> friend bool operator <= (I<S> &, I<S> &);
32 template <typename S> friend bool operator <= (const I<S> &, const I<S> &);
33 template <typename S> friend bool operator > (I<S> &, I<S> &);
34 template <typename S> friend bool operator > (const I<S> &, const I<S> &);
35 template <typename S> friend bool operator >= (I<S> &, I<S> &);
36 template <typename S> friend bool operator >= (const I<S> &, const I<S> &);
37 template <typename S> friend typename I<S>::difference_type operator - (I<S> &, I<S> &);
38 template <typename S> friend typename I<S>::difference_type operator - (const I<S> &, const I<S> &);
39 template <typename S> friend I<S> operator + (typename I<S>::difference_type , const I<S> &);
43 template <typename T> I<T>::I () : p (0) {}
44 template <typename T> I<T>::~I () { p = (T *) 0; }
45 template <typename T> I<T>::I (T *x) : p (x) {}
46 template <typename T> I<T>::I (const I &x) : p (x.p) {}
47 template <typename T> T &I<T>::operator * () { return *p; }
48 template <typename T> T *I<T>::operator -> () { return p; }
49 template <typename T> T &I<T>::operator [] (const difference_type &x) const { return p[x]; }
50 template <typename T> I<T> &I<T>::operator = (const I &x) { p = x.p; return *this; }
51 template <typename T> I<T> &I<T>::operator ++ () { ++p; return *this; }
52 template <typename T> I<T> I<T>::operator ++ (int) { return I (p++); }
53 template <typename T> I<T> &I<T>::operator -- () { --p; return *this; }
54 template <typename T> I<T> I<T>::operator -- (int) { return I (p--); }
55 template <typename T> I<T> &I<T>::operator += (const difference_type &x) { p += x; return *this; }
56 template <typename T> I<T> &I<T>::operator -= (const difference_type &x) { p -= x; return *this; }
57 template <typename T> I<T> I<T>::operator + (const difference_type &x) const { return I (p + x); }
58 template <typename T> I<T> I<T>::operator - (const difference_type &x) const { return I (p - x); }
59 template <typename T> bool operator == (I<T> &x, I<T> &y) { return x.p == y.p; }
60 template <typename T> bool operator == (const I<T> &x, const I<T> &y) { return x.p == y.p; }
61 template <typename T> bool operator != (I<T> &x, I<T> &y) { return !(x == y); }
62 template <typename T> bool operator != (const I<T> &x, const I<T> &y) { return !(x == y); }
63 template <typename T> bool operator < (I<T> &x, I<T> &y) { return x.p < y.p; }
64 template <typename T> bool operator < (const I<T> &x, const I<T> &y) { return x.p < y.p; }
65 template <typename T> bool operator <= (I<T> &x, I<T> &y) { return x.p <= y.p; }
66 template <typename T> bool operator <= (const I<T> &x, const I<T> &y) { return x.p <= y.p; }
67 template <typename T> bool operator > (I<T> &x, I<T> &y) { return x.p > y.p; }
68 template <typename T> bool operator > (const I<T> &x, const I<T> &y) { return x.p > y.p; }
69 template <typename T> bool operator >= (I<T> &x, I<T> &y) { return x.p >= y.p; }
70 template <typename T> bool operator >= (const I<T> &x, const I<T> &y) { return x.p >= y.p; }
71 template <typename T> typename I<T>::difference_type operator - (I<T> &x, I<T> &y) { return x.p - y.p; }
72 template <typename T> typename I<T>::difference_type operator - (const I<T> &x, const I<T> &y) { return x.p - y.p; }
73 template <typename T> I<T> operator + (typename I<T>::difference_type x, const I<T> &y) { return I<T> (x + y.p); }
79 J(const I<T> &x, const I<T> &y) : b (x), e (y) {}
86 template <typename T> const I<T> &J<T>::begin () { return b; }
87 template <typename T> const I<T> &J<T>::end () { return e; }
95 if (*i < 0 || *i >= 2000)
101 f1 (const I<int> &x, const I<int> &y)
104 #pragma omp parallel shared (i)
107 #pragma omp taskloop lastprivate (i)
108 for (i = x; i < y - 1; ++i)
117 f2 (const I<int> &x, const I<int> &y)
122 #pragma omp taskloop lastprivate (i)
123 for (i = x; i < y - 1; i = 1 - 6 + 7 + i)
128 template <typename T>
130 f3 (const I<int> &x, const I<int> &y)
135 #pragma omp taskloop lastprivate (i)
136 for (i = x + 1000 - 64; i <= y - 10; i++)
141 template <typename T>
143 f4 (const I<int> &x, const I<int> &y)
148 #pragma omp taskloop lastprivate (i)
149 for (i = x + 2000 - 64; i > y + 10; --i)
154 template <typename T>
156 f5 (const I<int> &x, const I<int> &y)
161 #pragma omp taskloop lastprivate (i)
162 for (i = x; i > y + T (6); i--)
167 template <typename T>
169 f6 (const I<int> &x, const I<int> &y)
174 #pragma omp taskloop lastprivate (i)
175 for (i = x - T (7); i > y; i -= T (2))
182 f7 (I<int> i, const I<int> &x, const I<int> &y)
186 #pragma omp taskloop lastprivate (i)
187 for (i = x - 10; i <= y + 10; i += N)
197 #pragma omp parallel shared (i)
199 #pragma omp taskloop lastprivate (i)
200 for (i = j.begin (); i <= j.end () + N; i += 2)
213 #pragma omp taskloop lastprivate (i9)
214 for (i9 = j.begin () + N; i9 <= j.end () - N; i9 = i9 - N)
219 template <typename T, int N>
221 f10 (const I<T> &x, const I<T> &y)
226 #pragma omp taskloop lastprivate (i)
227 for (i = x; i > y; i = i + N)
232 template <typename T, typename U>
234 f11 (T i, const T &x, const T &y)
238 #pragma omp taskloop lastprivate (i)
239 for (i = x + U (2); i <= y + U (1); i = U (2) + U (3) + i)
244 template <typename T>
246 f12 (const T &x, const T &y)
251 #pragma omp taskloop lastprivate (i)
252 for (i = x; i > y; --i)
257 #define check(expr) \
258 for (int i = 0; i < 2000; i++) \
261 if (results[i] != 1) \
265 else if (results[i]) \
273 for (int i = 0; i < 2000; i++)
278 if (*f1 (&a[10], &a[1873]) != 1875)
280 check (i >= 10 && i < 1872);
281 if (*f2 (&a[0], &a[1998]) != 1998)
283 check (i < 1997 && (i & 1) == 0);
284 if (*f3<int> (&a[10], &a[1971]) != 1962)
286 check (i >= 946 && i <= 1961);
287 if (*f4<int> (&a[0], &a[30]) != 40)
289 check (i > 40 && i <= 2000 - 64);
290 if (*f5<short> (&a[1931], &a[17]) != 23)
292 check (i > 23 && i <= 1931);
293 if (*f6<long> (&a[1931], &a[17]) != 16)
295 check (i > 17 && i <= 1924 && (i & 1) == 0);
296 if (*f7<6> (I<int> (), &a[12], &a[1800]) != 1814)
298 check (i >= 2 && i <= 1808 && (i - 2) % 6 == 0);
299 if (*f8<121> (J<int> (&a[14], &a[1803])) != 1926)
301 check (i >= 14 && i <= 1924 && (i & 1) == 0);
302 if (*f9<-3L> (J<int> (&a[27], &a[1761])) != 1767)
304 check (i >= 24 && i <= 1764 && (i % 3) == 0);
305 if (*f10<int, -7> (&a[1939], &a[17]) != 14)
307 check (i >= 21 && i <= 1939 && i % 7 == 0);
308 if (*f11<I<int>, short> (I<int> (), &a[71], &a[1941]) != 1943)
310 check (i >= 73 && i <= 1938 && (i - 73) % 5 == 0);
311 if (*f12<I<int> > (&a[1761], &a[37]) != 37)
313 check (i > 37 && i <= 1761);
314 if (*f10<long, -7> (&b[1939], &b[17]) != 14)
316 check (i >= 21 && i <= 1939 && i % 7 == 0);
317 if (*f11<I<long>, short> (I<long> (), &b[71], &b[1941]) != 1943)
319 check (i >= 73 && i <= 1938 && (i - 73) % 5 == 0);
320 if (*f12<I<long> > (&b[1761], &b[37]) != 37)
322 check (i > 37 && i <= 1761);