SETBIT: Difference between revisions
Jump to navigation
Jump to search
Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link
(Created page with "{{DISPLAYTITLE:_SETBIT}} The _SETBIT function is used to set a specified bit of a numerical value to 1 (on state). {{PageSyntax}} :{{Parameter|result}} = _SETBIT({{Parameter|numericalVariable}}, {{Parameter|numericalValue}}) {{Parameters}} * {{Parameter|numericalVariable}} is the variable to set the bit of and can be of the following types: _BYTE, INTEGER, LONG, or _INTEGER64. * Integer values can be signed or _UNSIGNED. * {{Parameter|nume...") |
No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 7: | Line 7: | ||
{{ | {{PageParameters}} | ||
* {{Parameter|numericalVariable}} is the variable to set the bit of and can be of the following types: [[_BYTE]], [[INTEGER]], [[LONG]], or [[_INTEGER64]]. | * {{Parameter|numericalVariable}} is the variable to set the bit of and can be of the following types: [[_BYTE]], [[INTEGER]], [[LONG]], or [[_INTEGER64]]. | ||
* Integer values can be signed or [[_UNSIGNED]]. | * Integer values can be signed or [[_UNSIGNED]]. | ||
Line 18: | Line 18: | ||
* Bits start at 0 (so a [[_BYTE]] has bits 0 to 7, [[INTEGER]] 0 to 15, and so on) | * Bits start at 0 (so a [[_BYTE]] has bits 0 to 7, [[INTEGER]] 0 to 15, and so on) | ||
{{PageAvailability}} | |||
* '''Version 1.4 and up'''. | * '''Version 1.4 and up'''. | ||
Line 33: | Line 34: | ||
64 | 64 | ||
{{OutputEnd}} | {{OutputEnd}} | ||
Line 40: | Line 40: | ||
* [[_READBIT]], [[_BYTE]], [[_INTEGER64]] | * [[_READBIT]], [[_BYTE]], [[_INTEGER64]] | ||
* [[_RESETBIT]], [[_TOGGLEBIT]] | * [[_RESETBIT]], [[_TOGGLEBIT]] | ||
{{PageNavigation}} | {{PageNavigation}} |
Latest revision as of 01:05, 29 January 2023
The _SETBIT function is used to set a specified bit of a numerical value to 1 (on state).
Syntax
- result = _SETBIT(numericalVariable, numericalValue)
Parameters
- numericalVariable is the variable to set the bit of and can be of the following types: _BYTE, INTEGER, LONG, or _INTEGER64.
- Integer values can be signed or _UNSIGNED.
- numericalValue the number of the bit to be set.
Description
- Can be used to manually manipulate individual bits of an integer value by setting them to 1 (on state).
- Setting a bit that is already set to 1 will have no effect.
- Bits start at 0 (so a _BYTE has bits 0 to 7, INTEGER 0 to 15, and so on)
Availability
- Version 1.4 and up.
Examples
Example 1:
A~%% = 0 '_UNSIGNED _BYTE PRINT A~%% A~%% = _SETBIT(A~%%,6) 'set the seventh bit of A~%% PRINT A~%% |
0 64 |
See also