110 |
static void lbitset_set PARAMS ((bitset, bitset_bindex)); |
static void lbitset_set PARAMS ((bitset, bitset_bindex)); |
111 |
static void lbitset_reset PARAMS ((bitset, bitset_bindex)); |
static void lbitset_reset PARAMS ((bitset, bitset_bindex)); |
112 |
static int lbitset_test PARAMS ((bitset, bitset_bindex)); |
static int lbitset_test PARAMS ((bitset, bitset_bindex)); |
113 |
static int lbitset_size PARAMS ((bitset)); |
static bitset_bindex lbitset_size PARAMS ((bitset)); |
114 |
static int lbitset_op3_cmp PARAMS ((bitset, bitset, bitset, enum bitset_ops)); |
static int lbitset_op3_cmp PARAMS ((bitset, bitset, bitset, enum bitset_ops)); |
115 |
static int lbitset_list PARAMS ((bitset, bitset_bindex *, bitset_bindex, |
static bitset_bindex lbitset_list PARAMS ((bitset, bitset_bindex *, |
116 |
bitset_bindex *)); |
bitset_bindex, bitset_bindex *)); |
117 |
static int lbitset_list_reverse |
static bitset_bindex lbitset_list_reverse |
118 |
PARAMS ((bitset, bitset_bindex *, bitset_bindex, bitset_bindex *)); |
PARAMS ((bitset, bitset_bindex *, bitset_bindex, bitset_bindex *)); |
119 |
static void lbitset_free PARAMS ((bitset)); |
static void lbitset_free PARAMS ((bitset)); |
120 |
|
|
417 |
return 0; |
return 0; |
418 |
|
|
419 |
case LBITSET_CREATE: |
case LBITSET_CREATE: |
420 |
windex = (windex / (unsigned) LBITSET_ELT_WORDS) * LBITSET_ELT_WORDS; |
windex -= windex % LBITSET_ELT_WORDS; |
421 |
|
|
422 |
elt = lbitset_elt_calloc (); |
elt = lbitset_elt_calloc (); |
423 |
elt->index = windex; |
elt->index = windex; |
563 |
|
|
564 |
|
|
565 |
/* Return size in bits of bitset SRC. */ |
/* Return size in bits of bitset SRC. */ |
566 |
static int |
static bitset_bindex |
567 |
lbitset_size (src) |
lbitset_size (src) |
568 |
bitset src; |
bitset src; |
569 |
{ |
{ |
638 |
/* Find list of up to NUM bits set in BSET starting from and including |
/* Find list of up to NUM bits set in BSET starting from and including |
639 |
*NEXT and store in array LIST. Return with actual number of bits |
*NEXT and store in array LIST. Return with actual number of bits |
640 |
found and with *NEXT indicating where search stopped. */ |
found and with *NEXT indicating where search stopped. */ |
641 |
static int |
static bitset_bindex |
642 |
lbitset_list_reverse (bset, list, num, next) |
lbitset_list_reverse (bset, list, num, next) |
643 |
bitset bset; |
bitset bset; |
644 |
bitset_bindex *list; |
bitset_bindex *list; |
736 |
/* Find list of up to NUM bits set in BSET starting from and including |
/* Find list of up to NUM bits set in BSET starting from and including |
737 |
*NEXT and store in array LIST. Return with actual number of bits |
*NEXT and store in array LIST. Return with actual number of bits |
738 |
found and with *NEXT indicating where search stopped. */ |
found and with *NEXT indicating where search stopped. */ |
739 |
static int |
static bitset_bindex |
740 |
lbitset_list (bset, list, num, next) |
lbitset_list (bset, list, num, next) |
741 |
bitset bset; |
bitset bset; |
742 |
bitset_bindex *list; |
bitset_bindex *list; |
954 |
lbitset_ones (dst) |
lbitset_ones (dst) |
955 |
bitset dst; |
bitset dst; |
956 |
{ |
{ |
957 |
unsigned int i; |
bitset_windex i; |
958 |
bitset_windex windex; |
bitset_windex windex; |
959 |
lbitset_elt *elt; |
lbitset_elt *elt; |
960 |
|
|
985 |
lbitset_elt *elt; |
lbitset_elt *elt; |
986 |
lbitset_elt *selt; |
lbitset_elt *selt; |
987 |
lbitset_elt *delt; |
lbitset_elt *delt; |
988 |
unsigned int i; |
bitset_windex i; |
989 |
unsigned int j; |
unsigned int j; |
990 |
bitset_windex windex; |
bitset_windex windex; |
991 |
|
|
1114 |
LBITSET_HEAD (dst) = 0; |
LBITSET_HEAD (dst) = 0; |
1115 |
dst->b.csize = 0; |
dst->b.csize = 0; |
1116 |
|
|
1117 |
windex1 = (selt1) ? selt1->index : BITSET_INDEX_MAX; |
windex1 = (selt1) ? selt1->index : BITSET_WINDEX_MAX; |
1118 |
windex2 = (selt2) ? selt2->index : BITSET_INDEX_MAX; |
windex2 = (selt2) ? selt2->index : BITSET_WINDEX_MAX; |
1119 |
|
|
1120 |
while (selt1 || selt2) |
while (selt1 || selt2) |
1121 |
{ |
{ |
1127 |
stmp1 = selt1; |
stmp1 = selt1; |
1128 |
stmp2 = selt2; |
stmp2 = selt2; |
1129 |
selt1 = selt1->next; |
selt1 = selt1->next; |
1130 |
windex1 = (selt1) ? selt1->index : BITSET_INDEX_MAX; |
windex1 = (selt1) ? selt1->index : BITSET_WINDEX_MAX; |
1131 |
selt2 = selt2->next; |
selt2 = selt2->next; |
1132 |
windex2 = (selt2) ? selt2->index : BITSET_INDEX_MAX; |
windex2 = (selt2) ? selt2->index : BITSET_WINDEX_MAX; |
1133 |
} |
} |
1134 |
else if (windex1 < windex2) |
else if (windex1 < windex2) |
1135 |
{ |
{ |
1137 |
stmp1 = selt1; |
stmp1 = selt1; |
1138 |
stmp2 = &lbitset_zero_elts[0]; |
stmp2 = &lbitset_zero_elts[0]; |
1139 |
selt1 = selt1->next; |
selt1 = selt1->next; |
1140 |
windex1 = (selt1) ? selt1->index : BITSET_INDEX_MAX; |
windex1 = (selt1) ? selt1->index : BITSET_WINDEX_MAX; |
1141 |
} |
} |
1142 |
else |
else |
1143 |
{ |
{ |
1145 |
stmp1 = &lbitset_zero_elts[0]; |
stmp1 = &lbitset_zero_elts[0]; |
1146 |
stmp2 = selt2; |
stmp2 = selt2; |
1147 |
selt2 = selt2->next; |
selt2 = selt2->next; |
1148 |
windex2 = (selt2) ? selt2->index : BITSET_INDEX_MAX; |
windex2 = (selt2) ? selt2->index : BITSET_WINDEX_MAX; |
1149 |
} |
} |
1150 |
|
|
1151 |
/* Find the appropriate element from DST. Begin by discarding |
/* Find the appropriate element from DST. Begin by discarding |
1385 |
|
|
1386 |
|
|
1387 |
/* Return size of initial structure. */ |
/* Return size of initial structure. */ |
1388 |
int |
size_t |
1389 |
lbitset_bytes (n_bits) |
lbitset_bytes (n_bits) |
1390 |
bitset_bindex n_bits ATTRIBUTE_UNUSED; |
bitset_bindex n_bits ATTRIBUTE_UNUSED; |
1391 |
{ |
{ |
1429 |
|
|
1430 |
for (elt = LBITSET_HEAD (bset); elt; elt = elt->next) |
for (elt = LBITSET_HEAD (bset); elt; elt = elt->next) |
1431 |
{ |
{ |
1432 |
fprintf (stderr, "Elt %d\n", elt->index); |
fprintf (stderr, "Elt %lu\n", (unsigned long) elt->index); |
1433 |
for (i = 0; i < LBITSET_ELT_WORDS; i++) |
for (i = 0; i < LBITSET_ELT_WORDS; i++) |
1434 |
{ |
{ |
1435 |
unsigned int j; |
unsigned int j; |
1437 |
|
|
1438 |
word = elt->words[i]; |
word = elt->words[i]; |
1439 |
|
|
1440 |
fprintf (stderr, " Word %d:", i); |
fprintf (stderr, " Word %u:", i); |
1441 |
for (j = 0; j < LBITSET_WORD_BITS; j++) |
for (j = 0; j < LBITSET_WORD_BITS; j++) |
1442 |
if ((word & (1 << j))) |
if ((word & (1 << j))) |
1443 |
fprintf (stderr, " %d", j); |
fprintf (stderr, " %u", j); |
1444 |
fprintf (stderr, "\n"); |
fprintf (stderr, "\n"); |
1445 |
} |
} |
1446 |
} |
} |