Is there a one line macro definition to determine the endianness of the machine. I am using the following code but converting it to macro would be too long.
unsigned char test_endian( void )
{
int test_var = 1;
unsigned char *test_endian = (unsigned char*)&test_var;
return (test_endian[0] == 0);
} Why not include the same code into a macro?
以上就是C Macro definition to determine big endian or little endian machine?的详细内容,更多请关注web前端其它相关文章!