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 () {}
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)
105 #pragma omp taskloop num_tasks(22)
106 for (I<int> i = x; i <= y; i += 6)
111 f2 (const I<int> &x, const I<int> &y)
116 #pragma omp taskloop grainsize(384) private(i)
117 for (i = x; i < y - 1; i = 1 - 6 + 7 + i)
121 template <typename T>
123 f3 (const I<int> &x, const I<int> &y)
127 #pragma omp taskloop default(none) firstprivate (x, y)
128 for (I<int> i = x; i <= y; i = i + 9 - 8)
132 template <typename T>
134 f4 (const I<int> &x, const I<int> &y)
139 #pragma omp taskloop lastprivate(i)
140 for (i = x + 2000 - 64; i > y + 10; --i)
145 f5 (const I<int> &x, const I<int> &y)
150 for (I<int> i = x + 2000 - 64; i > y + 10; i -= 10)
156 f6 (const I<int> &x, const I<int> &y)
161 for (I<int> i = x + 2000 - 64; i > y + 10; i = i - 12 + 2)
170 f7 (I<int> i, const I<int> &x, const I<int> &y)
174 #pragma omp taskloop default(none) firstprivate (x, y)
175 for (i = x - 10; i <= y + 10; i += N)
186 #pragma omp taskloop default(none) num_tasks(*I<int> (j.begin ())) firstprivate (j)
187 for (i = j.begin (); i <= j.end () + N; i += 2)
191 template <typename T, int N>
193 f9 (const I<T> &x, const I<T> &y)
197 #pragma omp taskloop grainsize(163)
198 for (I<T> i = x; i <= y; i = i + N)
202 template <typename T, int N>
204 f10 (const I<T> &x, const I<T> &y)
210 for (i = x; i > y; i = i + N)
214 template <typename T>
216 f11 (const T &x, const T &y)
220 #pragma omp single nowait
221 #pragma omp taskloop nogroup
222 for (T i = x; i <= y; i += 3)
224 #pragma omp single nowait
232 template <typename T>
234 f12 (const T &x, const T &y)
240 for (i = x; i > y; --i)
247 template <typename T>
249 f13 (const T &x, const T &y)
254 for (T i = x; i <= y + N; i += N)
260 f14 (const I<int> &x, const I<int> &y)
265 #pragma omp taskloop lastprivate(i)
266 for (i = x; i < y - 1; i = 1 - 6 + 7 + i)
271 template <typename T>
273 f15 (const I<int> &x, const I<int> &y)
278 #pragma omp taskloop lastprivate(i)
279 for (i = x + 2000 - 64; i > y + 10; --i)
286 f16 (I<int> i, const I<int> &x, const I<int> &y)
290 #pragma omp taskloop lastprivate(i)
291 for (i = x - 10; i <= y + 10; i += N)
303 #pragma omp taskloop lastprivate(i)
304 for (i = j.begin (); i <= j.end () + N; i += 2)
309 template <typename T, int N>
311 f18 (const I<T> &x, const I<T> &y)
316 #pragma omp taskloop lastprivate(i)
317 for (i = x; i > y; i = i + N)
322 template <typename T>
324 f19 (const T &x, const T &y)
329 #pragma omp single nowait
330 #pragma omp taskloop nogroup lastprivate(i)
331 for (i = x; i <= y; i += 3)
333 #pragma omp single nowait
342 template <typename T>
344 f20 (const T &x, const T &y)
349 #pragma omp taskloop lastprivate(i)
350 for (i = x; i > y; --i)
355 #define check(expr) \
356 for (int i = 0; i < 2000; i++) \
359 if (results[i] != 1) \
363 else if (results[i]) \
371 for (int i = 0; i < 2000; i++)
376 f1 (&a[10], &a[1990]);
377 check (i >= 10 && i <= 1990 && (i - 10) % 6 == 0);
378 f2 (&a[0], &a[1999]);
379 check (i < 1998 && (i & 1) == 0);
380 f3<char> (&a[20], &a[1837]);
381 check (i >= 20 && i <= 1837);
382 f4<int> (&a[0], &a[30]);
383 check (i > 40 && i <= 2000 - 64);
385 check (i >= 116 && i <= 2000 - 64 && (i - 116) % 10 == 0);
386 f6<-10> (&a[10], &a[110]);
387 check (i >= 116 && i <= 2000 - 64 && (i - 116) % 10 == 0);
388 f7<6> (I<int> (), &a[12], &a[1800]);
389 check (i >= 2 && i <= 1808 && (i - 2) % 6 == 0);
390 f8<121> (J<int> (&a[14], &a[1803]));
391 check (i >= 14 && i <= 1924 && (i & 1) == 0);
392 f9<int, 7> (&a[33], &a[1967]);
393 check (i >= 33 && i <= 1967 && (i - 33) % 7 == 0);
394 f10<int, -7> (&a[1939], &a[17]);
395 check (i >= 21 && i <= 1939 && (i - 21) % 7 == 0);
396 f11<I<int> > (&a[16], &a[1981]);
397 check (i >= 16 && i <= 1984 && (i - 16) % 3 == 0);
398 f12<I<int> > (&a[1761], &a[37]);
399 check (i > 37 && i <= 1761);
400 K<5>::f13<I<int> > (&a[1], &a[1935]);
401 check (i >= 1 && i <= 1936 && (i - 1) % 5 == 0);
402 if (f14 (&a[0], &a[1999]) != I<int>(&a[1998]))
404 check (i < 1998 && (i & 1) == 0);
405 if (f15<int> (&a[0], &a[30]) != I<int>(&a[40]))
407 check (i > 40 && i <= 2000 - 64);
408 if (f16<6> (I<int> (), &a[12], &a[1800]) != I<int>(&a[1814]))
410 check (i >= 2 && i <= 1808 && (i - 2) % 6 == 0);
411 if (f17<121> (J<int> (&a[14], &a[1803])) != I<int>(&a[1926]))
413 check (i >= 14 && i <= 1924 && (i & 1) == 0);
414 if (f18<int, -7> (&a[1939], &a[17]) != I<int>(&a[14]))
416 check (i >= 21 && i <= 1939 && (i - 21) % 7 == 0);
417 if (f19<I<int> > (&a[16], &a[1981]) != I<int>(&a[1984]))
419 check (i >= 16 && i <= 1984 && (i - 16) % 3 == 0);
420 if (f20<I<int> > (&a[1761], &a[37]) != I<int>(&a[37]))
422 check (i > 37 && i <= 1761);
423 f9<long, 7> (&b[33], &b[1967]);
424 check (i >= 33 && i <= 1967 && (i - 33) % 7 == 0);
425 f10<long, -7> (&b[1939], &b[17]);
426 check (i >= 21 && i <= 1939 && (i - 21) % 7 == 0);
427 f11<I<long> > (&b[16], &b[1981]);
428 check (i >= 16 && i <= 1984 && (i - 16) % 3 == 0);
429 f12<I<long> > (&b[1761], &b[37]);
430 check (i > 37 && i <= 1761);
431 K<5>::f13<I<long> > (&b[1], &b[1935]);
432 check (i >= 1 && i <= 1936 && (i - 1) % 5 == 0);
433 if (f18<long, -7> (&b[1939], &b[17]) != I<long>(&b[14]))
435 check (i >= 21 && i <= 1939 && (i - 21) % 7 == 0);
436 if (f19<I<long> > (&b[16], &b[1981]) != I<long>(&b[1984]))
438 check (i >= 16 && i <= 1984 && (i - 16) % 3 == 0);
439 if (f20<I<long> > (&b[1761], &b[37]) != I<long>(&b[37]))
441 check (i > 37 && i <= 1761);