Difference between revisions of "Bit"

From SimsWiki
Jump to: navigation, search
 
(Example)
 
Line 7: Line 7:
 
Bit number 3 when set gives a value 0x04.
 
Bit number 3 when set gives a value 0x04.
  
Turning on bits number 1 and 4 gives a value 0x05.
+
Turning on bits number 1 and 3 gives a value 0x05.
  
 
Turning on any bit twice doesn't change the value. The switch is on, it can't be on any more.
 
Turning on any bit twice doesn't change the value. The switch is on, it can't be on any more.

Latest revision as of 13:38, 22 April 2011

[edit] Overview

Lots of things in SimAntics are represented by bit flags. If you are a programmer you may already be familiar with adding up bit numbers, if you are not, this page is for you! Think of bits like switches. If switch number 1 (bit 1) is turned on then a certain thing happens. Several switches can be on at once whilst others are off.

[edit] Example

Bit number 1 when set gives a value 0x01.
Bit number 2 when set gives a value 0x02.
Bit number 3 when set gives a value 0x04.

Turning on bits number 1 and 3 gives a value 0x05.

Turning on any bit twice doesn't change the value. The switch is on, it can't be on any more.

Personal tools
Namespaces

Variants
Actions
Navigation
game select
Toolbox