[LinuxBIOS] Another dumb C question
peter at stuge.se
Thu Jul 12 11:16:52 CEST 2007
On Thu, Jul 12, 2007 at 05:00:23AM -0400, Joseph Smith wrote:
> I have another newbie C question.
> Is this the same as 2^9 ??
Note that ^ means XOR in C. Exclusive or. Output 1 when only one
input bit is 1, but not both.
> value = 9
> (2 << (value - 1))
> This will give me 512, but will it work no matter what "value" is?
> Or does linuxbios already have a "to the power of" global function?
No pow() in LB and the pow() in libm uses doubles so it's bad for the
Bit shift is fine methinks but I would suggest:
(1 << value)
(2 << (value - 1))
More information about the coreboot