PIPS
|
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <limits.h>
#include "linear_assert.h"
#include "boolean.h"
Go to the source code of this file.
Data Structures | |
struct | paire |
struct | linear_hashtable_st |
hidden structure to store the hashtable. More... | |
Macros | |
#define | debug_assert(a) |
expected headers: the internal structure does not need to be available! struct linear_hashtable_st; typedef struct linear_hashtable_st * linear_hashtable_pt; More... | |
#define | debug_assert_coherent(h) debug_assert(linear_hashtable_coherent_p(h)) |
#define | FREE_CHUNK ((void *) 0) |
#define | EMPTIED_CHUNK ((void *) -1) |
#define | HASHTABLE_INITIAL_SIZE (17) |
size of internal table. More... | |
Typedefs | |
typedef struct linear_hashtable_st * | linear_hashtable_pt |
hidden structure to store the hashtable. More... | |
#define debug_assert | ( | a | ) |
expected headers: the internal structure does not need to be available! struct linear_hashtable_st; typedef struct linear_hashtable_st * linear_hashtable_pt;
#define LINEAR_HASHTABLE_DEBUG 1
Definition at line 50 of file hashpointer.c.
#define debug_assert_coherent | ( | h | ) | debug_assert(linear_hashtable_coherent_p(h)) |
Definition at line 53 of file hashpointer.c.
#define EMPTIED_CHUNK ((void *) -1) |
Definition at line 56 of file hashpointer.c.
#define FREE_CHUNK ((void *) 0) |
Definition at line 55 of file hashpointer.c.
#define HASHTABLE_INITIAL_SIZE (17) |
size of internal table.
should be a not too big odd number.
Definition at line 160 of file hashpointer.c.
typedef struct linear_hashtable_st * linear_hashtable_pt |
hidden structure to store the hashtable.
|
static |
returns the location to put or get k in h.
should not loop to put!
if !loop and toget, the initial index is returned. it is checked against the expected key before returning the value.
Definition at line 75 of file hashpointer.c.
References assert, linear_hashtable_st::contents, debug_assert, EMPTIED_CHUNK, FREE_CHUNK, paire::key, linear_hashtable_st::size, and uintptr_t.
Referenced by linear_hashtable_coherent_p(), linear_hashtable_extend(), linear_hashtable_get(), linear_hashtable_internal_put(), linear_hashtable_isin(), linear_hashtable_print(), and linear_hashtable_remove().
bool linear_hashtable_coherent_p | ( | linear_hashtable_pt | h | ) |
check hashtable coherency
coherent size/nitems.
check number of item stored.
check key index
Definition at line 128 of file hashpointer.c.
References linear_hashtable_st::contents, EMPTIED_CHUNK, FREE_CHUNK, paire::key, key_location(), linear_hashtable_st::nitems, linear_hashtable_st::size, and uintptr_t.
void linear_hashtable_dump | ( | linear_hashtable_pt | h | ) |
convenient function to be called from gdb.
Definition at line 122 of file hashpointer.c.
References linear_hashtable_print().
|
static |
check malloc
the expected number of items was moved.
Definition at line 197 of file hashpointer.c.
References assert, linear_hashtable_st::contents, debug_assert_coherent, EMPTIED_CHUNK, free(), FREE_CHUNK, paire::key, key_location(), malloc(), linear_hashtable_st::nitems, linear_hashtable_st::size, uintptr_t, and paire::val.
Referenced by linear_hashtable_internal_put().
void linear_hashtable_free | ( | linear_hashtable_pt | h | ) |
destructor
Definition at line 189 of file hashpointer.c.
References linear_hashtable_st::contents, debug_assert_coherent, and free().
Referenced by base_append(), base_included_p(), base_union(), fortran_data_to_prec_for_variables(), sc_to_minimal_basis(), transitive_closure_from_two_bases(), and vect_check().
void* linear_hashtable_get | ( | linear_hashtable_pt | h, |
void * | k | ||
) |
Definition at line 293 of file hashpointer.c.
References linear_hashtable_st::contents, FREE_CHUNK, paire::key, key_location(), and paire::val.
|
static |
no special values!
50% limit to extend
is it already in?
no
where should it be put?
if it is in, the once option must not be set
update number of stored items
Definition at line 236 of file hashpointer.c.
References assert, linear_hashtable_st::contents, debug_assert_coherent, EMPTIED_CHUNK, FREE_CHUNK, paire::key, key_location(), linear_hashtable_extend(), linear_hashtable_st::nitems, linear_hashtable_st::size, and paire::val.
Referenced by linear_hashtable_put(), and linear_hashtable_put_once().
bool linear_hashtable_isin | ( | linear_hashtable_pt | h, |
void * | k | ||
) |
Definition at line 273 of file hashpointer.c.
References linear_hashtable_st::contents, paire::key, and key_location().
Referenced by base_append(), base_included_p(), base_to_set(), base_union(), contains_variables(), fortran_data_to_prec_for_variables(), sc_to_minimal_basis(), and vect_check().
linear_hashtable_pt linear_hashtable_make | ( | void | ) |
constructor.
returns a newly allocated hashtable.
check malloc
check malloc
Definition at line 165 of file hashpointer.c.
References assert, linear_hashtable_st::contents, debug_assert_coherent, FREE_CHUNK, HASHTABLE_INITIAL_SIZE, paire::key, malloc(), linear_hashtable_st::nitems, linear_hashtable_st::size, and paire::val.
Referenced by base_append(), base_included_p(), base_union(), fortran_data_to_prec_for_variables(), sc_to_minimal_basis(), transitive_closure_from_two_bases(), and vect_check().
int linear_hashtable_nitems | ( | linear_hashtable_pt | h | ) |
Definition at line 299 of file hashpointer.c.
References linear_hashtable_st::nitems.
|
static |
Definition at line 102 of file hashpointer.c.
References linear_hashtable_st::contents, EMPTIED_CHUNK, fprintf(), FREE_CHUNK, paire::key, key_location(), linear_hashtable_st::nitems, linear_hashtable_st::size, uintptr_t, and paire::val.
Referenced by linear_hashtable_dump().
void linear_hashtable_put | ( | linear_hashtable_pt | h, |
void * | k, | ||
void * | v | ||
) |
Definition at line 263 of file hashpointer.c.
References linear_hashtable_internal_put().
Referenced by base_to_set(), and vect_check().
void linear_hashtable_put_once | ( | linear_hashtable_pt | h, |
void * | k, | ||
void * | v | ||
) |
Definition at line 268 of file hashpointer.c.
References linear_hashtable_internal_put().
Referenced by base_append(), base_included_p(), base_union(), fortran_data_to_prec_for_variables(), and sc_to_minimal_basis().
bool linear_hashtable_remove | ( | linear_hashtable_pt | h, |
void * | k | ||
) |
Definition at line 278 of file hashpointer.c.
References linear_hashtable_st::contents, EMPTIED_CHUNK, FREE_CHUNK, paire::key, key_location(), linear_hashtable_st::nitems, and paire::val.