0
0
mirror of https://github.com/vim/vim.git synced 2025-10-28 09:27:14 -04:00

updated for version 7.3.377

Problem:    No support for bitwise AND, OR, XOR and invert.
Solution:   Add add(), or(), invert() and xor() functions.
This commit is contained in:
Bram Moolenaar
2011-12-14 15:32:50 +01:00
parent 2787ab91b0
commit d6e256c31a
5 changed files with 129 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
Test for floating point.
Test for floating point and logical operators.
STARTTEST
:so small.vim
@@ -72,6 +72,23 @@ STARTTEST
:$put ='float2nr'
:$put =float2nr(123.456)
:$put =float2nr(-123.456)
:$put ='AND'
:$put =and(127, 127)
:$put =and(127, 16)
:$put =and(127, 128)
:$put ='OR'
:$put =or(16, 7)
:$put =or(8, 7)
:$put =or(0, 123)
:$put ='XOR'
:$put =xor(127, 127)
:$put =xor(127, 16)
:$put =xor(127, 128)
:$put ='invert'
:$put =and(invert(127), 65535)
:$put =and(invert(16), 65535)
:$put =and(invert(128), 65535)
:$put =invert(1.0)
:/^Results/,$wq! test.out
ENDTEST

View File

@@ -54,3 +54,20 @@ trunc
float2nr
123
-123
AND
127
16
0
OR
23
15
123
XOR
0
111
255
invert
65408
65519
65407
0