I have a problem that Ive been grappling with for too long, and Im hoping that someone here might know how to do this.
I have two multi-word arrays of unsigned shorts, representing large numbers least significant word first. I want to add one of these arrays to the other, like you would normally add two multi-word arrays, except theres a catch I want to shift the first array left by an arbitary number of bits before adding it. So, if I wanted a shift of 79, each word would be shifted left by 9 bits and the whole thing would be ADCd into the second array, starting at the fourth word.
Now, I have thought about this, tried different things and for the life of me I cant get it to work, and work fast. Im currently doing something along the lines of
carry = setBit(RESULT_ARRAY, currentWord, currentBit, getBit(SOURCE_ARRAY, currentWordA, currentBitA) + getBit(RESULT_ARRAY, currentWord, currentBit) + carry);
for every line, which is very, very slow.
Could someone point me in the right direction, as Im sure that letting the CPU take care of adding would stop this thing from chugging.
Id be eternally grateful!