On Dec 15, 4:34 pm, Tony Mechelynck <[email protected]>
wrote:
>
> The following should be fast enough but I haven't tested it. It can all
> go in the vimrc or in a global plugin.
>
> " Initialization. This implicitly takes sizeof(int) into account.
> let PowersOfTwo = []
> let n = 1
> while n " n==0 means no error on overflow
>         try
>                 let PowersOfTwo += [n]
>                 let n += n
>         catch   " if error on overflow
>                 break
>         endtry
> endwhile
>
> " Auxiliary functions
> func Pow2(x)
>         try
>                 return PowersOfTwo[a:x]
>         catch
>                 return -1
>         endtry
> endfunc

Nice, a lookup table! That should be better than doing exponentiation
on the fly, at least.

I'd still like a nice native shift command better, though.

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

Raspunde prin e-mail lui