Yes I know that, but pow is farder less efficient than bit shifting and with bit shifting the function becomes extremly simple...Originally Posted by Stoned_Coder
Again I'm waiting for cisokay
Yes I know that, but pow is farder less efficient than bit shifting and with bit shifting the function becomes extremly simple...Originally Posted by Stoned_Coder
Again I'm waiting for cisokay
pow function instead of shifting? Man that must be some good stuff, Stoned.
Quzah.
Hope is the first step on the road to disappointment.
Thank you all for your great comments and hints. I actually solved this yesterday using the nice bitset class. Though, these other methods are great as well. Thank you all.
Code:int to_dec(char *n){ int res=0; while(*n){ res<<=1; res |= (*n++-'0')&1; } return res; }