Ben Fritz wrote:
> On Dec 14, 8:33 am, Bram Moolenaar <[email protected]> wrote:
> > Patch 7.3.377
> > Problem: No support for bitwise AND, OR, XOR and invert.
> > Solution: Add add(), or(), invert() and xor() functions.
> > Files: src/eval.c, src/testdir/test49.in, src/testdir/test65.in,
> > src/testdir/test65.ok, runtime/doc/eval.txt
> >
>
> A couple of things:
>
> 1. I note that the new functions are missing from :help function-list
> (probably they should be under a new subheading, like "integer
> computation" or "bitwise computation" similar to "floating point
> computation").
Indeed, I'll add them there.
> 2. I note that no shift operators were defined. So now the easiest way
> to do the shifting if needed is by multiplying or dividing by powers
> of 2. But I just realized pow() is a floating-point function, making a
> shift much more expensive than it needs to be, if this function is
> used. I could not find a good way to get arbitrary (integer) powers of
> 2 with Vim functions/syntax. Can we either add the shift operators, or
> add the ability to do integer exponentiation?
I haven't decided yet. In most cases you can simple do var * 2 or
var / 2. Only for very big numbers that may not work right.
If you really need to shift by something that is not a constant then
indeed it is more complicated.
--
"Never be afraid to tell the world who you are."
-- Anonymous
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php