From d667fd04ba6bd4a8652ae343a7463b2ee456f8a6 Mon Sep 17 00:00:00 2001 From: Kurt Date: Thu, 3 Aug 2017 01:13:12 -0700 Subject: [PATCH] sync final comments yeah I inverted the val decrement to increment temporarily to fix my comment, oops --- PKHeX.Core/Legality/RNG/RNG.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/PKHeX.Core/Legality/RNG/RNG.cs b/PKHeX.Core/Legality/RNG/RNG.cs index 00cc37a86..cedb2b423 100644 --- a/PKHeX.Core/Legality/RNG/RNG.cs +++ b/PKHeX.Core/Legality/RNG/RNG.cs @@ -37,12 +37,14 @@ private void PopulateMeetMiddleArrays() flags[val] = true; low8[val] = (byte)i; - // when calculating the left side, sometimes the low bits might not carry (not considered in calc) - // since LCGs are linear, there are no collisions if we mark the next adjacent with the prior val - // we do this now so that the search only has to access the array once per loop. - ++val; + // when calculating the left side, sometimes the low bits might not carry + // (something not considered in loop's calc?) + // since LCGs are linear (hence the name), there's no values in adjacent cells. (no collisions) + // if we mark the prior adjacent cell, we eliminate the need to check flags twice on each loop. + --val; flags[val] = true; low8[val] = (byte)i; + // now the search only has to access the flags array once per loop. } }