endian.c

来自「老外写的加密库cryptlib(版本3.1)」· C语言 代码 · 共 19 行

C
19
字号
/* This is a lowest-common-denominator program which should compile under
   the default cc on any system, no matter how primitive (even the SunOS
   one - note the use of 1970s-vintage octal escapes).  This is necessary
   because it's compiled before we can try and select a decent compiler via
   the makefile */

#include <stdio.h>
#include <stdlib.h>

int main()
	{
	if( *( long * ) "\200\0\0\0\0\0\0\0" < 0 )
		printf( "-DDATA_BIGENDIAN" );
	else
		printf( "-DDATA_LITTLEENDIAN" );

	return( 0 );
	}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?