⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bitset_stats.c

📁 bison 2.0 主要可以用来做语法分析用的
💻 C
📖 第 1 页 / 共 2 页
字号:
  if (offset < bset->b.csize)    {      BITSET_STATS_CACHE_TESTS_INC (bset);      return (bset->b.cdata[offset] >> (bitno % BITSET_WORD_BITS)) & 1;    }  else    return BITSET_TEST_ (bset, bitno);}static bitset_bindexbitset_stats_resize (bitset src, bitset_bindex size){    return BITSET_RESIZE_ (src->s.bset, size);}static bitset_bindexbitset_stats_size (bitset src){  return BITSET_SIZE_ (src->s.bset);}static bitset_bindexbitset_stats_count (bitset src){  return BITSET_COUNT_ (src->s.bset);}static boolbitset_stats_empty_p (bitset dst){  return BITSET_EMPTY_P_ (dst->s.bset);}static voidbitset_stats_ones (bitset dst){  BITSET_ONES_ (dst->s.bset);}static voidbitset_stats_zero (bitset dst){  BITSET_ZERO_ (dst->s.bset);}static voidbitset_stats_copy (bitset dst, bitset src){  BITSET_CHECK2_ (dst, src);  BITSET_COPY_ (dst->s.bset, src->s.bset);}static boolbitset_stats_disjoint_p (bitset dst, bitset src){  BITSET_CHECK2_ (dst, src);  return BITSET_DISJOINT_P_ (dst->s.bset, src->s.bset);}static boolbitset_stats_equal_p (bitset dst, bitset src){  BITSET_CHECK2_ (dst, src);  return BITSET_EQUAL_P_ (dst->s.bset, src->s.bset);}static voidbitset_stats_not (bitset dst, bitset src){  BITSET_CHECK2_ (dst, src);  BITSET_NOT_ (dst->s.bset, src->s.bset);}static boolbitset_stats_subset_p (bitset dst, bitset src){  BITSET_CHECK2_ (dst, src);  return BITSET_SUBSET_P_ (dst->s.bset, src->s.bset);}static voidbitset_stats_and (bitset dst, bitset src1, bitset src2){  BITSET_CHECK3_ (dst, src1, src2);  BITSET_AND_ (dst->s.bset, src1->s.bset, src2->s.bset);}static boolbitset_stats_and_cmp (bitset dst, bitset src1, bitset src2){  BITSET_CHECK3_ (dst, src1, src2);  return BITSET_AND_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset);}static voidbitset_stats_andn (bitset dst, bitset src1, bitset src2){  BITSET_CHECK3_ (dst, src1, src2);  BITSET_ANDN_ (dst->s.bset, src1->s.bset, src2->s.bset);}static boolbitset_stats_andn_cmp (bitset dst, bitset src1, bitset src2){  BITSET_CHECK3_ (dst, src1, src2);  return BITSET_ANDN_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset);}static voidbitset_stats_or (bitset dst, bitset src1, bitset src2){  BITSET_CHECK3_ (dst, src1, src2);  BITSET_OR_ (dst->s.bset, src1->s.bset, src2->s.bset);}static boolbitset_stats_or_cmp (bitset dst, bitset src1, bitset src2){  BITSET_CHECK3_ (dst, src1, src2);  return BITSET_OR_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset);}static voidbitset_stats_xor (bitset dst, bitset src1, bitset src2){  BITSET_CHECK3_ (dst, src1, src2);  BITSET_XOR_ (dst->s.bset, src1->s.bset, src2->s.bset);}static boolbitset_stats_xor_cmp (bitset dst, bitset src1, bitset src2){  BITSET_CHECK3_ (dst, src1, src2);  return BITSET_XOR_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset);}static voidbitset_stats_and_or (bitset dst, bitset src1, bitset src2, bitset src3){  BITSET_CHECK4_ (dst, src1, src2, src3);  BITSET_AND_OR_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset);}static boolbitset_stats_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3){  BITSET_CHECK4_ (dst, src1, src2, src3);  return BITSET_AND_OR_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset);}static voidbitset_stats_andn_or (bitset dst, bitset src1, bitset src2, bitset src3){  BITSET_CHECK4_ (dst, src1, src2, src3);  BITSET_ANDN_OR_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset);}static boolbitset_stats_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3){  BITSET_CHECK4_ (dst, src1, src2, src3);  return BITSET_ANDN_OR_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset);}static voidbitset_stats_or_and (bitset dst, bitset src1, bitset src2, bitset src3){  BITSET_CHECK4_ (dst, src1, src2, src3);  BITSET_OR_AND_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset);}static boolbitset_stats_or_and_cmp (bitset dst, bitset src1, bitset src2, bitset src3){  BITSET_CHECK4_ (dst, src1, src2, src3);  return BITSET_OR_AND_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset);}static bitset_bindexbitset_stats_list (bitset bset, bitset_bindex *list,		   bitset_bindex num, bitset_bindex *next){  bitset_bindex count;  bitset_bindex tmp;  bitset_bindex size;  bitset_bindex i;  enum bitset_type type;  count = BITSET_LIST_ (bset->s.bset, list, num, next);  type = BITSET_TYPE_ (bset->s.bset);  BITSET_STATS_LISTS_INC (bset->s.bset);  /* Log histogram of number of set bits.  */  for (i = 0, tmp = count; tmp; tmp >>= 1, i++)     continue;  if (i >= BITSET_LOG_COUNT_BINS)     i = BITSET_LOG_COUNT_BINS - 1;  BITSET_STATS_LIST_COUNTS_INC (bset->s.bset, i);  /* Log histogram of number of bits in set.  */  size = BITSET_SIZE_ (bset->s.bset);  for (i = 0, tmp = size; tmp; tmp >>= 1, i++)     continue;  if (i >= BITSET_LOG_SIZE_BINS)     i = BITSET_LOG_SIZE_BINS - 1;  BITSET_STATS_LIST_SIZES_INC (bset->s.bset, i);  /* Histogram of fraction of bits set.  */  i = size ? (count * BITSET_DENSITY_BINS) / size : 0;  if (i >= BITSET_DENSITY_BINS)     i = BITSET_DENSITY_BINS - 1;  BITSET_STATS_LIST_DENSITY_INC (bset->s.bset, i);  return count;}static bitset_bindexbitset_stats_list_reverse (bitset bset, bitset_bindex *list,			   bitset_bindex num, bitset_bindex *next){  return BITSET_LIST_REVERSE_ (bset->s.bset, list, num, next);}static voidbitset_stats_free (bitset bset){  BITSET_STATS_FREES_INC (bset->s.bset);  BITSET_FREE_ (bset->s.bset);}struct bitset_vtable bitset_stats_vtable = {  bitset_stats_set,  bitset_stats_reset,  bitset_stats_toggle,  bitset_stats_test,  bitset_stats_resize,  bitset_stats_size,  bitset_stats_count,  bitset_stats_empty_p,  bitset_stats_ones,  bitset_stats_zero,  bitset_stats_copy,  bitset_stats_disjoint_p,  bitset_stats_equal_p,  bitset_stats_not,  bitset_stats_subset_p,  bitset_stats_and,  bitset_stats_and_cmp,  bitset_stats_andn,  bitset_stats_andn_cmp,  bitset_stats_or,  bitset_stats_or_cmp,  bitset_stats_xor,  bitset_stats_xor_cmp,  bitset_stats_and_or,  bitset_stats_and_or_cmp,  bitset_stats_andn_or,  bitset_stats_andn_or_cmp,  bitset_stats_or_and,  bitset_stats_or_and_cmp,  bitset_stats_list,  bitset_stats_list_reverse,  bitset_stats_free,  BITSET_STATS};/* Return enclosed bitset type.  */enum bitset_typebitset_stats_type_get (bitset bset){   return BITSET_TYPE_ (bset->s.bset);}size_tbitset_stats_bytes (void){  return sizeof (struct bitset_stats_struct);}bitsetbitset_stats_init (bitset bset, bitset_bindex n_bits, enum bitset_type type){  size_t bytes;  bitset sbset;  bset->b.vtable = &bitset_stats_vtable;  /* Disable cache.  */  bset->b.cindex = 0;  bset->b.csize = 0;  bset->b.cdata = 0;  BITSET_NBITS_ (bset) = n_bits;  /* Set up the actual bitset implementation that     we are a wrapper over.  */  switch (type)    {    case BITSET_ARRAY:      bytes = abitset_bytes (n_bits);      sbset = (bitset) xcalloc (1, bytes);      abitset_init (sbset, n_bits);      break;    case BITSET_LIST:      bytes = lbitset_bytes (n_bits);      sbset = (bitset) xcalloc (1, bytes);      lbitset_init (sbset, n_bits);      break;    case BITSET_TABLE:      bytes = ebitset_bytes (n_bits);      sbset = (bitset) xcalloc (1, bytes);      ebitset_init (sbset, n_bits);      break;    case BITSET_VARRAY:      bytes = vbitset_bytes (n_bits);      sbset = (bitset) xcalloc (1, bytes);      vbitset_init (sbset, n_bits);      break;    default:      abort ();    }  bset->s.bset = sbset;  BITSET_STATS_ALLOCS_INC (type);  return bset;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -