Skip to content

Commit 9a8a452

Browse files
committed
Replace DO with std::mismatch
1 parent 742bb8e commit 9a8a452

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

jsrc/verbs/dyadic/take_drop.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11

2+
#include <algorithm>
3+
#include <iterator>
4+
25
#include "array.hpp"
36

47
/** @file */
@@ -44,7 +47,7 @@ static A
4447
jttks(J jt, A a, A w) {
4548
PROLOG(0092);
4649
A a1, q, x, y, z;
47-
B b, c;
50+
B c;
4851
I an, m, r, *s, *u, *v;
4952
P *wp, *zp;
5053
an = AN(a);
@@ -67,8 +70,9 @@ jttks(J jt, A a, A w) {
6770
u = AV(a);
6871
RZ(y = jtfrom(jt, q, shape(jt, w)));
6972
s = AV(y);
70-
b = 0;
71-
DO(r - m, if ((b = (u[i + m] != s[i + m]))) break;);
73+
74+
auto const b = std::mismatch(u + m, u + r, s + m).first != u + r;
75+
7276
c = 0;
7377
DO(m, if ((c = (u[i] != s[i]))) break;);
7478
if (b) {

0 commit comments

Comments
 (0)