fire-eggs / CivOne

An open source implementation of Sid Meier's Civilization 1 using C# and .NET.
Creative Commons Zero v1.0 Universal
21 stars 4 forks source link

Code style: Suggestion to use binary notation (with 8bit shift) #147

Open iegik opened 3 years ago

iegik commented 3 years ago

For better reading, I suggest to use binary notation for values with type byte[8]

0b00000001 == 0x01 == 1 // Sentry
0b00000010 == 0x02 == 2 // Road
...
0b01000000 == 0x40 == 64 // Irrigate
...
0b10000000 == 0x80 == 128 // Mines
...
0b11000000 == 0xc0 == 128 + 64 // Fortress
...
0b11111111 == 0xff == 255

Cons/pros?

fire-eggs commented 3 years ago

No cons - hex notation is to be preferred! Make it so!