~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_bit.h

  • Committer: Monty Taylor
  • Date: 2009-03-25 21:06:47 UTC
  • mto: This revision was merged to the branch mainline in revision 964.
  • Revision ID: mordred@inaugust.com-20090325210647-7j1tm98gvct3jxsu
Removed legacy_db_type.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
static inline uint32_t my_count_bits(uint64_t v)
25
25
{
26
 
#if SIZEOF_LONG_LONG > 4
27
26
  /* The following code is a bit faster on 16 bit machines than if we would
28
27
     only shift v */
29
28
  uint32_t v2=(uint32_t) (v >> 32);
30
 
  return (uint) (unsigned char) (_my_bits_nbits[(unsigned char)  v] +
 
29
  return (uint32_t) (unsigned char) (_my_bits_nbits[(unsigned char)  v] +
31
30
                         _my_bits_nbits[(unsigned char) (v >> 8)] +
32
31
                         _my_bits_nbits[(unsigned char) (v >> 16)] +
33
32
                         _my_bits_nbits[(unsigned char) (v >> 24)] +
35
34
                         _my_bits_nbits[(unsigned char) (v2 >> 8)] +
36
35
                         _my_bits_nbits[(unsigned char) (v2 >> 16)] +
37
36
                         _my_bits_nbits[(unsigned char) (v2 >> 24)]);
38
 
#else
39
 
  return (uint) (unsigned char) (_my_bits_nbits[(unsigned char)  v] +
40
 
                         _my_bits_nbits[(unsigned char) (v >> 8)] +
41
 
                         _my_bits_nbits[(unsigned char) (v >> 16)] +
42
 
                         _my_bits_nbits[(unsigned char) (v >> 24)]);
43
 
#endif
44
37
}
45
38
 
46
 
static inline uint32_t my_count_bits_ushort(ushort v)
 
39
static inline uint32_t my_count_bits_uint16(uint16_t v)
47
40
{
48
41
  return _my_bits_nbits[v];
49
42
}