[Implemented] bit-wise enumerations.
[Implemented] bit-wise enumerations.
I frequently use constants for bit-enumeration (1,2,4,8,16,32,64,128 etc) It would be nice if there was an enumeration form that automatically incremented by doubling vs. adding 1.
Re: bit-wise enumerations.
Can't you just use a macro ?
Code: Select all
Macro POW2
(#PB_Compiler_EnumerationValue - 1) << 1
EndMacro
Enumeration
#ONE = 1
#TWO = POW2
#THREE = POW2
#FOUR = POW2
#FIVE = POW2
#SIX = POW2
EndEnumeration
Debug #ONE
Debug #TWO
Debug #THREE
Debug #FOUR
Debug #FIVE
Debug #SIX
"Have you tried turning it off and on again ?"
A little PureBasic review
A little PureBasic review