Difference between revisions of "Interview Preparation Bit Fiddling"
From Embedded Systems Learning Academy
(Created page with "This article prepares you for the bit-fiddling questions. The source code should guide you through by example. If you get confused at any step, you can try the source code y...") |
(No difference)
|
Revision as of 22:22, 7 July 2013
This article prepares you for the bit-fiddling questions. The source code should guide you through by example. If you get confused at any step, you can try the source code yourself using a debugger. Note that none of the code has been tested to compile :(
Find Highest Bit Set
/* Find the highest bit that has been set in a uint32 variable */
uint32_t find_highest_bit_num(uint32_t num)
{
}
/* Well, that is too slow, so find the highest big faster */
uint32_t find_highest_bit_num(uint32_t num)
{
}