MCPcopy Create free account
hub / github.com/LUX-Core/lux / shiftArrayLeft

Function shiftArrayLeft

src/test/uint256_tests.cpp:184–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182}
183
184void shiftArrayLeft(unsigned char* to, const unsigned char* from, unsigned int arrayLength, unsigned int bitsToShift)
185{
186 for (unsigned int T=0; T < arrayLength; ++T)
187 {
188 if (T >= bitsToShift/8)
189 {
190 unsigned int F = T-bitsToShift/8;
191 to[T] = from[F] << (bitsToShift%8);
192 if (T >= bitsToShift/8+1)
193 to[T] |= from[F-1] >> (8-bitsToShift%8);
194 }
195 else {
196 to[T] = 0;
197 }
198 }
199}
200
201BOOST_AUTO_TEST_CASE( shifts ) { // "<<" ">>" "<<=" ">>="
202 unsigned char TmpArray[32];

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected