bitset

Navigation:  Language Reference > Operators > Binary >

bitset

Previous pageReturn to chapter overviewNext page

Syntax

y = a bitset b

Description

a bitset b sets the bth bit of a. Both a and b are treated as 32-bit (4-byte) integer values, so an eventual fraction will be ignored.

Example

In 20-sim, all bitwise function arguments are treated as 32-bit integers. Thus the binary representation of 30 (ignoring leading zeroes) is equal to 11110 as shown in the figure below. The operation 30 bitset 1 sets the last bit of 11110 to one which gives 11111. This binary value corresponds with a decimal value of 31.

 

 

Bitoperators

Limitations

a and b must be integers.