BitArray shift left/right confusion.
Bastiaan Veelo
Bastiaan at Veelo.net
Sat Feb 3 21:39:31 UTC 2018
On Friday, 2 February 2018 at 00:33:03 UTC, Jakub Łabaj wrote:
> On the other hand, shifting operators are equally confusing for
> me, as they are for you - they really work in the other way
> around! I thought this is a very weird bug, but I found this
> pull request: https://github.com/dlang/phobos/pull/2844, which
> states this is the intended behaviour.
>
> I don't know if there is anybody that would expect this - it's
> inconsistent with any other bitset implementation I know from
> other languages, as well as with what logic suggests. I'm
> curious if the authors changed their minds in this regard and
> there is any chance for that to be rewritten?
The same confusion existed amongst the authos, that pull was done
in reaction to
https://github.com/dlang/phobos/pull/2797#discussion-diff-22456052.
So the shift direction seems to be as intended (by Martin Nowak
at least) but the docs should be clear in what order the bits are
printed and indexed. I guess.
More information about the Digitalmars-d-learn
mailing list