BIS fnc encodeFlags2: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "<code>([^<]*)\[\[([a-zA-Z][a-zA-Z0-9_]+)\]\]([^<]*) *<\/code>" to "<code>$1$2$3</code>")
m (Text replacement - "Link\|https:\/\/en\.wikipedia\.org\/([^w][^i])" to "Link|https://en.wikipedia.org/wiki/$1")
 
(7 intermediate revisions by the same user not shown)
Line 7: Line 7:


|descr= Encodes array of unique binary flags (zeroes or ones) into a single scalar.
|descr= Encodes array of unique binary flags (zeroes or ones) into a single scalar.
{{Feature | important | Note that the input array is in {{Wikipedia|Endianness#Definition|Big Endian}}, meaning that the smallest value is '''to the left'''.}}
{{Feature | important | Note that the input array is in {{Link|https://en.wikipedia.org/wiki/Endianness#Definition|Big Endian}}, meaning that the smallest value is '''to the left'''.}}


|s1= arrayOfNumbers call [[BIS_fnc_encodeFlags2]]
|s1= arrayOfNumbers call [[BIS_fnc_encodeFlags2]]
Line 15: Line 15:
|r1= [[Number]] - the calculated number
|r1= [[Number]] - the calculated number


|x1= <code>private _result = [1,0,1,1] [[call]] [[BIS_fnc_encodeFlags2]];
|x1= <sqf>private _result = [1,0,1,1] call BIS_fnc_encodeFlags2;
[[hint]] [[str]] _result; {{cc|Displays 13}}</code>
hint str _result; // Displays 13</sqf>


|seealso= [[BIS_fnc_encodeFlags]] [[BIS_fnc_encodeFlags4]] [[BIS_fnc_encodeFlags8]]
|seealso= [[BIS_fnc_encodeFlags]] [[BIS_fnc_encodeFlags4]] [[BIS_fnc_encodeFlags8]]
[[BIS_fnc_decodeFlags]] [[BIS_fnc_decodeFlags2]] [[BIS_fnc_decodeFlags4]] [[BIS_fnc_decodeFlags8]]
[[BIS_fnc_decodeFlags]] [[BIS_fnc_decodeFlags2]] [[BIS_fnc_decodeFlags4]] [[BIS_fnc_decodeFlags8]]
}}
}}

Latest revision as of 23:11, 23 February 2023

Hover & click on the images for description

Description

Description:
Encodes array of unique binary flags (zeroes or ones) into a single scalar.
Note that the input array is in Big Endian, meaning that the smallest value is to the left.
Execution:
call
Groups:
Bitwise

Syntax

Syntax:
arrayOfNumbers call BIS_fnc_encodeFlags2
Parameters:
arrayOfNumbers: Array of Numbers - "boolean" flags where 0 = false and 1 = true
Return Value:
Number - the calculated number

Examples

Example 1:
private _result = [1,0,1,1] call BIS_fnc_encodeFlags2; hint str _result; // Displays 13

Additional Information

See also:
BIS_fnc_encodeFlags BIS_fnc_encodeFlags4 BIS_fnc_encodeFlags8 BIS_fnc_decodeFlags BIS_fnc_decodeFlags2 BIS_fnc_decodeFlags4 BIS_fnc_decodeFlags8

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