httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bri...@apache.org
Subject cvs commit: httpd-2.0/server util_time.c
Date Thu, 11 Jul 2002 16:08:58 GMT
brianp      2002/07/11 09:08:58

  Modified:    include  util_time.h
               server   util_time.c
  Log:
  Strength-reduce a 64-bit "mod 16" operation to "& 0xf" in cached_explode()
  just in case the compiler doesn't do it for us
  
  Revision  Changes    Path
  1.7       +1 -0      httpd-2.0/include/util_time.h
  
  Index: util_time.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/util_time.h,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- util_time.h	21 Apr 2002 07:55:50 -0000	1.6
  +++ util_time.h	11 Jul 2002 16:08:58 -0000	1.7
  @@ -70,6 +70,7 @@
   
   /* Maximum delta from the current time, in seconds, for a past time
    * to qualify as "recent" for use in the ap_explode_recent_*() functions:
  + * (Must be a power of two minus one!)
    */
   #define AP_TIME_RECENT_THRESHOLD 15
   
  
  
  
  1.11      +9 -1      httpd-2.0/server/util_time.c
  
  Index: util_time.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/util_time.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- util_time.c	4 Jul 2002 22:40:06 -0000	1.10
  +++ util_time.c	11 Jul 2002 16:08:58 -0000	1.11
  @@ -67,6 +67,14 @@
   /* the "+ 1" is for the current second: */
   #define TIME_CACHE_SIZE (AP_TIME_RECENT_THRESHOLD + 1)
   
  +/* Note that AP_TIME_RECENT_THRESHOLD is defined to
  + * be a power of two minus one in util_time.h, so that
  + * we can replace a modulo operation with a bitwise AND
  + * when hashing items into a cache of size
  + * AP_TIME_RECENT_THRESHOLD+1
  + */
  +#define TIME_CACHE_MASK (AP_TIME_RECENT_THRESHOLD)
  +
   static struct exploded_time_cache_element exploded_cache_localtime[TIME_CACHE_SIZE];
   static struct exploded_time_cache_element exploded_cache_gmt[TIME_CACHE_SIZE];
   
  @@ -77,7 +85,7 @@
   {
       apr_int64_t seconds = apr_time_sec(t);
       struct exploded_time_cache_element *cache_element =
  -        &(cache[seconds % TIME_CACHE_SIZE]);
  +        &(cache[seconds & TIME_CACHE_MASK]);
       struct exploded_time_cache_element cache_element_snapshot;
   
       /* The cache is implemented as a ring buffer.  Each second,
  
  
  

Mime
View raw message