BIS fnc decodeFlags8: Difference between revisions

From Bohemia Interactive Community
m (Text replacement - "bis_fnc_" to "BIS_fnc_")
No edit summary
 
Line 6: Line 6:
|gr1= Bitwise
|gr1= Bitwise


|descr= <pre>/*
|descr= Decodes a single scalar into array of unique 8-state flags (values 0,1,2,3,4,5,6,7).
Decodes a single scalar into array of unique 8-state flags (values 0,1,2,3,4,5,6,7). Max. number that can be decoded is 16777215 (= 8^8 - 1). An optional parameter can by supplied to resize the output.


Syntax:
|s1= [encodedFlags, size] call [[BIS_fnc_decodeFlags8]]
-------
_flags:array = _encodedFlags:scalar call BIS_fnc_decodeFlags8;
_flags:array = [_encodedFlags:scalar,_size:scalar] call BIS_fnc_decodeFlags8;


Example:
|p1= encodedFlags: [[Number]] - non-decimal number between 0 and 16777215
--------
|p2= size: [[Number]] - (Optional, default -1) output size. Size -1 means output will not be resized
[7,2,3,0,1] = 4311 call BIS_fnc_decodeFlags8;
[7,2,3,0,1,0,0,0] = [4311,8] call BIS_fnc_decodeFlags8;


Explanation:
|r1= [[Number]] - decoded flags
------------
4311 -> 0001 0000 1101 0111 -> 001 000 011 010 111 -> [7,2,3,0,1]
*/</pre>{{Wiki|placeholder}}<!-- Remove this after fill-in -->


|s1= [] call [[BIS_fnc_decodeFlags8]]
|x1= <sqf>private _decodedFlags = 4311 call BIS_fnc_decodeFlags8; // [7,2,3,0,1]</sqf>
|x2= <sqf>private _decodedFlags = [4311, 8] call BIS_fnc_decodeFlags8; // [7,2,3,0,1,0,0,0]</sqf>


|p1=
|seealso= [[BIS_fnc_encodeFlags8]]
 
|r1=
 
|x1=
 
|seealso=
}}
}}

Latest revision as of 21:02, 24 June 2025

Hover & click on the images for description

Description

Description:
Decodes a single scalar into array of unique 8-state flags (values 0,1,2,3,4,5,6,7).
Execution:
call
Groups:
Bitwise

Syntax

Syntax:
[encodedFlags, size] call BIS_fnc_decodeFlags8
Parameters:
encodedFlags: Number - non-decimal number between 0 and 16777215
size: Number - (Optional, default -1) output size. Size -1 means output will not be resized
Return Value:
Number - decoded flags

Examples

Example 1:
private _decodedFlags = 4311 call BIS_fnc_decodeFlags8; // [7,2,3,0,1]
Example 2:
private _decodedFlags = [4311, 8] call BIS_fnc_decodeFlags8; // [7,2,3,0,1,0,0,0]

Additional Information

See also:
BIS_fnc_encodeFlags8

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note