added logical shift operations#45
Conversation
| * Shifts all given bits to left and returns the resulting bits | ||
| * | ||
| * @example | ||
| * lshiftl([1,0,1,1,0,1]) => [0,1,1,0,1,0] |
There was a problem hiding this comment.
@0xflotus can you make a case for this not returning [1,0,1,1,0,1,0] instead? bitwise basically supports arbitrary size bit arrays, so perhaps this is an unexpected result
If you have a particular use-case in mind for the non-size-increasing version, we could also add a flag for this behavior.
There was a problem hiding this comment.
There are 6 Bits in the example and you are referring to 7 Bits. Which case should it return?
| * Shifts all given bits to right and returns the resulting bits | ||
| * | ||
| * @example | ||
| * lshiftr([1,0,1,1,0,1]) => [0,1,0,1,1,0] |
There was a problem hiding this comment.
Not as concerned about this one, but I suppose it’s possible to argue that the leading 0 should be removed.
|
@0xflotus I merged the circular shift one as it was obvious how it should behave on arbitrary lengths of bits (doesn’t modify length). However, I’m really not sure about this one and if it’s more reasonable to keep the length or to decrease/increase it by |
part 1 of fix #44