Hi Bram,

On Sat, Jun 26, 2021 at 3:04 AM Bram Moolenaar <[email protected]>
wrote:

>
> Yegappen wrote:
>
> > The following bitwise functions are currently supported: and(), or(),
> > xor() and invert().
> > But there is no function or operator for bitwise left/right shift.
> > Add the lshift() and rshift() functions for bitwise left shift and
> > right shift.
>
> I'm wondering if it is worth it. You can also use "* 2" for left shift
> and "/ 2" for right shift. It's not exactly the same (considering
> overflow), but does that matter in a Vim script?
>
>
>
Without these functions, to left/right shift a number, you need to
do something like the following:

Left Shift:
let c = a * float2nr(pow(2, b))

Right Shift:
let c = float2nr(floor(a / pow(2, b)))

I thought it would be simpler to have a separate function for this.

Regards,
Yegappan

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/CAAW7x7kDMiy6D7iFDBjL0YmrB3bv-dbCH0-9H8qGQT9s3KjMwQ%40mail.gmail.com.

Raspunde prin e-mail lui