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

Function shiftArrayRight

src/test/arith_uint256_tests.cpp:126–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126static void shiftArrayRight(unsigned char* to, const unsigned char* from, unsigned int arrayLength, unsigned int bitsToShift)
127{
128 for (unsigned int T=0; T < arrayLength; ++T)
129 {
130 unsigned int F = (T+bitsToShift/8);
131 if (F < arrayLength)
132 to[T] = uint8_t(from[F] >> (bitsToShift % 8));
133 else
134 to[T] = 0;
135 if (F + 1 < arrayLength)
136 to[T] |= uint8_t(from[(F + 1)] << (8 - bitsToShift % 8));
137 }
138}
139
140static void shiftArrayLeft(unsigned char* to, const unsigned char* from, unsigned int arrayLength, unsigned int bitsToShift)
141{

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected