osprey-gcc-4.2.0/libiberty/hashtab.c File Reference

#include <sys/types.h>
#include <stdio.h>
#include "libiberty.h"
#include "ansidecl.h"
#include "hashtab.h"

Include dependency graph for hashtab.c:

Go to the source code of this file.

Data Types

type  prime_ent

Defines

#define CHAR_BIT   8
#define htab_size(htab)   ((htab)->size)
#define htab_elements(htab)   ((htab)->n_elements - (htab)->n_deleted)
#define mix(a, b, c)

Functions/Subroutines

static unsigned int higher_prime_index (unsigned long)
static hashval_t htab_mod_1 (hashval_t, hashval_t, hashval_t, int)
static hashval_t htab_mod (hashval_t, htab_t)
static hashval_t htab_mod_m2 (hashval_t, htab_t)
static hashval_t hash_pointer (const void *)
static int eq_pointer (const void *, const void *)
static int htab_expand (htab_t)
static PTRfind_empty_slot_for_expand (htab_t, hashval_t)
static hashval_t hash_pointer (const PTR p)
static int eq_pointer (const PTR p1, const PTR p2)
size_t() htab_size (htab_t htab)
size_t() htab_elements (htab_t htab)
htab_t htab_create_alloc (size_t size, htab_hash hash_f, htab_eq eq_f, htab_del del_f, htab_alloc alloc_f, htab_free free_f)
htab_t htab_create_alloc_ex (size_t size, htab_hash hash_f, htab_eq eq_f, htab_del del_f, void *alloc_arg, htab_alloc_with_arg alloc_f, htab_free_with_arg free_f)
void htab_set_functions_ex (htab_t htab, htab_hash hash_f, htab_eq eq_f, htab_del del_f, PTR alloc_arg, htab_alloc_with_arg alloc_f, htab_free_with_arg free_f)
htab_t htab_create (size_t size, htab_hash hash_f, htab_eq eq_f, htab_del del_f)
htab_t htab_try_create (size_t size, htab_hash hash_f, htab_eq eq_f, htab_del del_f)
void htab_delete (htab_t htab)
void htab_empty (htab_t htab)
PTR htab_find_with_hash (htab_t htab, const PTR element, hashval_t hash)
PTR htab_find (htab_t htab, const PTR element)
PTRhtab_find_slot_with_hash (htab_t htab, const PTR element, hashval_t hash, enum insert_option insert)
PTRhtab_find_slot (htab_t htab, const PTR element, enum insert_option insert)
void htab_remove_elt (htab_t htab, PTR element)
void htab_remove_elt_with_hash (htab_t htab, PTR element, hashval_t hash)
void htab_clear_slot (htab_t htab, PTR *slot)
void htab_traverse_noresize (htab_t htab, htab_trav callback, PTR info)
void htab_traverse (htab_t htab, htab_trav callback, PTR info)
double htab_collisions (htab_t htab)
hashval_t htab_hash_string (const PTR p)
hashval_t iterative_hash (const PTR k_in, register size_t length, register hashval_t initval)

Variables

htab_hash htab_hash_pointer = hash_pointer
htab_eq htab_eq_pointer = eq_pointer
static struct prime_ent const prime_tab []


Define Documentation

#define CHAR_BIT   8

Definition at line 64 of file hashtab.c.

#define htab_elements ( htab   )     ((htab)->n_elements - (htab)->n_deleted)

#define htab_size ( htab   )     ((htab)->size)

#define mix ( a,
b,
c   ) 

Value:

{ \
  a -= b; a -= c; a ^= (c>>13); \
  b -= c; b -= a; b ^= (a<< 8); \
  c -= a; c -= b; c ^= ((b&0xffffffff)>>13); \
  a -= b; a -= c; a ^= ((c&0xffffffff)>>12); \
  b -= c; b -= a; b = (b ^ (a<<16)) & 0xffffffff; \
  c -= a; c -= b; c = (c ^ (b>> 5)) & 0xffffffff; \
  a -= b; a -= c; a = (a ^ (c>> 3)) & 0xffffffff; \
  b -= c; b -= a; b = (b ^ (a<<10)) & 0xffffffff; \
  c -= a; c -= b; c = (c ^ (b>>15)) & 0xffffffff; \
}

Definition at line 854 of file hashtab.c.


Function Documentation

static int eq_pointer ( const PTR  p1,
const PTR  p2 
) [static]

Definition at line 205 of file hashtab.c.

static int eq_pointer ( const void ,
const void  
) [static]

static PTR * find_empty_slot_for_expand ( htab_t  htab,
hashval_t  hash 
) [static]

static hashval_t hash_pointer ( const PTR  p  )  [static]

Definition at line 197 of file hashtab.c.

References long.

static hashval_t hash_pointer ( const void  )  [static]

static unsigned int higher_prime_index ( unsigned long  n  )  [static]

Definition at line 170 of file hashtab.c.

References abort, fprintf(), high, low, and prime_ent::prime.

void htab_clear_slot ( htab_t  htab,
PTR slot 
)

Definition at line 718 of file hashtab.c.

References abort, HTAB_DELETED_ENTRY, HTAB_EMPTY_ENTRY, and htab_size.

double htab_collisions ( htab_t  htab  ) 

Definition at line 772 of file hashtab.c.

References double.

htab_t htab_create ( size_t  size,
htab_hash  hash_f,
htab_eq  eq_f,
htab_del  del_f 
)

Definition at line 372 of file hashtab.c.

References free(), htab_create_alloc(), and xcalloc().

htab_t htab_create_alloc ( size_t  size,
htab_hash  hash_f,
htab_eq  eq_f,
htab_del  del_f,
htab_alloc  alloc_f,
htab_free  free_f 
)

Definition at line 288 of file hashtab.c.

References higher_prime_index(), NULL, prime_ent::prime, PTR, and result.

htab_t htab_create_alloc_ex ( size_t  size,
htab_hash  hash_f,
htab_eq  eq_f,
htab_del  del_f,
void alloc_arg,
htab_alloc_with_arg  alloc_f,
htab_free_with_arg  free_f 
)

Definition at line 321 of file hashtab.c.

References higher_prime_index(), NULL, prime_ent::prime, PTR, and result.

void htab_delete ( htab_t  htab  ) 

Definition at line 387 of file hashtab.c.

References DELETED_ENTRY, EMPTY_ENTRY, HTAB_DELETED_ENTRY, HTAB_EMPTY_ENTRY, htab_size, i, NULL, PTR, and size.

size_t() htab_elements ( htab_t  htab  )  [inline]

Definition at line 231 of file hashtab.c.

References htab_elements.

void htab_empty ( htab_t  htab  ) 

static int htab_expand ( htab_t  htab  )  [static]

PTR htab_find ( htab_t  htab,
const PTR  element 
)

Definition at line 594 of file hashtab.c.

References htab_find_with_hash().

PTR* htab_find_slot ( htab_t  htab,
const PTR  element,
enum insert_option  insert 
)

Definition at line 676 of file hashtab.c.

References htab_find_slot_with_hash().

PTR* htab_find_slot_with_hash ( htab_t  htab,
const PTR  element,
hashval_t  hash,
enum insert_option  insert 
)

PTR htab_find_with_hash ( htab_t  htab,
const PTR  element,
hashval_t  hash 
)

Definition at line 560 of file hashtab.c.

References HTAB_DELETED_ENTRY, HTAB_EMPTY_ENTRY, htab_mod(), htab_mod_m2(), htab_size, index(), PTR, and size.

hashval_t htab_hash_string ( const PTR  p  ) 

Definition at line 806 of file hashtab.c.

References c, r, and str.

static hashval_t htab_mod ( hashval_t  hash,
htab_t  htab 
) [inline, static]

Definition at line 267 of file hashtab.c.

References htab_mod_1(), prime_ent::inv, p, prime_ent::prime, and prime_ent::shift.

static hashval_t htab_mod_1 ( hashval_t  x,
hashval_t  y,
hashval_t  inv,
int  shift 
) [inline, static]

Definition at line 239 of file hashtab.c.

References __extension__, CHAR_BIT, q, r, t1, t2, t3, and t4.

static hashval_t htab_mod_m2 ( hashval_t  hash,
htab_t  htab 
) [inline, static]

Definition at line 276 of file hashtab.c.

References htab_mod_1(), prime_ent::inv_m2, p, prime_ent::prime, and prime_ent::shift.

void htab_remove_elt ( htab_t  htab,
PTR  element 
)

Definition at line 687 of file hashtab.c.

References htab_remove_elt_with_hash().

void htab_remove_elt_with_hash ( htab_t  htab,
PTR  element,
hashval_t  hash 
)

Definition at line 698 of file hashtab.c.

References HTAB_DELETED_ENTRY, HTAB_EMPTY_ENTRY, htab_find_slot_with_hash(), NO_INSERT, and PTR.

void htab_set_functions_ex ( htab_t  htab,
htab_hash  hash_f,
htab_eq  eq_f,
htab_del  del_f,
PTR  alloc_arg,
htab_alloc_with_arg  alloc_f,
htab_free_with_arg  free_f 
)

Definition at line 356 of file hashtab.c.

size_t() htab_size ( htab_t  htab  )  [inline]

Definition at line 221 of file hashtab.c.

References htab_size.

void htab_traverse ( htab_t  htab,
htab_trav  callback,
PTR  info 
)

Definition at line 760 of file hashtab.c.

References htab_elements, htab_expand(), htab_size, and htab_traverse_noresize().

void htab_traverse_noresize ( htab_t  htab,
htab_trav  callback,
PTR  info 
)

Definition at line 737 of file hashtab.c.

References HTAB_DELETED_ENTRY, HTAB_EMPTY_ENTRY, htab_size, PTR, and x.

htab_t htab_try_create ( size_t  size,
htab_hash  hash_f,
htab_eq  eq_f,
htab_del  del_f 
)

Definition at line 378 of file hashtab.c.

References calloc(), free(), and htab_create_alloc().

hashval_t iterative_hash ( const PTR  k_in,
register size_t  length,
register hashval_t  initval 
)

Definition at line 896 of file hashtab.c.

References a, b, c, len, mix, and size_t.


Variable Documentation

htab_eq htab_eq_pointer = eq_pointer

htab_hash htab_hash_pointer = hash_pointer

struct prime_ent const prime_tab[] [static]

Definition at line 132 of file hashtab.c.


Generated on Wed Apr 8 15:02:57 2009 for Open64 by  doxygen 1.5.6