projects
/
ccan
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d23fb57
)
strgrp: Shift constant out of loop
author
Andrew Jeffery
<andrew@aj.id.au>
Sat, 20 Feb 2016 11:01:43 +0000
(21:31 +1030)
committer
Andrew Jeffery
<andrew@aj.id.au>
Fri, 25 Mar 2016 12:32:37 +0000
(23:02 +1030)
Likely this was optimised away, but the code now represents the intent.
ccan/strgrp/strgrp.c
patch
|
blob
|
history
diff --git
a/ccan/strgrp/strgrp.c
b/ccan/strgrp/strgrp.c
index 00e0bf7152c32e73dc99e5fb454f224fae61852f..85d9765c66f69ca68961bab045a4f49eb48c28fb 100644
(file)
--- a/
ccan/strgrp/strgrp.c
+++ b/
ccan/strgrp/strgrp.c
@@
-147,9
+147,9
@@
lcs(const char *const a, const char *const b) {
int ia, ib;
for (ia = (strlen(a) - 1); ia >= 0; ia--) {
const char iav = a[ia];
+ const int ial = (ia + 1) & 1; // ia last
for (ib = lb - 1; ib >= 0; ib--) {
const char ibv = b[ib];
- const int ial = (ia + 1) & 1; // ia last
const int iac = ia & 1; // ia current
const int ibl = ib + 1; // ib last
// don't need separate "ib current" as it's just ib