From 3120e051f11e9bb4fbb1bd94bbbf3100345f9546 Mon Sep 17 00:00:00 2001 From: Solar Designer Date: Wed, 29 May 2024 20:37:48 +0200 Subject: [PATCH] Shuffle external mode: Micro-optimizations relying on our engine 1. Variables are pre-initialized to 0. 2. Order of operations within an expression is specific. Since this external mode is bundled, we'll have opportunity to revise it along with any compiler changes. Meanwhile, it's valid for older versions as well, and this dirty optimization provides a ~1% speedup. --- run/john.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run/john.conf b/run/john.conf index 341940f8ce..4835d27787 100644 --- a/run/john.conf +++ b/run/john.conf @@ -3978,7 +3978,7 @@ void init() max_length = 10; /* Prepare a 12-bit count leading zero table */ - int i; i = -1; + int i; i = 0; while (i++ < 12) { int j; j = 0; while (j < 0x1000) @@ -4025,7 +4025,7 @@ void next() k = id[i]; int mask; mask = prev_unseen; while (k--) - mask &= mask - 1; + mask = mask & --mask; /* Would be UB in C / /* Count how many total indices we skipped */ if ((j = clz[mask & 0xfff]) == 12) { while ((k = clz[(mask >>= 12) & 0xfff]) == 12)