~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_bit.h

  • Committer: Brian Aker
  • Date: 2008-08-10 22:14:13 UTC
  • Revision ID: brian@tangent.org-20080810221413-ablfnyr3wgu6fjaw
ulong conversion. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
  This can be used to divide a number with value by doing a shift instead
13
13
*/
14
14
 
15
 
static inline uint my_bit_log2(ulong value)
 
15
static inline uint my_bit_log2(uint32_t value)
16
16
{
17
17
  uint bit;
18
18
  for (bit=0 ; value > 1 ; value>>=1, bit++) ;
24
24
#if SIZEOF_LONG_LONG > 4
25
25
  /* The following code is a bit faster on 16 bit machines than if we would
26
26
     only shift v */
27
 
  ulong v2=(ulong) (v >> 32);
 
27
  uint32_t v2=(uint32_t) (v >> 32);
28
28
  return (uint) (uchar) (_my_bits_nbits[(uchar)  v] +
29
29
                         _my_bits_nbits[(uchar) (v >> 8)] +
30
30
                         _my_bits_nbits[(uchar) (v >> 16)] +