This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

simple libiberty/hashtab.c changes


Okay for mainline?

2005-02-24 Ben Elliston <bje@au.ibm.com>

        * hashtab.c (htab_find): Make function documentation clearer.
        (ceil_log2): Remove #if 0'd code.
        (choose_multiplier): Likewise.

Index: hashtab.c
===================================================================
RCS file: /home/bje/src-cvs/src/libiberty/hashtab.c,v
retrieving revision 1.27
diff -u -p -r1.27 hashtab.c
--- hashtab.c   22 Apr 2004 18:39:03 -0000      1.27
+++ hashtab.c   24 Feb 2005 05:23:21 -0000
@@ -97,39 +97,6 @@ htab_eq htab_eq_pointer = eq_pointer;
    For the record, here's the function that computed the table; it's a
    vastly simplified version of the function of the same name from
gcc.  */

-#if 0
-unsigned int
-ceil_log2 (unsigned int x)
-{
-  int i;
-  for (i = 31; i >= 0 ; --i)
-    if (x > (1u << i))
-      return i+1;
-  abort ();
-}
--unsigned int
-choose_multiplier (unsigned int d, unsigned int *mlp, unsigned char
*shiftp)
-{
-  unsigned long long mhigh;
-  double nx;
-  int lgup, post_shift;
-  int pow, pow2;
-  int n = 32, precision = 32;
-
-  lgup = ceil_log2 (d);
-  pow = n + lgup;
-  pow2 = n + lgup - precision;
-
-  nx = ldexp (1.0, pow) + ldexp (1.0, pow2);
-  mhigh = nx / d;
-
-  *shiftp = lgup - 1;
-  *mlp = mhigh;
-  return mhigh >> 32;
-}
-#endif
-
 struct prime_ent
 {
   hashval_t prime;
@@ -621,9 +588,9 @@ htab_find (htab, element)

 /* This function searches for a hash table slot containing an entry
    equal to the given element.  To delete an entry, call this with
-   INSERT = 0, then call htab_clear_slot on the slot returned (possibly
+   NO_INSERT, then call htab_clear_slot on the slot returned (possibly
    after doing some checks).  To insert an entry, call this with
-   INSERT = 1, then write the value you want into the returned slot.
+   INSERT, then write the value you want into the returned slot.
    When inserting an entry, NULL may be returned if memory allocation
    fails.  */

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]