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

Diff of /bison/lib/bitset_stats.c

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

revision 1.10 by eggert, Sat May 24 19:16:02 2003 UTC revision 1.11 by eggert, Tue Jun 17 07:22:58 2003 UTC
# Line 33  Line 33 
33  #include "abitset.h"  #include "abitset.h"
34  #include "ebitset.h"  #include "ebitset.h"
35  #include "lbitset.h"  #include "lbitset.h"
36    #include "vbitset.h"
37  #include "bitset_stats.h"  #include "bitset_stats.h"
38  #include <stdlib.h>  #include <stdlib.h>
39  #include <string.h>  #include <string.h>
# Line 376  bitset_stats_test (bitset src, bitset_bi Line 377  bitset_stats_test (bitset src, bitset_bi
377    
378    
379  static bitset_bindex  static bitset_bindex
380    bitset_stats_resize (bitset src, bitset_bindex size)
381    {
382        return BITSET_RESIZE_ (src->s.bset, size);
383    }
384    
385    
386    static bitset_bindex
387  bitset_stats_size (bitset src)  bitset_stats_size (bitset src)
388  {  {
389    return BITSET_SIZE_ (src->s.bset);    return BITSET_SIZE_ (src->s.bset);
# Line 518  static void Line 526  static void
526  bitset_stats_and_or (bitset dst, bitset src1, bitset src2, bitset src3)  bitset_stats_and_or (bitset dst, bitset src1, bitset src2, bitset src3)
527  {  {
528    BITSET_CHECK4_ (dst, src1, src2, src3);    BITSET_CHECK4_ (dst, src1, src2, src3);
   
529    BITSET_AND_OR_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset);    BITSET_AND_OR_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset);
530  }  }
531    
# Line 527  static bool Line 534  static bool
534  bitset_stats_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)  bitset_stats_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
535  {  {
536    BITSET_CHECK4_ (dst, src1, src2, src3);    BITSET_CHECK4_ (dst, src1, src2, src3);
   
537    return BITSET_AND_OR_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset);    return BITSET_AND_OR_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset);
538  }  }
539    
# Line 536  static void Line 542  static void
542  bitset_stats_andn_or (bitset dst, bitset src1, bitset src2, bitset src3)  bitset_stats_andn_or (bitset dst, bitset src1, bitset src2, bitset src3)
543  {  {
544    BITSET_CHECK4_ (dst, src1, src2, src3);    BITSET_CHECK4_ (dst, src1, src2, src3);
   
545    BITSET_ANDN_OR_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset);    BITSET_ANDN_OR_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset);
546  }  }
547    
# Line 545  static bool Line 550  static bool
550  bitset_stats_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)  bitset_stats_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
551  {  {
552    BITSET_CHECK4_ (dst, src1, src2, src3);    BITSET_CHECK4_ (dst, src1, src2, src3);
   
553    return BITSET_ANDN_OR_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset);    return BITSET_ANDN_OR_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset);
554  }  }
555    
# Line 554  static void Line 558  static void
558  bitset_stats_or_and (bitset dst, bitset src1, bitset src2, bitset src3)  bitset_stats_or_and (bitset dst, bitset src1, bitset src2, bitset src3)
559  {  {
560    BITSET_CHECK4_ (dst, src1, src2, src3);    BITSET_CHECK4_ (dst, src1, src2, src3);
   
561    BITSET_OR_AND_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset);    BITSET_OR_AND_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset);
562  }  }
563    
# Line 563  static bool Line 566  static bool
566  bitset_stats_or_and_cmp (bitset dst, bitset src1, bitset src2, bitset src3)  bitset_stats_or_and_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
567  {  {
568    BITSET_CHECK4_ (dst, src1, src2, src3);    BITSET_CHECK4_ (dst, src1, src2, src3);
   
569    return BITSET_OR_AND_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset);    return BITSET_OR_AND_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset);
570  }  }
571    
# Line 576  bitset_stats_list (bitset bset, bitset_b Line 578  bitset_stats_list (bitset bset, bitset_b
578    bitset_bindex tmp;    bitset_bindex tmp;
579    bitset_bindex size;    bitset_bindex size;
580    bitset_bindex i;    bitset_bindex i;
581      enum bitset_type type;
582    
583    count = BITSET_LIST_ (bset->s.bset, list, num, next);    count = BITSET_LIST_ (bset->s.bset, list, num, next);
584    
585      type = BITSET_TYPE_ (bset->s.bset);
586    BITSET_STATS_LISTS_INC (bset->s.bset);    BITSET_STATS_LISTS_INC (bset->s.bset);
587    
588    /* Log histogram of number of set bits.  */    /* Log histogram of number of set bits.  */
# Line 626  struct bitset_vtable bitset_stats_vtable Line 630  struct bitset_vtable bitset_stats_vtable
630    bitset_stats_reset,    bitset_stats_reset,
631    bitset_stats_toggle,    bitset_stats_toggle,
632    bitset_stats_test,    bitset_stats_test,
633      bitset_stats_resize,
634    bitset_stats_size,    bitset_stats_size,
635    bitset_stats_count,    bitset_stats_count,
636    bitset_stats_empty_p,    bitset_stats_empty_p,
# Line 685  bitset_stats_init (bitset bset, bitset_b Line 690  bitset_stats_init (bitset bset, bitset_b
690    bset->b.csize = 0;    bset->b.csize = 0;
691    bset->b.cdata = 0;    bset->b.cdata = 0;
692    
693      BITSET_NBITS_ (bset) = n_bits;
694    
695    /* Set up the actual bitset implementation that    /* Set up the actual bitset implementation that
696       we are a wrapper over.  */       we are a wrapper over.  */
697    switch (type)    switch (type)
# Line 707  bitset_stats_init (bitset bset, bitset_b Line 714  bitset_stats_init (bitset bset, bitset_b
714        ebitset_init (sbset, n_bits);        ebitset_init (sbset, n_bits);
715        break;        break;
716    
717        case BITSET_VARRAY:
718          bytes = vbitset_bytes (n_bits);
719          sbset = (bitset) xcalloc (1, bytes);
720          vbitset_init (sbset, n_bits);
721          break;
722    
723      default:      default:
724        abort ();        abort ();
725      }      }

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

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