## 位运算简介

amnesiac
Posts: 186
Joined: 22 Nov 2013, 03:08
Location: Egret Island, China
Contact:

### 位运算简介

Code: Select all

`````` 1100
&1010
_____
1000``````

Code: Select all

`````` 1100
|1010
_____
1110``````

Code: Select all

``````~1010
_____
0101``````

Code: Select all

``````~0001
_____
1110``````

Code: Select all

`````` 1010
^1100
_____
0110``````

Code: Select all

``````00001010 << 3
_____________
01010000``````

Code: Select all

``````0011100 >> 2
____________
0000111``````

Code: Select all

``````0101 >> 1
_________
0010``````

Code: Select all

``````0011      （二进制表示的 3）
>> 1      （右移 1 位）
____
0001      （二进制表示的 1）``````

Code: Select all

``````MyVar := 5 ; 二进制的 101
MyVar |= 2 ; 101 | 010 = 111（二进制）= 7（十进制）
MsgBox % MyVar ; 7

MyVar := 5  ; 二进制的 101
MyVar <<= 2 ; 101<<2 = 10100（二进制）= 20（十进制）
MsgBox % MyVar ; 20``````

Code: Select all

``````LOWORD := wParam & 0xffff
HIWORD := wParam >> 16``````

LOWORD := NumGet(wParam, 0, "short")
HIWORD := NumGet(wParam, 2, "short")

Code: Select all

``MsgBox, % 4|16, title, text``

Code: Select all

``````If (VarContaining35 & 32)
; 添加“?”图标``````
AutoHotkey 学习指南（Beauty of AutoHotkey）
I do not make codes, and only a porter of AutoHotkey: from official to Chinese, from other languages to AutoHotkey, and show AutoHotkey to ordinary users sometimes.
lcaird
Posts: 1
Joined: 26 Aug 2014, 08:58

### Re: 位运算简介

amnesiac
Posts: 186
Joined: 22 Nov 2013, 03:08
Location: Egret Island, China
Contact:

### Re: 位运算简介

lcaird wrote:帖子结尾部分，提取wParam 参数的高字和低字时，amnesiac你提到使用 Numget( ) 是错误的。

### Who is online

Users browsing this forum: No registered users and 2 guests