Browse Source

strgrp: Shift constant out of loop

Likely this was optimised away, but the code now represents the intent.
Andrew Jeffery 10 years ago
parent
commit
10db5dc0f2
1 changed files with 1 additions and 1 deletions
  1. 1 1
      ccan/strgrp/strgrp.c

+ 1 - 1
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