I'm adapting a piece of code. The original code takes 4 bytes and convert that to an integer.
In my case this memory contains a float and I want the function to return a float.
Here is the original code:
In my case this memory contains a float and I want the function to return a float.
Here is the original code:
Code:
// read an unsigned long int from 4 bytes in buffer, // starting at offset, MSB first unsigned long readLongInt(byte * buffer, int offset) { unsigned long result=0; result |= ((unsigned long)(buffer[offset]) << 0x18); result |= ((unsigned long)(buffer[offset+1]) << 0x10); result |= ((unsigned long)(buffer[offset+2]) << 0x08); result |= ((unsigned long)(buffer[offset+3])); return result; }
Comment