From 10db5dc0f2038a317d40cbf216f26684163dcf84 Mon Sep 17 00:00:00 2001 From: Andrew Jeffery Date: Sat, 20 Feb 2016 21:31:43 +1030 Subject: [PATCH] strgrp: Shift constant out of loop Likely this was optimised away, but the code now represents the intent. --- ccan/strgrp/strgrp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ccan/strgrp/strgrp.c b/ccan/strgrp/strgrp.c index 00e0bf71..85d9765c 100644 --- 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 -- 2.39.2