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)
103 #pragma omp parallel for
104 for (I<int> i = x; y >= i; i += 6)
109 f2 (const I<int> &x, const I<int> &y)
112 #pragma omp parallel for private(i)
113 for (i = x; y - 1 > i; i = 1 - 6 + 7 + i)
117 template <typename T>
119 f3 (const I<int> &x, const I<int> &y)
121 #pragma omp parallel for
122 for (I<int> i = x; y >= i; i = i + 9 - 8)
126 template <typename T>
128 f4 (const I<int> &x, const I<int> &y)
131 #pragma omp parallel for lastprivate(i)
132 for (i = x + 2000 - 64; y + 10 < i; --i)
137 f5 (const I<int> &x, const I<int> &y)
139 #pragma omp parallel for
140 for (I<int> i = x + 2000 - 64; y + 10 < i; i -= 10)
146 f6 (const I<int> &x, const I<int> &y)
148 #pragma omp parallel for
149 for (I<int> i = x + 2000 - 64; y + 10 < i; i = i - 12 + 2)
158 f7 (I<int> i, const I<int> &x, const I<int> &y)
160 #pragma omp parallel for
161 for (i = x - 10; y + 10 >= i; i += N)
170 #pragma omp parallel for
171 for (i = j.begin (); j.end () + N >= i; i += 2)
175 template <typename T, int N>
177 f9 (const I<T> &x, const I<T> &y)
179 #pragma omp parallel for
180 for (I<T> i = x; y >= i; i = i + N)
184 template <typename T, int N>
186 f10 (const I<T> &x, const I<T> &y)
189 #pragma omp parallel for
190 for (i = x; y < i; i = i + N)
194 template <typename T>
196 f11 (const T &x, const T &y)
200 #pragma omp for nowait
201 for (T i = x; y >= i; i += 3)
211 template <typename T>
213 f12 (const T &x, const T &y)
216 #pragma omp parallel for
217 for (i = x; y < i; --i)
224 template <typename T>
226 f13 (const T &x, const T &y)
228 #pragma omp parallel for
229 for (T i = x; y + N >= i; i += N)
234 #define check(expr) \
235 for (int i = 0; i < 2000; i++) \
238 if (results[i] != 1) \
242 else if (results[i]) \
250 for (int i = 0; i < 2000; i++)
255 f1 (&a[10], &a[1990]);
256 check (i >= 10 && i <= 1990 && (i - 10) % 6 == 0);
257 f2 (&a[0], &a[1999]);
258 check (i < 1998 && (i & 1) == 0);
259 f3<char> (&a[20], &a[1837]);
260 check (i >= 20 && i <= 1837);
261 f4<int> (&a[0], &a[30]);
262 check (i > 40 && i <= 2000 - 64);
264 check (i >= 116 && i <= 2000 - 64 && (i - 116) % 10 == 0);
265 f6<-10> (&a[10], &a[110]);
266 check (i >= 116 && i <= 2000 - 64 && (i - 116) % 10 == 0);
267 f7<6> (I<int> (), &a[12], &a[1800]);
268 check (i >= 2 && i <= 1808 && (i - 2) % 6 == 0);
269 f8<121> (J<int> (&a[14], &a[1803]));
270 check (i >= 14 && i <= 1924 && (i & 1) == 0);
271 f9<int, 7> (&a[33], &a[1967]);
272 check (i >= 33 && i <= 1967 && (i - 33) % 7 == 0);
273 f10<int, -7> (&a[1939], &a[17]);
274 check (i >= 21 && i <= 1939 && (i - 21) % 7 == 0);
275 f11<I<int> > (&a[16], &a[1981]);
276 check (i >= 16 && i <= 1984 && (i - 16) % 3 == 0);
277 f12<I<int> > (&a[1761], &a[37]);
278 check (i > 37 && i <= 1761);
279 K<5>::f13<I<int> > (&a[1], &a[1935]);
280 check (i >= 1 && i <= 1936 && (i - 1) % 5 == 0);
281 f9<long, 7> (&b[33], &b[1967]);
282 check (i >= 33 && i <= 1967 && (i - 33) % 7 == 0);
283 f10<long, -7> (&b[1939], &b[17]);
284 check (i >= 21 && i <= 1939 && (i - 21) % 7 == 0);
285 f11<I<long> > (&b[16], &b[1981]);
286 check (i >= 16 && i <= 1984 && (i - 16) % 3 == 0);
287 f12<I<long> > (&b[1761], &b[37]);
288 check (i > 37 && i <= 1761);
289 K<5>::f13<I<long> > (&b[1], &b[1935]);
290 check (i >= 1 && i <= 1936 && (i - 1) % 5 == 0);