20 #ifndef OPAL_ARCH_H_HAS_BEEN_INCLUDED
21 #define OPAL_ARCH_H_HAS_BEEN_INCLUDED
23 #include "opal_config.h"
196 #define OPAL_ARCH_HEADERMASK 0x03000000
197 #define OPAL_ARCH_HEADERMASK2 0x00000003
198 #define OPAL_ARCH_UNUSEDMASK 0xfc000000
201 #define OPAL_ARCH_ISBIGENDIAN 0x00000008
204 #define OPAL_ARCH_LONGISxx 0x0000c000
205 #define OPAL_ARCH_LONGIS64 0x00001000
206 #define OPAL_ARCH_LONGLONGISxx 0x00003000
208 #define OPAL_ARCH_BOOLISxx 0x00000c00
209 #define OPAL_ARCH_BOOLIS8 0x00000000
210 #define OPAL_ARCH_BOOLIS16 0x00000400
211 #define OPAL_ARCH_BOOLIS32 0x00000800
213 #define OPAL_ARCH_LOGICALISxx 0x00000300
214 #define OPAL_ARCH_LOGICALIS8 0x00000000
215 #define OPAL_ARCH_LOGICALIS16 0x00000100
216 #define OPAL_ARCH_LOGICALIS32 0x00000200
219 #define OPAL_ARCH_LONGDOUBLEIS96 0x00020000
220 #define OPAL_ARCH_LONGDOUBLEIS128 0x00010000
222 #define OPAL_ARCH_LDEXPSIZEIS15 0x00080000
224 #define OPAL_ARCH_LDMANTDIGIS64 0x00400000
225 #define OPAL_ARCH_LDMANTDIGIS105 0x00200000
226 #define OPAL_ARCH_LDMANTDIGIS106 0x00600000
227 #define OPAL_ARCH_LDMANTDIGIS107 0x00100000
228 #define OPAL_ARCH_LDMANTDIGIS113 0x00500000
230 #define OPAL_ARCH_LDISINTEL 0x00800000
234 OPAL_DECLSPEC int32_t opal_arch_compute_local_id( uint32_t *var);
236 OPAL_DECLSPEC int32_t opal_arch_checkmask ( uint32_t *var, uint32_t mask );
238 static inline int32_t opal_arch_isbigendian (
void )
240 const uint32_t value = 0x12345678;
241 const char *ptr = (
char*)&value;
245 if( ptr[x] == 0x12)
return 1;
246 if( ptr[x] == 0x78 )
return 0;
262 static inline int32_t opal_arch_ldisintel(
void )
264 long double ld = 2.0;
266 uint32_t* pui = (uint32_t*)(
void*)&ld;
268 j = LDBL_MANT_DIG / 32;
269 i = (LDBL_MANT_DIG % 32) - 1;
270 if( opal_arch_isbigendian() ) {
271 j = (
sizeof(
long double) /
sizeof(
unsigned int)) - j;
282 return (pui[j] & (1 << i) ? 1 : 0);
285 static inline void opal_arch_setmask ( uint32_t *var, uint32_t mask)