Currently, I am building a CRC-16 calculator by app inventor 2.
I need bitwise shift operator which like, “>>” , “<<” , in my program,
but I am a newcomer of Inventor 2.
I can not find the block for it. Does anyone know where can I find that, or any suggestion.
Sure, Please have it.
Currently, it is not completed function.
You should see that I am currently using division by 256 to replace the right shift operator for 8 bit.
If you break up the shift function to separate Left and Right variants, you can drop the text 'right' or 'left' parameter and test, and let AI2 typeblocking help you specify the direction.
Procedure and test blocks are draggable into Blocks Editor,
screen shot not draggable.
(edit-ABG)
P.S. This shift left operator is wrong, in that it does not take into account the 16 bit unsigned data type being shifted left.
There are two schools of thought as to what results from a shift left that overflows the left end:
The result is undefined, or
You clip the overflow.
This question can be only answered by examining the original algorithm source and its environment.