/[bison]/bison/lib/abitset.c
ViewVC logotype

Diff of /bison/lib/abitset.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by eggert, Wed Oct 16 06:15:02 2002 UTC revision 1.7 by eggert, Sat May 24 19:16:02 2003 UTC
# Line 1  Line 1 
1  /* Array bitsets.  /* Array bitsets.
2     Copyright (C) 2002 Free Software Foundation, Inc.     Copyright (C) 2002, 2003 Free Software Foundation, Inc.
3     Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).     Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
4    
5     This program is free software; you can redistribute it and/or modify     This program is free software; you can redistribute it and/or modify
# Line 123  abitset_reset (bitset dst ATTRIBUTE_UNUS Line 123  abitset_reset (bitset dst ATTRIBUTE_UNUS
123    
124    
125  /* Test bit BITNO in bitset SRC.  */  /* Test bit BITNO in bitset SRC.  */
126  static int  static bool
127  abitset_test (bitset src ATTRIBUTE_UNUSED,  abitset_test (bitset src ATTRIBUTE_UNUSED,
128                bitset_bindex bitno ATTRIBUTE_UNUSED)                bitset_bindex bitno ATTRIBUTE_UNUSED)
129  {  {
130    /* This should never occur for abitsets since we should always    /* This should never occur for abitsets since we should always
131       hit the cache.  */       hit the cache.  */
132    abort ();    abort ();
133    return 0;    return false;
134  }  }
135    
136    
# Line 336  abitset_zero (bitset dst) Line 336  abitset_zero (bitset dst)
336  }  }
337    
338    
339  static int  static bool
340  abitset_empty_p (bitset dst)  abitset_empty_p (bitset dst)
341  {  {
342    bitset_windex i;    bitset_windex i;
# Line 344  abitset_empty_p (bitset dst) Line 344  abitset_empty_p (bitset dst)
344    
345    for (i = 0; i < dst->b.csize; i++)    for (i = 0; i < dst->b.csize; i++)
346      if (dstp[i])      if (dstp[i])
347        return 0;        return false;
348    
349    return 1;    return true;
350  }  }
351    
352    
# Line 377  abitset_not (bitset dst, bitset src) Line 377  abitset_not (bitset dst, bitset src)
377  }  }
378    
379    
380  static int  static bool
381  abitset_equal_p (bitset dst, bitset src)  abitset_equal_p (bitset dst, bitset src)
382  {  {
383    bitset_windex i;    bitset_windex i;
# Line 387  abitset_equal_p (bitset dst, bitset src) Line 387  abitset_equal_p (bitset dst, bitset src)
387    
388    for (i = 0; i < size; i++)    for (i = 0; i < size; i++)
389        if (*srcp++ != *dstp++)        if (*srcp++ != *dstp++)
390            return 0;            return false;
391    return 1;    return true;
392  }  }
393    
394    
395  static int  static bool
396  abitset_subset_p (bitset dst, bitset src)  abitset_subset_p (bitset dst, bitset src)
397  {  {
398    bitset_windex i;    bitset_windex i;
# Line 402  abitset_subset_p (bitset dst, bitset src Line 402  abitset_subset_p (bitset dst, bitset src
402    
403    for (i = 0; i < size; i++, dstp++, srcp++)    for (i = 0; i < size; i++, dstp++, srcp++)
404        if (*dstp != (*srcp | *dstp))        if (*dstp != (*srcp | *dstp))
405            return 0;            return false;
406    return 1;    return true;
407  }  }
408    
409    
410  static int  static bool
411  abitset_disjoint_p (bitset dst, bitset src)  abitset_disjoint_p (bitset dst, bitset src)
412  {  {
413    bitset_windex i;    bitset_windex i;
# Line 417  abitset_disjoint_p (bitset dst, bitset s Line 417  abitset_disjoint_p (bitset dst, bitset s
417    
418    for (i = 0; i < size; i++)    for (i = 0; i < size; i++)
419        if (*srcp++ & *dstp++)        if (*srcp++ & *dstp++)
420            return 0;            return false;
421    
422    return 1;    return true;
423  }  }
424    
425    
# Line 437  abitset_and (bitset dst, bitset src1, bi Line 437  abitset_and (bitset dst, bitset src1, bi
437  }  }
438    
439    
440  static int  static bool
441  abitset_and_cmp (bitset dst, bitset src1, bitset src2)  abitset_and_cmp (bitset dst, bitset src1, bitset src2)
442  {  {
443    bitset_windex i;    bitset_windex i;
444    int changed = 0;    bool changed = false;
445    bitset_word *src1p = ABITSET_WORDS (src1);    bitset_word *src1p = ABITSET_WORDS (src1);
446    bitset_word *src2p = ABITSET_WORDS (src2);    bitset_word *src2p = ABITSET_WORDS (src2);
447    bitset_word *dstp = ABITSET_WORDS (dst);    bitset_word *dstp = ABITSET_WORDS (dst);
# Line 453  abitset_and_cmp (bitset dst, bitset src1 Line 453  abitset_and_cmp (bitset dst, bitset src1
453    
454        if (*dstp != tmp)        if (*dstp != tmp)
455          {          {
456            changed = 1;            changed = true;
457            *dstp = tmp;            *dstp = tmp;
458          }          }
459      }      }
# Line 475  abitset_andn (bitset dst, bitset src1, b Line 475  abitset_andn (bitset dst, bitset src1, b
475  }  }
476    
477    
478  static int  static bool
479  abitset_andn_cmp (bitset dst, bitset src1, bitset src2)  abitset_andn_cmp (bitset dst, bitset src1, bitset src2)
480  {  {
481    bitset_windex i;    bitset_windex i;
482    int changed = 0;    bool changed = false;
483    bitset_word *src1p = ABITSET_WORDS (src1);    bitset_word *src1p = ABITSET_WORDS (src1);
484    bitset_word *src2p = ABITSET_WORDS (src2);    bitset_word *src2p = ABITSET_WORDS (src2);
485    bitset_word *dstp = ABITSET_WORDS (dst);    bitset_word *dstp = ABITSET_WORDS (dst);
# Line 491  abitset_andn_cmp (bitset dst, bitset src Line 491  abitset_andn_cmp (bitset dst, bitset src
491    
492        if (*dstp != tmp)        if (*dstp != tmp)
493          {          {
494            changed = 1;            changed = true;
495            *dstp = tmp;            *dstp = tmp;
496          }          }
497      }      }
# Line 513  abitset_or (bitset dst, bitset src1, bit Line 513  abitset_or (bitset dst, bitset src1, bit
513  }  }
514    
515    
516  static int  static bool
517  abitset_or_cmp (bitset dst, bitset src1, bitset src2)  abitset_or_cmp (bitset dst, bitset src1, bitset src2)
518  {  {
519    bitset_windex i;    bitset_windex i;
520    int changed = 0;    bool changed = false;
521    bitset_word *src1p = ABITSET_WORDS (src1);    bitset_word *src1p = ABITSET_WORDS (src1);
522    bitset_word *src2p = ABITSET_WORDS (src2);    bitset_word *src2p = ABITSET_WORDS (src2);
523    bitset_word *dstp = ABITSET_WORDS (dst);    bitset_word *dstp = ABITSET_WORDS (dst);
# Line 529  abitset_or_cmp (bitset dst, bitset src1, Line 529  abitset_or_cmp (bitset dst, bitset src1,
529    
530        if (*dstp != tmp)        if (*dstp != tmp)
531          {          {
532            changed = 1;            changed = true;
533            *dstp = tmp;            *dstp = tmp;
534          }          }
535      }      }
# Line 551  abitset_xor (bitset dst, bitset src1, bi Line 551  abitset_xor (bitset dst, bitset src1, bi
551  }  }
552    
553    
554  static int  static bool
555  abitset_xor_cmp (bitset dst, bitset src1, bitset src2)  abitset_xor_cmp (bitset dst, bitset src1, bitset src2)
556  {  {
557    bitset_windex i;    bitset_windex i;
558    int changed = 0;    bool changed = false;
559    bitset_word *src1p = ABITSET_WORDS (src1);    bitset_word *src1p = ABITSET_WORDS (src1);
560    bitset_word *src2p = ABITSET_WORDS (src2);    bitset_word *src2p = ABITSET_WORDS (src2);
561    bitset_word *dstp = ABITSET_WORDS (dst);    bitset_word *dstp = ABITSET_WORDS (dst);
# Line 567  abitset_xor_cmp (bitset dst, bitset src1 Line 567  abitset_xor_cmp (bitset dst, bitset src1
567    
568        if (*dstp != tmp)        if (*dstp != tmp)
569          {          {
570            changed = 1;            changed = true;
571            *dstp = tmp;            *dstp = tmp;
572          }          }
573      }      }
# Line 590  abitset_and_or (bitset dst, bitset src1, Line 590  abitset_and_or (bitset dst, bitset src1,
590  }  }
591    
592    
593  static int  static bool
594  abitset_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)  abitset_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
595  {  {
596    bitset_windex i;    bitset_windex i;
597    int changed = 0;    bool changed = false;
598    bitset_word *src1p = ABITSET_WORDS (src1);    bitset_word *src1p = ABITSET_WORDS (src1);
599    bitset_word *src2p = ABITSET_WORDS (src2);    bitset_word *src2p = ABITSET_WORDS (src2);
600    bitset_word *src3p = ABITSET_WORDS (src3);    bitset_word *src3p = ABITSET_WORDS (src3);
# Line 607  abitset_and_or_cmp (bitset dst, bitset s Line 607  abitset_and_or_cmp (bitset dst, bitset s
607    
608        if (*dstp != tmp)        if (*dstp != tmp)
609          {          {
610            changed = 1;            changed = true;
611            *dstp = tmp;            *dstp = tmp;
612          }          }
613      }      }
# Line 630  abitset_andn_or (bitset dst, bitset src1 Line 630  abitset_andn_or (bitset dst, bitset src1
630  }  }
631    
632    
633  static int  static bool
634  abitset_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)  abitset_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
635  {  {
636    bitset_windex i;    bitset_windex i;
637    int changed = 0;    bool changed = false;
638    bitset_word *src1p = ABITSET_WORDS (src1);    bitset_word *src1p = ABITSET_WORDS (src1);
639    bitset_word *src2p = ABITSET_WORDS (src2);    bitset_word *src2p = ABITSET_WORDS (src2);
640    bitset_word *src3p = ABITSET_WORDS (src3);    bitset_word *src3p = ABITSET_WORDS (src3);
# Line 647  abitset_andn_or_cmp (bitset dst, bitset Line 647  abitset_andn_or_cmp (bitset dst, bitset
647    
648        if (*dstp != tmp)        if (*dstp != tmp)
649          {          {
650            changed = 1;            changed = true;
651            *dstp = tmp;            *dstp = tmp;
652          }          }
653      }      }
# Line 670  abitset_or_and (bitset dst, bitset src1, Line 670  abitset_or_and (bitset dst, bitset src1,
670  }  }
671    
672    
673  static int  static bool
674  abitset_or_and_cmp (bitset dst, bitset src1, bitset src2, bitset src3)  abitset_or_and_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
675  {  {
676    bitset_windex i;    bitset_windex i;
677    int changed = 0;    bool changed = false;
678    bitset_word *src1p = ABITSET_WORDS (src1);    bitset_word *src1p = ABITSET_WORDS (src1);
679    bitset_word *src2p = ABITSET_WORDS (src2);    bitset_word *src2p = ABITSET_WORDS (src2);
680    bitset_word *src3p = ABITSET_WORDS (src3);    bitset_word *src3p = ABITSET_WORDS (src3);
# Line 687  abitset_or_and_cmp (bitset dst, bitset s Line 687  abitset_or_and_cmp (bitset dst, bitset s
687    
688        if (*dstp != tmp)        if (*dstp != tmp)
689          {          {
690            changed = 1;            changed = true;
691            *dstp = tmp;            *dstp = tmp;
692          }          }
693      }      }

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26