345 |
} |
} |
346 |
|
|
347 |
|
|
348 |
|
/* Return non-zero if BITNO in SRC is the only set bit. */ |
349 |
|
int |
350 |
|
bitset_only_set_p (src, bitno) |
351 |
|
bitset src; |
352 |
|
bitset_bindex bitno; |
353 |
|
{ |
354 |
|
bitset_bindex val[2]; |
355 |
|
bitset_bindex next = 0; |
356 |
|
|
357 |
|
if (bitset_list (src, val, 2, &next) != 1) |
358 |
|
return 0; |
359 |
|
return val[0] == bitno; |
360 |
|
} |
361 |
|
|
362 |
|
|
363 |
|
/* Toggle bit BITNO in bitset BSET and return non-zero if now set. */ |
364 |
|
int |
365 |
|
bitset_toggle (bset, bitno) |
366 |
|
bitset bset; |
367 |
|
bitset_bindex bitno; |
368 |
|
{ |
369 |
|
/* This routine is for completeness. It could be optimized if |
370 |
|
required. */ |
371 |
|
if (bitset_test (bset, bitno)) |
372 |
|
{ |
373 |
|
bitset_reset (bset, bitno); |
374 |
|
return 0; |
375 |
|
} |
376 |
|
else |
377 |
|
{ |
378 |
|
bitset_set (bset, bitno); |
379 |
|
return 1; |
380 |
|
} |
381 |
|
} |
382 |
|
|
383 |
|
|
384 |
/* Print contents of bitset BSET to FILE. */ |
/* Print contents of bitset BSET to FILE. */ |
385 |
static void |
static void |
386 |
bitset_print (file, bset, verbose) |
bitset_print (file, bset, verbose) |
581 |
} |
} |
582 |
|
|
583 |
|
|
|
/* DST = SRC1 | ~SRC2. Return non-zero if DST != SRC1 | ~SRC2. */ |
|
|
int |
|
|
bitset_orn (dst, src1, src2) |
|
|
bitset dst; |
|
|
bitset src1; |
|
|
bitset src2; |
|
|
{ |
|
|
BITSET_CHECK3_ (dst, src1, src2); |
|
|
return BITSET_ORN_ (dst, src1, src2); |
|
|
} |
|
|
|
|
|
|
|
584 |
int |
int |
585 |
bitset_op4 (dst, src1, src2, src3, op) |
bitset_op4 (dst, src1, src2, src3, op) |
586 |
bitset dst; |
bitset dst; |
593 |
bitset tmp; |
bitset tmp; |
594 |
|
|
595 |
/* Create temporary bitset. */ |
/* Create temporary bitset. */ |
596 |
tmp = bitset_alloc (BITSET_TYPE_ (dst), 0); |
tmp = bitset_alloc (0, BITSET_TYPE_ (dst)); |
597 |
|
|
598 |
switch (op) |
switch (op) |
599 |
{ |
{ |