I wrote:

> > @errael commented on this pull request.
> > 
> > 
> > > +             if (iptr->isn_arg.op.op_type == EXPR_RSHIFT)
> > +                   // clear the topmost sign bit
> > +                   res &= ~((uvarnumber_T)1 << MAX_LSHIFT_BITS);
> > 
> > Have you tried it without this post shift fixup? Since the type of the
> > the left hand side is unsigned, no adjustment is needed.
> 
> I accidentally remove the type cast (I didn't notice the "u" and thought
> it was not needed).
> 
> I think that clearing the topmost bit was pointless anyway, since the
> sign bit would also be replicated by as many positions it was shifted,
> AFAIK if there were eight bits: "10000000 >> 2" would result in 11100000.
> Only clearing the top bit leaves 01100000 instead of the desired 00100000
> 
> I was hoping to test with this, but it doesn't work:
> 
>     if v:numbersize == 64
>       call assert_equal(0xfffffffffffffff8, 0x1fffffffffffffff << 3)
>       call assert_equal(0x1fffffffffffffff, 0xffffffffffffffff >> 3)
>     endif

Ah, that's because 0xffffffffffffffff actually becomes
0x7fffffffffffffff.  Using -1 to get all bits set does work.

-- 
Error 42: No errors

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            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

--- 
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/20220522190702.6CF741C06D7%40moolenaar.net.

Raspunde prin e-mail lui