Hello!
Here is function that i am writing on 64 bit linux machine.
void myfunc(unsigned char* arr) //array of 8 bytes is passed by reference
{
unsigned long a = 0; //8 bytes
unsigned char* LL = (unsigned char*) &a;
LL[0] = arr[6];
LL[1] = arr[3];
LL[2] = arr[1];
LL[3] = arr[7];
LL[4] = arr[5];
LL[5] = arr[4];
LL[6] = arr[0];
LL[7] = arr[2];
}
Now my questions are:
- Will variable 'a' be stored in a register so that It wont be accessed again and again from RAM or chache?
- Working on 64 bit architecture, should I assume that 'arr' array will be stored in a register as functions parameters are stored in a register in 64 bit arch?
- How efficient is Pointer type casting? my guess is that It should be inefficient at all?
Any help would be appriciated.
Regards