1

I am haveing troubles with the following. I have an array of uint8_t values.

I am trying to get the first 8 elements of the array into a uint64_t variable.

Therefore I used the following code to achieve that:

uint64_t dummy;
int i, x;
uint8_t pRxBuffer[32];

...

i = 0;
for(x = i; x < (i + 8); x++)
{
    dummy += pRxBuffer[x] << ((x - i) * 8); 
}

The problem now is that the variable dummy is treated like a 32 Bit variable. The result of dummy is only the first 32 Bits (so the first 3 elements of the array).

I am using a STM32F303 MCU where this runs on. It is a 32bit machine, but this should not be a problem in my opinion.

Any help is welcomed.

Benjamin

0 Answers0