From: wessels <> Date: Wed, 22 Jan 1997 11:41:12 +0000 (+0000) Subject: simplify ReferenceAge calculations X-Git-Tag: SQUID_3_0_PRE1~5179 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=66f9e42138fef877fb126c22c050ac3d5bf0cc97;p=thirdparty%2Fsquid.git simplify ReferenceAge calculations --- diff --git a/src/store.cc b/src/store.cc index feacc442b1..81e5e645a7 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,6 +1,6 @@ /* - * $Id: store.cc,v 1.199 1997/01/20 19:24:33 wessels Exp $ + * $Id: store.cc,v 1.200 1997/01/22 04:41:12 wessels Exp $ * * DEBUG: section 20 Storeage Manager * AUTHOR: Harvest Derived @@ -2799,19 +2799,14 @@ storeCheckExpired(const StoreEntry * e) time_t storeExpiredReferenceAge(void) { - int half; double x; double z; time_t age; if (Config.referenceAge > -1) return Config.referenceAge; - half = (store_swap_high >> 1) + (store_swap_low >> 1); - x = (double) (half - store_swap_size) / (store_swap_high - half); - if (x < -1.0) - x = -1.0; - else if (x > 1.0) - x = 1.0; - z = pow(724.0, (x + 1.0)); /* minutes [1:525600] */ + x = 2.0 * (store_swap_high - store_swap_size) / (store_swap_high - store_swap_low); + x = x < 0.0 ? 0.0 : x > 2.0 ? 2.0 : x; + z = pow(724.0, x); /* minutes [1:525600] */ age = (time_t) (z * 60.0); if (age < 60) age = 60;