MCPcopy Create free account
hub / github.com/ElementsProject/elements / shiftArrayLeft

Function shiftArrayLeft

src/test/arith_uint256_tests.cpp:140–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140static void shiftArrayLeft(unsigned char* to, const unsigned char* from, unsigned int arrayLength, unsigned int bitsToShift)
141{
142 for (unsigned int T=0; T < arrayLength; ++T)
143 {
144 if (T >= bitsToShift/8)
145 {
146 unsigned int F = T-bitsToShift/8;
147 to[T] = uint8_t(from[F] << (bitsToShift % 8));
148 if (T >= bitsToShift/8+1)
149 to[T] |= uint8_t(from[F - 1] >> (8 - bitsToShift % 8));
150 }
151 else {
152 to[T] = 0;
153 }
154 }
155}
156
157BOOST_AUTO_TEST_CASE( shifts ) { // "<<" ">>" "<<=" ">>="
158 unsigned char TmpArray[32];

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected