SetBit function

Returns an long with specific bits set to a specific state, where 'origValue' is the input value to perform the action on, 'bitArray' is a array containing a list bit numbers (starting from 1) to set the state of, and 'bitState' is either 1 or 0, indicating which state to set those bits.

Namespace

logical

Input

  • origValue (long)

  • bitArray (int[])

  • bitState (1 or 0)

Output

number (long)

Example

If origValue contains the number 352, bitArray contains the list [2,4,8], and bitState contains the value 1, then the following two functions are equivalent, and return the value 494:

set-column val logical:SetBit(356, [2,4,8], 1) set-column val logical:Not(origValue, bitArray, bitState) set-column val logical:Not('value')

 

Created in 2020 by Google Inc.