You can use the shift operator for the range of values 0 to 31, but you
probably won't need more:
result = 1 << power;
As a define it would be something like:
#define POW2TON(power) 1 << power
but I don't see any reason to do that. Macros are best avoided.
Jason.
----- Original Message -----
From: "Albert Vilella Bertran" <vil...@ya...>
To: <dev...@li...>
Sent: Friday, November 16, 2001 6:16 PM
Subject: [Dev-C++] #define for 2^n
> Super-simple-question:
>
> Does anyone know how to implement the function 2^n into a "#define"?
>
> thanks
>
>
>
> _______________________________________________________________
> Do You Yahoo!?
> Yahoo! Messenger
> Comunicación instantánea gratis con tu gente.
> http://messenger.yahoo.es
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|