I want to post my Solution for the CRC Calculation.
A second error appeared with larger lists. The CRC Value has to be 16Bit (uint16_t). If not the CRC Value get bigger and bigger until it doesn't work anymore and the crc is wrong.
Unlike the shift_right function, which uses the floor() operation to clip off bits that have been shifted past the binary point, the shift_left operation does not clip at any left boundary.
In fact, the floor() operation in shift_left is totally irrelevant.
You are quite right, my earlier post was wrong on the left shift. I have added a postscript to it.
If you are still having trouble with the CRC conversion, point us to the original algorithm source and its language standard.
P.S. Here is my latest idea on the left shift operation for 16 bit unsigned numbers. It probably matches some C standard somewhere.
P.P.S. No, that's wrong too.
I failed to left pad the input binary with zeroes to fit a 16 bit uint.
Hang in there while I fix it.
Okay, here is the corrected version. The idea is that the first 2 inputs of the JOIN make up 16 bits before being padded on the right and having the shift amount clipped off the front ...