BitOR

首页  后退  前进

BitOR
down2

BitOR

执行逐位 OR(或) 运算.

 

BitOR ( value1, value2 [, value n] )

参数

value1

第一个数.

value2

第二个数.

value n

[可选] 第 N 个数 - 最多可指定 255 个值.

返回值

返回参数按位 OR(或) 运算后的结果.

位操作均为 32 位整数.

备注

数字可以用十六进制表示法.

BitOR() 比较全部参数的对应数位,

对应数位至少有一个 0, 则返回结果的对应位为 0;

对应数位至少有一个 1, 则返回结果的对应位为 1.

 

函数示例

#include <MsgBoxConstants.au3>
Example()
Func Example()
    ; Note: "b" is the symbol for byte.
    ; Assign a Local variable the bitwise OR operation of 1 and 0.
    Local $iBitOR1 = BitOR(1, 0) ; 0001b OR 0000b = 0001b
    ; Display the result.
    MsgBox($MB_SYSTEMMODAL, "", $iBitOR1)
    ; Assign a Local variable the bitwise OR operation of 1 and 1.
    Local $iBitOR2 = BitOR(1, 1) ; 0001b OR 0001b = 0001b
    ; Display the result.
    MsgBox($MB_SYSTEMMODAL, "", $iBitOR2)
    ; Assign a Local variable the bitwise OR operation of 13 (1101b) and 7 (0111b).
    Local $iBitOR3 = BitOR(13, 7) ; 1101b OR 0111b = 1111b
    ; Display the result.
    MsgBox($MB_SYSTEMMODAL, "", $iBitOR3)
    ; Assign a Local variable the bitwise OR operation of 2 (0010b), 3 (0011b) and 6 (0110b).
    Local $iBitOR4 = BitOR(2, 3, 6) ; 0010b OR 0011b OR 0110b = 0111b
    ; Display the result.
    MsgBox($MB_SYSTEMMODAL, "", $iBitOR4)
EndFunc   ;==>Example

----------------------------------------

 

该函数可以通过命令 exect 调用

参见:

BitAND, BitNOT, BitShift, BitXOR, Hex, BitRotate

例子
copy
BitOR(3,6) ;; 返回7,因为0011 OR 0110 = 0111

BitOR(3,15,32) ;; 返回47,因为0011 OR 1111 OR 00100000 = 00101111

 

;; 00000011

;; 00001111

;; 00100000

;; -------------

;; 00101111

;; 如果0列中的所有数字,则返回0,否则返回0

 

exect=BitOR(3,6) GLOBALEXECT<a> ;; 执行按位加法运算(算术或)。 (返回7)

 

exect=_ViewValues(BitOR(4,64,768)) ;;计算并显示结果

up2

tcimage © Аверин Андрей для Total Commander Image Averin-And@yandex.ru