BitOnInteger and BitOrInteger (Float functions): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{Template:Float:BitOnInteger and BitOrInteger subtitle}}
{{Template:Float:BitOnInteger and BitOrInteger subtitle}}


These [[Intrinsic classes|intrinsic]] functions perform a logical OR of the bits of two integers, that is, output bits are "on" if they are "on" in either of the inputs.
These [[Intrinsic classes|intrinsic]] functions perform a logical OR of the binary bits of two integers: that is, if the bits are "on" in either of the inputs, they are "on" in the output integer.


==Syntax==
==Syntax==
{{Template:Float:BitOnInteger syntax}}
{{Template:Float:BitOnInteger syntax}}
{{Template:Float:BitOrInteger syntax}}
{{Template:Float:BitOrInteger syntax}}
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%result</th><td>A variable to receive the result of ORing together the bits of <var class="term">float</var> and <var class="term">orBits</var>.</td></tr>
<tr><th>%result</th>
<tr><th>float</th><td>One of the integers to be ORed.</td></tr>
<td>A variable to receive the result of ORing together the bits of <var class="term">float</var> and <var class="term">onBits</var> (or of <var class="term">float</var> and <var class="term">orBits</var>).</td></tr>
 
<tr><th>float</th><td>An integer.</td></tr>


<tr><th>onBits</th><td>The other integer to be ORed.</td></tr>
<tr><th>onBits</th><td>An integer to be ORed with <var class="term">float</var>.</td></tr>
<tr><th>orBits</th><td>The other integer to be ORed.</td></tr>


<tr><th>orBits</th><td>An integer to be ORed with <var class="term">float</var>.</td></tr>
</table>
</table>


Line 20: Line 23:


==Examples==
==Examples==
<ol>
<li>For <code>%x = 10</code>, the following statements each produce the integer <code>26</code>:
<p class="code">%num = %x:bitOnInteger(16)}
%num = %x:bitOnInteger(18)}
</p>


<ol><li>The following statement rounds an integer up to the nearest odd integer:
<li>The following statement rounds an integer up to the nearest odd integer:
<p class="code">%y = %x:bitOnInteger(1)
<p class="code">%y = %x:bitOnInteger(1)
</p></ol>
</p>
</ol>


==See also==
==See also==
{{Template:Float:BitOrInteger footer}}
{{Template:Float:BitOrInteger footer}}

Latest revision as of 21:50, 1 November 2012

Bitwise Or of integers (Float class)

[Introduced in Sirius Mods 7.9]


These intrinsic functions perform a logical OR of the binary bits of two integers: that is, if the bits are "on" in either of the inputs, they are "on" in the output integer.

Syntax

%result = float:BitOnInteger( onBits)

%result = float:BitOrInteger( orBits)

Syntax terms

%result A variable to receive the result of ORing together the bits of float and onBits (or of float and orBits).
floatAn integer.
onBitsAn integer to be ORed with float.
orBitsAn integer to be ORed with float.

Usage notes

  • The BitOrInteger function is available as of Sirius Mods Version 7.9

Examples

  1. For %x = 10, the following statements each produce the integer 26:

    %num = %x:bitOnInteger(16)} %num = %x:bitOnInteger(18)}

  2. The following statement rounds an integer up to the nearest odd integer:

    %y = %x:bitOnInteger(1)

See also