X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/cea532473773fd64de45002a03a507c794e5b1e1..222342aa6708814c01a63ff7d568209d3705ff47:/lib/vbitset.c?ds=sidebyside
diff --git a/lib/vbitset.c b/lib/vbitset.c
index 8e402408..8c5fd964 100644
--- a/lib/vbitset.c
+++ b/lib/vbitset.c
@@ -1,10 +1,12 @@
/* Variable array bitsets.
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+
+ Copyright (C) 2002-2006, 2009-2012 Free Software Foundation, Inc.
+
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -13,51 +15,45 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
+ along with this program. If not, see . */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include
#include "vbitset.h"
+
#include
#include
/* This file implements variable size bitsets stored as a variable
length array of words. Any unused bits in the last word must be
- zero.
+ zero.
Note that binary or ternary operations assume that each bitset operand
has the same size.
*/
-static void vbitset_unused_clear PARAMS ((bitset));
+static void vbitset_unused_clear (bitset);
-static void vbitset_set PARAMS ((bitset, bitset_bindex));
-static void vbitset_reset PARAMS ((bitset, bitset_bindex));
-static bool vbitset_test PARAMS ((bitset, bitset_bindex));
-static bitset_bindex vbitset_list PARAMS ((bitset, bitset_bindex *,
- bitset_bindex,
- bitset_bindex *));
-static bitset_bindex vbitset_list_reverse PARAMS ((bitset, bitset_bindex *,
- bitset_bindex,
- bitset_bindex *));
+static void vbitset_set (bitset, bitset_bindex);
+static void vbitset_reset (bitset, bitset_bindex);
+static bool vbitset_test (bitset, bitset_bindex);
+static bitset_bindex vbitset_list (bitset, bitset_bindex *,
+ bitset_bindex, bitset_bindex *);
+static bitset_bindex vbitset_list_reverse (bitset, bitset_bindex *,
+ bitset_bindex, bitset_bindex *);
#define VBITSET_N_WORDS(N) (((N) + BITSET_WORD_BITS - 1) / BITSET_WORD_BITS)
#define VBITSET_WORDS(X) ((X)->b.cdata)
#define VBITSET_SIZE(X) ((X)->b.csize)
#define VBITSET_ASIZE(X) ((X)->v.size)
-
+#undef min
+#undef max
#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))
static bitset_bindex
-vbitset_resize (src, n_bits)
- bitset src;
- bitset_bindex n_bits;
+vbitset_resize (bitset src, bitset_bindex n_bits)
{
bitset_windex oldsize;
bitset_windex newsize;
@@ -72,39 +68,39 @@ vbitset_resize (src, n_bits)
{
bitset_windex size;
- /* The bitset needs to grow. If we already have enough memory
- allocated, then just zero what we need. */
+ /* The bitset needs to grow. If we already have enough memory
+ allocated, then just zero what we need. */
if (newsize > VBITSET_ASIZE (src))
- {
- /* We need to allocate more memory. When oldsize is
- non-zero this means that we are changing the size, so
- grow the bitset 25% larger than requested to reduce
- number of reallocations. */
-
- if (oldsize == 0)
- size = newsize;
- else
- size = newsize + newsize / 4;
-
- VBITSET_WORDS (src)
- = realloc (VBITSET_WORDS (src), size * sizeof (bitset_word));
- VBITSET_ASIZE (src) = size;
- }
-
- memset (VBITSET_WORDS (src) + oldsize, 0,
- (newsize - oldsize) * sizeof (bitset_word));
+ {
+ /* We need to allocate more memory. When oldsize is
+ non-zero this means that we are changing the size, so
+ grow the bitset 25% larger than requested to reduce
+ number of reallocations. */
+
+ if (oldsize == 0)
+ size = newsize;
+ else
+ size = newsize + newsize / 4;
+
+ VBITSET_WORDS (src)
+ = realloc (VBITSET_WORDS (src), size * sizeof (bitset_word));
+ VBITSET_ASIZE (src) = size;
+ }
+
+ memset (VBITSET_WORDS (src) + oldsize, 0,
+ (newsize - oldsize) * sizeof (bitset_word));
VBITSET_SIZE (src) = newsize;
}
else
{
/* The bitset needs to shrink. There's no point deallocating
- the memory unless it is shrinking by a reasonable amount. */
+ the memory unless it is shrinking by a reasonable amount. */
if ((oldsize - newsize) >= oldsize / 2)
- {
- VBITSET_WORDS (src)
- = realloc (VBITSET_WORDS (src), newsize * sizeof (bitset_word));
- VBITSET_ASIZE (src) = newsize;
- }
+ {
+ VBITSET_WORDS (src)
+ = realloc (VBITSET_WORDS (src), newsize * sizeof (bitset_word));
+ VBITSET_ASIZE (src) = newsize;
+ }
/* Need to prune any excess bits. FIXME. */
@@ -200,18 +196,18 @@ vbitset_list_reverse (src, list, num, next)
word = srcp[windex] << (BITSET_WORD_BITS - 1 - bitcnt);
for (; word; bitcnt--)
- {
- if (word & BITSET_MSB)
- {
- list[count++] = bitoff + bitcnt;
- if (count >= num)
- {
- *next = n_bits - (bitoff + bitcnt);
- return count;
- }
- }
- word <<= 1;
- }
+ {
+ if (word & BITSET_MSB)
+ {
+ list[count++] = bitoff + bitcnt;
+ if (count >= num)
+ {
+ *next = n_bits - (bitoff + bitcnt);
+ return count;
+ }
+ }
+ word <<= 1;
+ }
bitoff -= BITSET_WORD_BITS;
bitcnt = BITSET_WORD_BITS - 1;
}
@@ -247,80 +243,80 @@ vbitset_list (src, list, num, next)
{
/* Many bitsets are zero, so make this common case fast. */
for (windex = 0; windex < size && !srcp[windex]; windex++)
- continue;
+ continue;
if (windex >= size)
- return 0;
+ return 0;
/* If num is 1, we could speed things up with a binary search
- of the current word. */
+ of the current word. */
bitoff = windex * BITSET_WORD_BITS;
}
else
{
if (bitno >= BITSET_SIZE_ (src))
- return 0;
+ return 0;
windex = bitno / BITSET_WORD_BITS;
bitno = bitno % BITSET_WORD_BITS;
if (bitno)
- {
- /* Handle the case where we start within a word.
- Most often, this is executed with large bitsets
- with many set bits where we filled the array
- on the previous call to this function. */
-
- bitoff = windex * BITSET_WORD_BITS;
- word = srcp[windex] >> bitno;
- for (bitno = bitoff + bitno; word; bitno++)
- {
- if (word & 1)
- {
- list[count++] = bitno;
- if (count >= num)
- {
- *next = bitno + 1;
- return count;
- }
- }
- word >>= 1;
- }
- windex++;
- }
+ {
+ /* Handle the case where we start within a word.
+ Most often, this is executed with large bitsets
+ with many set bits where we filled the array
+ on the previous call to this function. */
+
+ bitoff = windex * BITSET_WORD_BITS;
+ word = srcp[windex] >> bitno;
+ for (bitno = bitoff + bitno; word; bitno++)
+ {
+ if (word & 1)
+ {
+ list[count++] = bitno;
+ if (count >= num)
+ {
+ *next = bitno + 1;
+ return count;
+ }
+ }
+ word >>= 1;
+ }
+ windex++;
+ }
bitoff = windex * BITSET_WORD_BITS;
}
for (; windex < size; windex++, bitoff += BITSET_WORD_BITS)
{
if (!(word = srcp[windex]))
- continue;
+ continue;
if ((count + BITSET_WORD_BITS) < num)
- {
- for (bitno = bitoff; word; bitno++)
- {
- if (word & 1)
- list[count++] = bitno;
- word >>= 1;
- }
- }
+ {
+ for (bitno = bitoff; word; bitno++)
+ {
+ if (word & 1)
+ list[count++] = bitno;
+ word >>= 1;
+ }
+ }
else
- {
- for (bitno = bitoff; word; bitno++)
- {
- if (word & 1)
- {
- list[count++] = bitno;
- if (count >= num)
- {
- *next = bitno + 1;
- return count;
- }
- }
- word >>= 1;
- }
- }
+ {
+ for (bitno = bitoff; word; bitno++)
+ {
+ if (word & 1)
+ {
+ list[count++] = bitno;
+ if (count >= num)
+ {
+ *next = bitno + 1;
+ return count;
+ }
+ }
+ word >>= 1;
+ }
+ }
}
*next = bitoff;
@@ -343,8 +339,7 @@ vbitset_unused_clear (dst)
static void
-vbitset_ones (dst)
- bitset dst;
+vbitset_ones (bitset dst)
{
bitset_word *dstp = VBITSET_WORDS (dst);
unsigned int bytes;
@@ -357,8 +352,7 @@ vbitset_ones (dst)
static void
-vbitset_zero (dst)
- bitset dst;
+vbitset_zero (bitset dst)
{
bitset_word *dstp = VBITSET_WORDS (dst);
unsigned int bytes;
@@ -370,8 +364,7 @@ vbitset_zero (dst)
static bool
-vbitset_empty_p (dst)
- bitset dst;
+vbitset_empty_p (bitset dst)
{
unsigned int i;
bitset_word *dstp = VBITSET_WORDS (dst);
@@ -385,9 +378,7 @@ vbitset_empty_p (dst)
static void
-vbitset_copy1 (dst, src)
- bitset dst;
- bitset src;
+vbitset_copy1 (bitset dst, bitset src)
{
bitset_word *srcp;
bitset_word *dstp;
@@ -407,14 +398,12 @@ vbitset_copy1 (dst, src)
memcpy (dstp, srcp, sizeof (bitset_word) * ssize);
memset (dstp + sizeof (bitset_word) * ssize, 0,
- sizeof (bitset_word) * (dsize - ssize));
+ sizeof (bitset_word) * (dsize - ssize));
}
static void
-vbitset_not (dst, src)
- bitset dst;
- bitset src;
+vbitset_not (bitset dst, bitset src)
{
unsigned int i;
bitset_word *srcp;
@@ -434,14 +423,12 @@ vbitset_not (dst, src)
vbitset_unused_clear (dst);
memset (dstp + sizeof (bitset_word) * ssize, 0,
- sizeof (bitset_word) * (dsize - ssize));
+ sizeof (bitset_word) * (dsize - ssize));
}
-
+
static bool
-vbitset_equal_p (dst, src)
- bitset dst;
- bitset src;
+vbitset_equal_p (bitset dst, bitset src)
{
unsigned int i;
bitset_word *srcp = VBITSET_WORDS (src);
@@ -451,19 +438,19 @@ vbitset_equal_p (dst, src)
for (i = 0; i < min (ssize, dsize); i++)
if (*srcp++ != *dstp++)
- return 0;
+ return 0;
if (ssize > dsize)
{
for (; i < ssize; i++)
- if (*srcp++)
- return 0;
+ if (*srcp++)
+ return 0;
}
else
{
for (; i < dsize; i++)
- if (*dstp++)
- return 0;
+ if (*dstp++)
+ return 0;
}
return 1;
@@ -471,25 +458,23 @@ vbitset_equal_p (dst, src)
static bool
-vbitset_subset_p (dst, src)
- bitset dst;
- bitset src;
+vbitset_subset_p (bitset dst, bitset src)
{
unsigned int i;
bitset_word *srcp = VBITSET_WORDS (src);
bitset_word *dstp = VBITSET_WORDS (dst);
bitset_windex ssize = VBITSET_SIZE (src);
bitset_windex dsize = VBITSET_SIZE (dst);
-
+
for (i = 0; i < min (ssize, dsize); i++, dstp++, srcp++)
if (*dstp != (*srcp | *dstp))
- return 0;
+ return 0;
if (ssize > dsize)
{
for (; i < ssize; i++)
- if (*srcp++)
- return 0;
+ if (*srcp++)
+ return 0;
}
return 1;
@@ -497,9 +482,7 @@ vbitset_subset_p (dst, src)
static bool
-vbitset_disjoint_p (dst, src)
- bitset dst;
- bitset src;
+vbitset_disjoint_p (bitset dst, bitset src)
{
unsigned int i;
bitset_word *srcp = VBITSET_WORDS (src);
@@ -509,17 +492,14 @@ vbitset_disjoint_p (dst, src)
for (i = 0; i < min (ssize, dsize); i++)
if (*srcp++ & *dstp++)
- return 0;
+ return 0;
return 1;
}
static void
-vbitset_and (dst, src1, src2)
- bitset dst;
- bitset src1;
- bitset src2;
+vbitset_and (bitset dst, bitset src1, bitset src2)
{
unsigned int i;
bitset_word *src1p;
@@ -540,16 +520,13 @@ vbitset_and (dst, src1, src2)
for (i = 0; i < min (ssize1, ssize2); i++)
*dstp++ = *src1p++ & *src2p++;
-
+
memset (dstp, 0, sizeof (bitset_word) * (dsize - min (ssize1, ssize2)));
}
static bool
-vbitset_and_cmp (dst, src1, src2)
- bitset dst;
- bitset src1;
- bitset src2;
+vbitset_and_cmp (bitset dst, bitset src1, bitset src2)
{
unsigned int i;
int changed = 0;
@@ -572,14 +549,14 @@ vbitset_and_cmp (dst, src1, src2)
for (i = 0; i < min (ssize1, ssize2); i++, dstp++)
{
bitset_word tmp = *src1p++ & *src2p++;
-
+
if (*dstp != tmp)
- {
- changed = 1;
- *dstp = tmp;
- }
+ {
+ changed = 1;
+ *dstp = tmp;
+ }
}
-
+
if (ssize2 > ssize1)
{
src1p = src2p;
@@ -589,10 +566,10 @@ vbitset_and_cmp (dst, src1, src2)
for (; i < ssize1; i++, dstp++)
{
if (*dstp != 0)
- {
- changed = 1;
- *dstp = 0;
- }
+ {
+ changed = 1;
+ *dstp = 0;
+ }
}
memset (dstp, 0, sizeof (bitset_word) * (dsize - ssize1));
@@ -602,10 +579,7 @@ vbitset_and_cmp (dst, src1, src2)
static void
-vbitset_andn (dst, src1, src2)
- bitset dst;
- bitset src1;
- bitset src2;
+vbitset_andn (bitset dst, bitset src1, bitset src2)
{
unsigned int i;
bitset_word *src1p;
@@ -626,18 +600,18 @@ vbitset_andn (dst, src1, src2)
for (i = 0; i < min (ssize1, ssize2); i++)
*dstp++ = *src1p++ & ~(*src2p++);
-
+
if (ssize2 > ssize1)
{
for (; i < ssize2; i++)
- *dstp++ = 0;
+ *dstp++ = 0;
memset (dstp, 0, sizeof (bitset_word) * (dsize - ssize2));
}
else
{
for (; i < ssize1; i++)
- *dstp++ = *src1p++;
+ *dstp++ = *src1p++;
memset (dstp, 0, sizeof (bitset_word) * (dsize - ssize1));
}
@@ -645,10 +619,7 @@ vbitset_andn (dst, src1, src2)
static bool
-vbitset_andn_cmp (dst, src1, src2)
- bitset dst;
- bitset src1;
- bitset src2;
+vbitset_andn_cmp (bitset dst, bitset src1, bitset src2)
{
unsigned int i;
int changed = 0;
@@ -671,39 +642,39 @@ vbitset_andn_cmp (dst, src1, src2)
for (i = 0; i < min (ssize1, ssize2); i++, dstp++)
{
bitset_word tmp = *src1p++ & ~(*src2p++);
-
+
if (*dstp != tmp)
- {
- changed = 1;
- *dstp = tmp;
- }
+ {
+ changed = 1;
+ *dstp = tmp;
+ }
}
-
+
if (ssize2 > ssize1)
{
for (; i < ssize2; i++, dstp++)
- {
- if (*dstp != 0)
- {
- changed = 1;
- *dstp = 0;
- }
- }
+ {
+ if (*dstp != 0)
+ {
+ changed = 1;
+ *dstp = 0;
+ }
+ }
memset (dstp, 0, sizeof (bitset_word) * (dsize - ssize2));
}
else
{
for (; i < ssize1; i++, dstp++)
- {
- bitset_word tmp = *src1p++;
-
- if (*dstp != tmp)
- {
- changed = 1;
- *dstp = tmp;
- }
- }
+ {
+ bitset_word tmp = *src1p++;
+
+ if (*dstp != tmp)
+ {
+ changed = 1;
+ *dstp = tmp;
+ }
+ }
memset (dstp, 0, sizeof (bitset_word) * (dsize - ssize1));
}
@@ -713,10 +684,7 @@ vbitset_andn_cmp (dst, src1, src2)
static void
-vbitset_or (dst, src1, src2)
- bitset dst;
- bitset src1;
- bitset src2;
+vbitset_or (bitset dst, bitset src1, bitset src2)
{
unsigned int i;
bitset_word *src1p;
@@ -737,7 +705,7 @@ vbitset_or (dst, src1, src2)
for (i = 0; i < min (ssize1, ssize2); i++)
*dstp++ = *src1p++ | *src2p++;
-
+
if (ssize2 > ssize1)
{
src1p = src2p;
@@ -752,10 +720,7 @@ vbitset_or (dst, src1, src2)
static bool
-vbitset_or_cmp (dst, src1, src2)
- bitset dst;
- bitset src1;
- bitset src2;
+vbitset_or_cmp (bitset dst, bitset src1, bitset src2)
{
unsigned int i;
int changed = 0;
@@ -778,14 +743,14 @@ vbitset_or_cmp (dst, src1, src2)
for (i = 0; i < min (ssize1, ssize2); i++, dstp++)
{
bitset_word tmp = *src1p++ | *src2p++;
-
+
if (*dstp != tmp)
- {
- changed = 1;
- *dstp = tmp;
- }
+ {
+ changed = 1;
+ *dstp = tmp;
+ }
}
-
+
if (ssize2 > ssize1)
{
src1p = src2p;
@@ -795,12 +760,12 @@ vbitset_or_cmp (dst, src1, src2)
for (; i < ssize1; i++, dstp++)
{
bitset_word tmp = *src1p++;
-
+
if (*dstp != tmp)
- {
- changed = 1;
- *dstp = tmp;
- }
+ {
+ changed = 1;
+ *dstp = tmp;
+ }
}
memset (dstp, 0, sizeof (bitset_word) * (dsize - ssize1));
@@ -810,10 +775,7 @@ vbitset_or_cmp (dst, src1, src2)
static void
-vbitset_xor (dst, src1, src2)
- bitset dst;
- bitset src1;
- bitset src2;
+vbitset_xor (bitset dst, bitset src1, bitset src2)
{
unsigned int i;
bitset_word *src1p;
@@ -834,7 +796,7 @@ vbitset_xor (dst, src1, src2)
for (i = 0; i < min (ssize1, ssize2); i++)
*dstp++ = *src1p++ ^ *src2p++;
-
+
if (ssize2 > ssize1)
{
src1p = src2p;
@@ -849,10 +811,7 @@ vbitset_xor (dst, src1, src2)
static bool
-vbitset_xor_cmp (dst, src1, src2)
- bitset dst;
- bitset src1;
- bitset src2;
+vbitset_xor_cmp (bitset dst, bitset src1, bitset src2)
{
unsigned int i;
int changed = 0;
@@ -875,14 +834,14 @@ vbitset_xor_cmp (dst, src1, src2)
for (i = 0; i < min (ssize1, ssize2); i++, dstp++)
{
bitset_word tmp = *src1p++ ^ *src2p++;
-
+
if (*dstp != tmp)
- {
- changed = 1;
- *dstp = tmp;
- }
+ {
+ changed = 1;
+ *dstp = tmp;
+ }
}
-
+
if (ssize2 > ssize1)
{
src1p = src2p;
@@ -892,12 +851,12 @@ vbitset_xor_cmp (dst, src1, src2)
for (; i < ssize1; i++, dstp++)
{
bitset_word tmp = *src1p++;
-
+
if (*dstp != tmp)
- {
- changed = 1;
- *dstp = tmp;
- }
+ {
+ changed = 1;
+ *dstp = tmp;
+ }
}
memset (dstp, 0, sizeof (bitset_word) * (dsize - ssize1));
@@ -910,11 +869,7 @@ vbitset_xor_cmp (dst, src1, src2)
bitsets. */
static void
-vbitset_and_or (dst, src1, src2, src3)
- bitset dst;
- bitset src1;
- bitset src2;
- bitset src3;
+vbitset_and_or (bitset dst, bitset src1, bitset src2, bitset src3)
{
unsigned int i;
bitset_word *src1p;
@@ -922,7 +877,7 @@ vbitset_and_or (dst, src1, src2, src3)
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
-
+
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
{
@@ -944,11 +899,7 @@ vbitset_and_or (dst, src1, src2, src3)
static bool
-vbitset_and_or_cmp (dst, src1, src2, src3)
- bitset dst;
- bitset src1;
- bitset src2;
- bitset src3;
+vbitset_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
{
unsigned int i;
int changed = 0;
@@ -957,7 +908,7 @@ vbitset_and_or_cmp (dst, src1, src2, src3)
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
-
+
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
return bitset_and_or_cmp_ (dst, src1, src2, src3);
@@ -969,27 +920,23 @@ vbitset_and_or_cmp (dst, src1, src2, src3)
src3p = VBITSET_WORDS (src3);
dstp = VBITSET_WORDS (dst);
size = VBITSET_SIZE (dst);
-
+
for (i = 0; i < size; i++, dstp++)
{
bitset_word tmp = (*src1p++ & *src2p++) | *src3p++;
-
+
if (*dstp != tmp)
- {
- changed = 1;
- *dstp = tmp;
- }
+ {
+ changed = 1;
+ *dstp = tmp;
+ }
}
return changed;
}
static void
-vbitset_andn_or (dst, src1, src2, src3)
- bitset dst;
- bitset src1;
- bitset src2;
- bitset src3;
+vbitset_andn_or (bitset dst, bitset src1, bitset src2, bitset src3)
{
unsigned int i;
bitset_word *src1p;
@@ -997,7 +944,7 @@ vbitset_andn_or (dst, src1, src2, src3)
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
-
+
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
{
@@ -1019,11 +966,7 @@ vbitset_andn_or (dst, src1, src2, src3)
static bool
-vbitset_andn_or_cmp (dst, src1, src2, src3)
- bitset dst;
- bitset src1;
- bitset src2;
- bitset src3;
+vbitset_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
{
unsigned int i;
int changed = 0;
@@ -1032,7 +975,7 @@ vbitset_andn_or_cmp (dst, src1, src2, src3)
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
-
+
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
return bitset_andn_or_cmp_ (dst, src1, src2, src3);
@@ -1044,27 +987,23 @@ vbitset_andn_or_cmp (dst, src1, src2, src3)
src3p = VBITSET_WORDS (src3);
dstp = VBITSET_WORDS (dst);
size = VBITSET_SIZE (dst);
-
+
for (i = 0; i < size; i++, dstp++)
{
bitset_word tmp = (*src1p++ & ~(*src2p++)) | *src3p++;
-
+
if (*dstp != tmp)
- {
- changed = 1;
- *dstp = tmp;
- }
+ {
+ changed = 1;
+ *dstp = tmp;
+ }
}
return changed;
}
static void
-vbitset_or_and (dst, src1, src2, src3)
- bitset dst;
- bitset src1;
- bitset src2;
- bitset src3;
+vbitset_or_and (bitset dst, bitset src1, bitset src2, bitset src3)
{
unsigned int i;
bitset_word *src1p;
@@ -1072,7 +1011,7 @@ vbitset_or_and (dst, src1, src2, src3)
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
-
+
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
{
@@ -1087,18 +1026,14 @@ vbitset_or_and (dst, src1, src2, src3)
src3p = VBITSET_WORDS (src3);
dstp = VBITSET_WORDS (dst);
size = VBITSET_SIZE (dst);
-
+
for (i = 0; i < size; i++)
*dstp++ = (*src1p++ | *src2p++) & *src3p++;
}
static bool
-vbitset_or_and_cmp (dst, src1, src2, src3)
- bitset dst;
- bitset src1;
- bitset src2;
- bitset src3;
+vbitset_or_and_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
{
unsigned int i;
int changed = 0;
@@ -1107,7 +1042,7 @@ vbitset_or_and_cmp (dst, src1, src2, src3)
bitset_word *src3p;
bitset_word *dstp;
bitset_windex size;
-
+
if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2)
|| BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3))
return bitset_or_and_cmp_ (dst, src1, src2, src3);
@@ -1119,25 +1054,23 @@ vbitset_or_and_cmp (dst, src1, src2, src3)
src3p = VBITSET_WORDS (src3);
dstp = VBITSET_WORDS (dst);
size = VBITSET_SIZE (dst);
-
+
for (i = 0; i < size; i++, dstp++)
{
bitset_word tmp = (*src1p++ | *src2p++) & *src3p++;
-
+
if (*dstp != tmp)
- {
- changed = 1;
- *dstp = tmp;
- }
+ {
+ changed = 1;
+ *dstp = tmp;
+ }
}
return changed;
}
-void
-vbitset_copy (dst, src)
- bitset dst;
- bitset src;
+static void
+vbitset_copy (bitset dst, bitset src)
{
if (BITSET_COMPATIBLE_ (dst, src))
vbitset_copy1 (dst, src);