1 /* Inline Functions for bool-array.{h,cc}.
3 Copyright (C) 1989-1998 Free Software Foundation, Inc.
4 written by Douglas C. Schmidt (schmidt@ics.uci.edu)
6 This file is part of GNU GPERF.
8 GNU GPERF is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 1, or (at your option)
13 GNU GPERF is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU GPERF; see the file COPYING. If not, write to the Free
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
25 //#include "options.h"
29 Bool_Array::Bool_Array (void)
31 T (Trace t ("Bool_Array::Bool_Array");)
33 iteration_number = size = 0;
37 Bool_Array::init (STORAGE_TYPE *buffer, unsigned int s)
39 T (Trace t ("Bool_Array::init");)
42 storage_array = buffer;
43 memset (storage_array, 0, s * sizeof (*storage_array));
45 fprintf (stderr, "\nbool array size = %d, total bytes = %d\n",
46 size, (unsigned int) (size * sizeof (*storage_array)));
50 Bool_Array::find (int index)
52 T (Trace t ("Bool_Array::find");)
53 if (storage_array[index] == iteration_number)
57 storage_array[index] = iteration_number;
63 Bool_Array::reset (void)
65 T (Trace t ("Bool_Array::reset");)
66 /* If we wrap around it's time to zero things out again! However, this only
67 occurs once about every 2^31 or 2^15 iterations, so it should probably
70 if (++iteration_number == 0)
74 fprintf (stderr, "(re-initializing bool_array)...");
78 memset (storage_array, 0, size * sizeof (*storage_array));
81 fprintf (stderr, "done\n");