RESETBIT: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
(Created page with "{{DISPLAYTITLE:_RESETBIT}} The _RESETBIT function is used to set a specified bit of a numerical value to 0 (OFF state). {{PageSyntax}} :{{Parameter|result}} = _RESETBIT({{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. * {{Paramet...")
 
No edit summary
Line 7: Line 7:




{{Parameters}}
{{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]].

Revision as of 02:16, 24 January 2023

The _RESETBIT function is used to set a specified bit of a numerical value to 0 (OFF state).


Syntax

result = _RESETBIT(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 0 (OFF state).
  • Resetting a bit that is already set to 0 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~%%
A~%% = _RESETBIT(A~%%,6) 'Reset the seventh bit of A~%%
PRINT A~%%
 0
 64
 0


See also


Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link