KiCad PCB EDA Suite
bitops.h File Reference

Go to the source code of this file.

Functions

static unsigned int lobit (unsigned int x)
 
static unsigned int hibit (unsigned int x)
 

Function Documentation

static unsigned int hibit ( unsigned int  x)
inlinestatic

Definition at line 80 of file bitops.h.

81 {
82  unsigned int res = 0;
83 
84  while( x > 0xff )
85  {
86  x >>= 8;
87  res += 8;
88  }
89 
90  while( x )
91  {
92  x >>= 1;
93  res += 1;
94  }
95 
96  return res;
97 }
static unsigned int lobit ( unsigned int  x)
inlinestatic

Definition at line 60 of file bitops.h.

Referenced by bm_readbody_bmp(), and gm_readbody_bmp().

61 {
62  unsigned int res = 32;
63 
64  while( x & 0xffffff )
65  {
66  x <<= 8;
67  res -= 8;
68  }
69 
70  while( x )
71  {
72  x <<= 1;
73  res -= 1;
74  }
75 
76  return res;
77 }