10 typedef typename std::basic_string<T>::iterator iterator;
11 J(const iterator &x, const iterator &y) : b (x), e (y) {}
12 const iterator &begin ();
13 const iterator &end ();
19 const typename std::basic_string<T>::iterator &J<T>::begin () { return b; }
21 const typename std::basic_string<T>::iterator &J<T>::end () { return e; }
27 if (*i < L'a' || *i >= L'a' + 2000)
33 f1 (const std::basic_string<wchar_t>::iterator &x,
34 const std::basic_string<wchar_t>::iterator &y)
36 #pragma omp parallel for
37 for (std::basic_string<wchar_t>::iterator i = x; i <= y; i += 6)
42 f2 (const std::basic_string<wchar_t>::iterator &x,
43 const std::basic_string<wchar_t>::iterator &y)
45 std::basic_string<wchar_t>::iterator i;
46 #pragma omp parallel for private(i)
47 for (i = x; i < y - 1; i = 1 - 6 + 7 + i)
53 f3 (const std::basic_string<wchar_t>::iterator &x,
54 const std::basic_string<wchar_t>::iterator &y)
56 #pragma omp parallel for schedule (dynamic, 6)
57 for (std::basic_string<wchar_t>::iterator i = x; i <= y; i = i + 9 - 8)
63 f4 (const std::basic_string<wchar_t>::iterator &x,
64 const std::basic_string<wchar_t>::iterator &y)
66 std::basic_string<wchar_t>::iterator i;
67 #pragma omp parallel for lastprivate(i)
68 for (i = x + 2000 - 64; i > y + 10; --i)
73 f5 (const std::basic_string<wchar_t>::iterator &x,
74 const std::basic_string<wchar_t>::iterator &y)
76 #pragma omp parallel for schedule (static, 10)
77 for (std::basic_string<wchar_t>::iterator i = x + 2000 - 64;
84 f6 (const std::basic_string<wchar_t>::iterator &x,
85 const std::basic_string<wchar_t>::iterator &y)
87 #pragma omp parallel for schedule (runtime)
88 for (std::basic_string<wchar_t>::iterator i = x + 2000 - 64;
89 i > y + 10; i = i - 12 + 2)
91 std::basic_string<wchar_t>::iterator j = i + N;
98 f7 (std::basic_string<wchar_t>::iterator i,
99 const std::basic_string<wchar_t>::iterator &x,
100 const std::basic_string<wchar_t>::iterator &y)
102 #pragma omp parallel for schedule (dynamic, 6)
103 for (i = x - 10; i <= y + 10; i += N)
111 std::basic_string<wchar_t>::iterator i;
112 #pragma omp parallel for schedule (dynamic, 40)
113 for (i = j.begin (); i <= j.end () + N; i += 2)
117 template <typename T, int N>
119 f9 (const typename std::basic_string<T>::iterator &x,
120 const typename std::basic_string<T>::iterator &y)
122 #pragma omp parallel for schedule (static, 25)
123 for (typename std::basic_string<T>::iterator i = x; i <= y; i = i + N)
127 template <typename T, int N>
129 f10 (const typename std::basic_string<T>::iterator &x,
130 const typename std::basic_string<T>::iterator &y)
132 typename std::basic_string<T>::iterator i;
133 #pragma omp parallel for
134 for (i = x; i > y; i = i + N)
138 template <typename T>
140 f11 (const T &x, const T &y)
144 #pragma omp for nowait schedule (static, 2)
145 for (T i = x; i <= y; i += 3)
155 template <typename T>
157 f12 (const T &x, const T &y)
160 #pragma omp parallel for schedule (dynamic, 130)
161 for (i = x; i > y; --i)
168 template <typename T>
170 f13 (const T &x, const T &y)
172 #pragma omp parallel for schedule (runtime)
173 for (T i = x; i <= y + N; i += N)
178 #define check(expr) \
179 for (int i = 0; i < 2000; i++) \
182 if (a[i] != L'a' + i + 1) \
186 else if (a[i] != L'a' + i) \
192 std::basic_string<wchar_t> a = L"";
193 for (int i = 0; i < 2000; i++)
195 f1 (a.begin () + 10, a.begin () + 1990);
196 check (i >= 10 && i <= 1990 && (i - 10) % 6 == 0);
197 f2 (a.begin () + 0, a.begin () + 1999);
198 check (i < 1998 && (i & 1) == 0);
199 f3<char> (a.begin () + 20, a.begin () + 1837);
200 check (i >= 20 && i <= 1837);
201 f4<int> (a.begin () + 0, a.begin () + 30);
202 check (i > 40 && i <= 2000 - 64);
203 f5 (a.begin () + 0, a.begin () + 100);
204 check (i >= 116 && i <= 2000 - 64 && (i - 116) % 10 == 0);
205 f6<-10> (a.begin () + 10, a.begin () + 110);
206 check (i >= 116 && i <= 2000 - 64 && (i - 116) % 10 == 0);
207 f7<6> (std::basic_string<wchar_t>::iterator (), a.begin () + 12,
209 check (i >= 2 && i <= 1808 && (i - 2) % 6 == 0);
210 f8<121> (J<wchar_t> (a.begin () + 14, a.begin () + 1803));
211 check (i >= 14 && i <= 1924 && (i & 1) == 0);
212 f9<wchar_t, 7> (a.begin () + 33, a.begin () + 1967);
213 check (i >= 33 && i <= 1967 && (i - 33) % 7 == 0);
214 f10<wchar_t, -7> (a.begin () + 1939, a.begin () + 17);
215 check (i >= 21 && i <= 1939 && (i - 21) % 7 == 0);
216 f11<std::basic_string<wchar_t>::iterator > (a.begin () + 16,
218 check (i >= 16 && i <= 1984 && (i - 16) % 3 == 0);
219 f12<std::basic_string<wchar_t>::iterator > (a.begin () + 1761,
221 check (i > 37 && i <= 1761);
222 K<5>::f13<std::basic_string<wchar_t>::iterator > (a.begin () + 1,
224 check (i >= 1 && i <= 1936 && (i - 1) % 5 == 0);