Difference between revisions of "$biton"

From Scriptwiki
Jump to: navigation, search
 
m (missed a change of off -> on)
Line 1: Line 1:
 
Bitoff returns the given number with the Nth bit turned on.
 
Bitoff returns the given number with the Nth bit turned on.
  
  $bitoff(decimal number, N)
+
  $biton(decimal number, N)
  
 
* Decimal number is the number to perform the operation on given in decimal form (Base 10)
 
* Decimal number is the number to perform the operation on given in decimal form (Base 10)

Revision as of 18:09, 10 May 2008

Bitoff returns the given number with the Nth bit turned on.

$biton(decimal number, N)
  • Decimal number is the number to perform the operation on given in decimal form (Base 10)
  • N is the bit to turn on.

Example

$biton(5,2)

The binary value of 5 is taken

00000101

And the second bit is turned on(second from the right)

00000111
Returns: 7