diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_endian.h | 50 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_global.h | 11 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_utildefines.h | 26 | ||||
-rw-r--r-- | source/blender/blenkernel/CMakeLists.txt | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/blender.c | 4 |
5 files changed, 23 insertions, 69 deletions
diff --git a/source/blender/blenkernel/BKE_endian.h b/source/blender/blenkernel/BKE_endian.h deleted file mode 100644 index 5647645e990..00000000000 --- a/source/blender/blenkernel/BKE_endian.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Are we little or big endian? From Harbison&Steele. - */ -#ifndef BKE_ENDIAN_H -#define BKE_ENDIAN_H - -/** \file BKE_endian.h - * \ingroup bke - */ - -/** - * BKE_ENDIANNESS(a) returns 1 if big endian and returns 0 if little endian - */ -#define BKE_ENDIANNESS(a) { \ - union { \ - intptr_t l; \ - char c[sizeof (intptr_t)]; \ - } u; \ - u.l = 1; \ - a = (u.c[sizeof (intptr_t) - 1] == 1) ? 1 : 0; \ -} - -#endif - diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 0e48673f1b1..a59d43d315d 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -151,9 +151,18 @@ typedef struct Global { /* ENDIAN_ORDER: indicates what endianness the platform where the file was * written had. */ +#if !defined( __BIG_ENDIAN__ ) && !defined( __LITTLE_ENDIAN__ ) +# error Either __BIG_ENDIAN__ or __LITTLE_ENDIAN__ must be defined. +#endif + #define L_ENDIAN 1 #define B_ENDIAN 0 -extern short ENDIAN_ORDER; + +#ifdef __BIG_ENDIAN__ +# define ENDIAN_ORDER B_ENDIAN +#else +# define ENDIAN_ORDER L_ENDIAN +#endif /* G.moving, signals drawing in (3d) window to denote transform */ #define G_TRANSFORM_OBJ 1 diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h index 14e622c972e..87684e4895d 100644 --- a/source/blender/blenkernel/BKE_utildefines.h +++ b/source/blender/blenkernel/BKE_utildefines.h @@ -47,18 +47,18 @@ /* this weirdo pops up in two places ... */ #if !defined(WIN32) -#ifndef O_BINARY -#define O_BINARY 0 -#endif +# ifndef O_BINARY +# define O_BINARY 0 +# endif #endif /* INTEGER CODES */ -#if defined(__sgi) || defined (__sparc) || defined (__sparc__) || defined (__PPC__) || defined (__ppc__) || defined (__hppa__) || defined (__BIG_ENDIAN__) - /* Big Endian */ -#define MAKE_ID(a,b,c,d) ( (int)(a)<<24 | (int)(b)<<16 | (c)<<8 | (d) ) +#ifdef __BIG_ENDIAN__ + /* Big Endian */ +# define MAKE_ID(a,b,c,d) ( (int)(a)<<24 | (int)(b)<<16 | (c)<<8 | (d) ) #else - /* Little Endian */ -#define MAKE_ID(a,b,c,d) ( (int)(d)<<24 | (int)(c)<<16 | (b)<<8 | (a) ) + /* Little Endian */ +# define MAKE_ID(a,b,c,d) ( (int)(d)<<24 | (int)(c)<<16 | (b)<<8 | (a) ) #endif #define ID_NEW(a) if( (a) && (a)->id.newid ) (a)= (void *)(a)->id.newid @@ -74,11 +74,11 @@ #define ENDB MAKE_ID('E','N','D','B') /* Bit operations */ -#define BTST(a,b) ( ( (a) & 1<<(b) )!=0 ) -#define BNTST(a,b) ( ( (a) & 1<<(b) )==0 ) -#define BTST2(a,b,c) ( BTST( (a), (b) ) || BTST( (a), (c) ) ) -#define BSET(a,b) ( (a) | 1<<(b) ) -#define BCLR(a,b) ( (a) & ~(1<<(b)) ) +#define BTST(a,b) ( ( (a) & 1<<(b) )!=0 ) +#define BNTST(a,b) ( ( (a) & 1<<(b) )==0 ) +#define BTST2(a,b,c) ( BTST( (a), (b) ) || BTST( (a), (c) ) ) +#define BSET(a,b) ( (a) | 1<<(b) ) +#define BCLR(a,b) ( (a) & ~(1<<(b)) ) /* bit-row */ #define BROW(min, max) (((max)>=31? 0xFFFFFFFF: (1<<(max+1))-1) - ((min)? ((1<<(min))-1):0) ) diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 9cf0a92742f..09b38195ef3 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -179,7 +179,6 @@ set(SRC BKE_depsgraph.h BKE_displist.h BKE_effect.h - BKE_endian.h BKE_fcurve.h BKE_fluidsim.h BKE_font.h diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 2d4354bdd9f..2b6261b1c81 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -98,7 +98,6 @@ Global G; UserDef U; /* ListBase = {NULL, NULL}; */ -short ENDIAN_ORDER; char versionstr[48]= ""; @@ -132,9 +131,6 @@ void initglobals(void) strcpy(G.ima, "//"); - ENDIAN_ORDER= 1; - ENDIAN_ORDER= (((char*)&ENDIAN_ORDER)[0])? L_ENDIAN: B_ENDIAN; - if(BLENDER_SUBVERSION) BLI_snprintf(versionstr, sizeof(versionstr), "blender.org %d.%d", BLENDER_VERSION, BLENDER_SUBVERSION); else |