forked from vim-jp/vital.vim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBitwise.txt
72 lines (49 loc) · 2.29 KB
/
Bitwise.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
*vital/Bitwise.txt* bitwise operators.
Maintainer: thinca <[email protected]>
==============================================================================
CONTENTS *Vital.Bitwise-contents*
INTRODUCTION |Vital.Bitwise-introduction|
INTERFACE |Vital.Bitwise-interface|
FUNCTIONS |Vital.Bitwise-functions|
==============================================================================
INTRODUCTION *Vital.Bitwise-introduction*
*Vital.Bitwise* provides some bitwise operators.
If vim provides builtin functions, uses these directly.
==============================================================================
INTERFACE *Vital.Bitwise-interface*
------------------------------------------------------------------------------
FUNCTIONS *Vital.Bitwise-functions*
and({expr}, {expr}) *Vital.Bitwise.and()*
Bitwise AND on the two arguments.
or({expr}, {expr}) *Vital.Bitwise.or()*
Bitwise OR on the two arguments.
xor({expr}, {expr}) *Vital.Bitwise.xor()*
Bitwise XOR on the two arguments.
invert({expr}) *Vital.Bitwise.invert()*
Bitwise invert.
lshift({expr}, {bits}) *Vital.Bitwise.lshift()*
Bitwise shifts to left. {bits} is masked by 0x1F or 0x3F(|+num64|).
rshift({expr}, {bits}) *Vital.Bitwise.rshift()*
Bitwise logical shifts to right. {bits} is masked by 0x1F or
0x3F(|+num64|).
compare({expr}, {expr}) *Vital.Bitwise.compare()*
Compares as unsigned integer. Returns -1, 0, or 1.
sign_extension({expr}) *Vital.Bitwise.sign_extension()*
Apply sign extension to {expr}.
This reappears 32bit number in |+num64| environment.
With |+num64|, when the 32nd bit is 0, upper 32bits are filled by 0.
Otherwise, it is filled by 1.
Without |+num64|, returns {expr}.
Example(with |+num64|): >
echo B.sign_extension(4294967295)
" => -1
" 4294967295 == 0xFFFFFFFF
" -1 == 0xFFFFFFFFFFFFFFFF
lshift32({expr}, {bits}) *Vital.Bitwise.lshift32()*
Similar to |Vital.Bitwise.lshift()|, but always treats 32bit number.
With |+num64|, upper 32bits of results are always 0.
rshift32({expr}, {bits}) *Vital.Bitwise.rshift32()*
Similar to |Vital.Bitwise.rshift()|, but always treats 32bit number.
With |+num64|, upper 32bits of {expr} is ignored.
==============================================================================
vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl