MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / shiftArrayLeft

Function shiftArrayLeft

src/test/arith_uint256_tests.cpp:139–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected