From 686238e6e5cc860111be391b50f89a96a5a74172 Mon Sep 17 00:00:00 2001 From: Aktanusa Date: Mon, 16 Jun 2014 08:57:04 -0400 Subject: [PATCH] Optimize how Chain Stats are calculated --- src/Cache.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Cache.js b/src/Cache.js index 3acebc4..3dd061b 100644 --- a/src/Cache.js +++ b/src/Cache.js @@ -97,7 +97,7 @@ CM.Cache.RemakeChain = function() { CM.Cache.Chain = 0; } else { - count = 1; + count = base > Math.pow(2, 53) ? Math.pow(2, Math.floor(Math.log(base) / Math.log(2)) - 53) : 1; while (base == base + count) { count++; } @@ -110,7 +110,7 @@ CM.Cache.RemakeChain = function() { CM.Cache.ChainFrenzy = 0; } else { - count = 1; + count = CM.Cache.ChainFrenzyReward > Math.pow(2, 53) ? Math.pow(2, Math.floor(Math.log(CM.Cache.ChainFrenzyReward) / Math.log(2)) - 53) : 1; while(CM.Cache.ChainFrenzyReward == CM.Cache.ChainFrenzyReward + count) { count++; }