~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_bitmap.cc

  • Committer: Padraig O'Sullivan
  • Date: 2009-03-21 20:26:28 UTC
  • mto: (960.2.5 mordred)
  • mto: This revision was merged to the branch mainline in revision 961.
  • Revision ID: osullivan.padraig@gmail.com-20090321202628-nh6qsi825m4d4av6
Removing the queues.[h,cc] files from the mysys directory. The only place
where they are needed now is in the MyISAM storage engine. Thus, I moved the
files there and updated the files in the MyISAM storage engine
appropriately.

Show diffs side-by-side

added added

removed removed

Lines of Context:
83
83
}
84
84
 
85
85
 
86
 
static inline void bitmap_lock(MY_BITMAP *map __attribute__((unused)))
 
86
static inline void bitmap_lock(MY_BITMAP *map)
87
87
{
88
88
  if (map->mutex)
89
89
    pthread_mutex_lock(map->mutex);
90
90
}
91
91
 
92
 
static inline void bitmap_unlock(MY_BITMAP *map __attribute__((unused)))
 
92
static inline void bitmap_unlock(MY_BITMAP *map)
93
93
{
94
94
  if (map->mutex)
95
95
    pthread_mutex_unlock(map->mutex);
96
96
}
97
97
 
98
98
 
99
 
bool bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint32_t n_bits,
100
 
                    bool thread_safe __attribute__((unused)))
 
99
bool bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint32_t n_bits, bool thread_safe)
101
100
{
102
101
  if (!buf)
103
102
  {
109
108
      extra= sizeof(pthread_mutex_t);
110
109
    }
111
110
    map->mutex= 0;
112
 
    if (!(buf= (my_bitmap_map*) my_malloc(size_in_bytes+extra, MYF(MY_WME))))
 
111
    if (!(buf= (my_bitmap_map*) malloc(size_in_bytes+extra)))
113
112
      return(1);
114
113
    if (thread_safe)
115
114
    {
274
273
      goto ret;
275
274
  res= 1;
276
275
ret:
277
 
  return res; 
 
276
  return res;
278
277
}
279
278
 
280
279
 
445
444
 
446
445
 
447
446
uint32_t bitmap_bits_set(const MY_BITMAP *map)
448
 
{  
 
447
{
449
448
  unsigned char *m= (unsigned char*)map->bitmap;
450
449
  unsigned char *end= m + no_bytes_in_map(map);
451
450
  uint32_t res= 0;
453
452
  assert(map->bitmap);
454
453
  *map->last_word_ptr&= ~map->last_word_mask; /*Reset last bits to zero*/
455
454
  while (m < end)
456
 
    res+= my_count_bits_ushort(*m++);
 
455
    res+= my_count_bits_uint16(*m++);
457
456
  return res;
458
457
}
459
458
 
494
493
            if (*byte_ptr & (1 << k))
495
494
              return (i*32) + (j*8) + k;
496
495
          }
497
 
          assert(0);
498
496
        }
499
497
      }
500
 
      assert(0);
501
498
    }
502
499
  }
503
500
  return MY_BIT_NONE;
520
517
    {
521
518
      byte_ptr= (unsigned char*)data_ptr;
522
519
      for (j=0; ; j++, byte_ptr++)
523
 
      { 
 
520
      {
524
521
        if (*byte_ptr != 0xFF)
525
522
        {
526
523
          for (k=0; ; k++)
528
525
            if (!(*byte_ptr & (1 << k)))
529
526
              return (i*32) + (j*8) + k;
530
527
          }
531
 
          assert(0);
532
528
        }
533
529
      }
534
 
      assert(0);
535
530
    }
536
531
  }
537
532
  return MY_BIT_NONE;
698
693
}
699
694
 
700
695
 
701
 
/* 
 
696
/*
702
697
  SYNOPSIS
703
698
    bitmap_get_first()
704
699
      map
705
 
  RETURN 
 
700
  RETURN
706
701
    Number of first unset bit in the bitmap or MY_BIT_NONE if all bits are set.
707
702
*/
708
703
uint32_t bitmap_lock_get_first(const MY_BITMAP *map)
795
790
  return true;
796
791
}
797
792
 
798
 
bool test_operators(MY_BITMAP *map __attribute__((unused)),
799
 
                    uint32_t bitsize __attribute__((unused)))
 
793
bool test_operators(MY_BITMAP *, uint32_t)
800
794
{
801
795
  return false;
802
796
}