Fixed problem with detecting little endian
Copied the code from stack overflow without thinking about it. The first byte in little endian order should always be LSB so I construct a more contrived example (0xFFFF0000) which should make it easier to detect what the first byte is considered on the machine. If it's 0 then the LSB is the first byte hence little endian, otherwise it's big endian. On a greater note: Don't never copy no code from stack overflow, bro. I went up there at 11 o'clock last night trynna get me some code. Bro, I copied that shit, woke up, my motherfucking LITTLE_ENDIAN detection don't work. Explain, bro.
This commit is contained in:
@@ -99,7 +99,7 @@ typedef enum
|
||||
|
||||
// Macro to determine little endian
|
||||
#ifndef LITTLE_ENDIAN
|
||||
static const int __i = 1;
|
||||
static const hword_t __i = 0xFFFF0000;
|
||||
#define LITTLE_ENDIAN ((*((byte_t *)&__i)) == 0)
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user