elua/elua

Temp buffer allocates 16 bytes instead of 4

Closed this issue · 2 comments

Please see

char *pnum=(char*)&y, temp[4];

The code which swaps the upper and lower dwords allocates char* temp[4]; as the temp buffer.
Each element in the temp array will be as wide as the memory bus.. whereas it only needs to be of length sizeof(double)/2.

Not sure what you mean. In the declaration above sizeof(temp) is 4. When declaring pointers in C, the * binds to the variable, not to the type.

Yes, you are correct. I've done some learning since this..