mirror of
https://git.savannah.gnu.org/git/gperf.git
synced 2025-12-02 13:09:22 +00:00
Simplify Bool_Array.
This commit is contained in:
@@ -1,5 +1,11 @@
|
|||||||
2002-10-03 Bruno Haible <bruno@clisp.org>
|
2002-10-03 Bruno Haible <bruno@clisp.org>
|
||||||
|
|
||||||
|
* src/bool-array.h (STORAGE_TYPE): Remove type.
|
||||||
|
Use 'unsigned int' instead of STORAGE_TYPE.
|
||||||
|
* src/bool-array.cc: Likewise.
|
||||||
|
* src/bool-array.icc: Likewise.
|
||||||
|
* src/gen-perf.cc: Likewise.
|
||||||
|
|
||||||
* src/new.cc: Remove file.
|
* src/new.cc: Remove file.
|
||||||
* src/Makefile.in (OBJECTS): Remove new.o.
|
* src/Makefile.in (OBJECTS): Remove new.o.
|
||||||
(new.o): Remove rule.
|
(new.o): Remove rule.
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
|
||||||
STORAGE_TYPE * Bool_Array::storage_array;
|
unsigned int * Bool_Array::storage_array;
|
||||||
STORAGE_TYPE Bool_Array::iteration_number;
|
unsigned int Bool_Array::iteration_number;
|
||||||
unsigned int Bool_Array::size;
|
unsigned int Bool_Array::size;
|
||||||
|
|
||||||
/* Prints out debugging diagnostics. */
|
/* Prints out debugging diagnostics. */
|
||||||
|
|||||||
@@ -27,25 +27,17 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||||||
#ifndef bool_array_h
|
#ifndef bool_array_h
|
||||||
#define bool_array_h 1
|
#define bool_array_h 1
|
||||||
|
|
||||||
#ifdef LO_CAL
|
|
||||||
/* If we are on a memory diet then we'll only make these use a limited
|
|
||||||
amount of storage space. */
|
|
||||||
typedef unsigned short STORAGE_TYPE;
|
|
||||||
#else
|
|
||||||
typedef unsigned int STORAGE_TYPE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class Bool_Array
|
class Bool_Array
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
static STORAGE_TYPE *storage_array; /* Initialization of the index space. */
|
static unsigned int *storage_array; /* Initialization of the index space. */
|
||||||
static STORAGE_TYPE iteration_number; /* Keep track of the current iteration. */
|
static unsigned int iteration_number; /* Keep track of the current iteration. */
|
||||||
static unsigned int size; /* Keep track of array size. */
|
static unsigned int size; /* Keep track of array size. */
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Bool_Array (void);
|
Bool_Array (void);
|
||||||
~Bool_Array (void);
|
~Bool_Array (void);
|
||||||
static void init (STORAGE_TYPE *buffer, unsigned int s);
|
static void init (unsigned int *buffer, unsigned int s);
|
||||||
static int find (int hash_value);
|
static int find (int hash_value);
|
||||||
static void reset (void);
|
static void reset (void);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ Bool_Array::Bool_Array (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
INLINE void
|
INLINE void
|
||||||
Bool_Array::init (STORAGE_TYPE *buffer, unsigned int s)
|
Bool_Array::init (unsigned int *buffer, unsigned int s)
|
||||||
{
|
{
|
||||||
size = s;
|
size = s;
|
||||||
iteration_number = 1;
|
iteration_number = 1;
|
||||||
|
|||||||
@@ -275,11 +275,11 @@ int
|
|||||||
Gen_Perf::operator() (void)
|
Gen_Perf::operator() (void)
|
||||||
{
|
{
|
||||||
#if LARGE_STACK_ARRAYS
|
#if LARGE_STACK_ARRAYS
|
||||||
STORAGE_TYPE buffer[max_hash_value + 1];
|
unsigned int buffer[max_hash_value + 1];
|
||||||
#else
|
#else
|
||||||
// Note: we don't use new, because that invokes a custom operator new.
|
// Note: we don't use new, because that invokes a custom operator new.
|
||||||
STORAGE_TYPE *buffer
|
unsigned int *buffer
|
||||||
= (STORAGE_TYPE*) malloc (sizeof(STORAGE_TYPE) * (max_hash_value + 1));
|
= (unsigned int*) malloc (sizeof(unsigned int) * (max_hash_value + 1));
|
||||||
if (buffer == NULL)
|
if (buffer == NULL)
|
||||||
abort ();
|
abort ();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user