Shift the number in the array left by bits positions. \param array the number to shift, must have length elements \param length the number of entries in the array \param bits the number of bits to shift (0 <= bits < 32)
| 739 | /// \param length the number of entries in the array |
| 740 | /// \param bits the number of bits to shift (0 <= bits < 32) |
| 741 | static void ShiftArrayLeft(uint32_t* array, int64_t length, int64_t bits) { |
| 742 | if (length > 0 && bits != 0) { |
| 743 | for (int64_t i = 0; i < length - 1; ++i) { |
| 744 | array[i] = (array[i] << bits) | (array[i + 1] >> (32 - bits)); |
| 745 | } |
| 746 | array[length - 1] <<= bits; |
| 747 | } |
| 748 | } |
| 749 | |
| 750 | /// Shift the number in the array right by bits positions. |
| 751 | /// \param array the number to shift, must have length elements |