FrontISTR  5.7.0
Large-scale structural analysis program with finit element method
hecmw_fstr_endian.c
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2019 FrontISTR Commons
3  * This software is released under the MIT License, see LICENSE.txt
4  *****************************************************************************/
5 
6 #include <stdint.h>
7 
8 #include "hecmw_fstr_endian.h"
9 
18 bool HECMW_is_big_endian(void) {
19  union {
20  uint32_t i;
21  char c[4];
22  } endian = {0x01020304};
23 
24  return endian.c[0] == true;
25 }
26 
35 const char* HECMW_endian_str(void) {
36  if (HECMW_is_big_endian() == true) {
37  return "BigEndian";
38  } else {
39  return "LittleEndian";
40  }
41 }
HECMW_endian_str
const char * HECMW_endian_str(void)
function for investigating endian of running CPU
Definition: hecmw_fstr_endian.c:35
HECMW_is_big_endian
bool HECMW_is_big_endian(void)
function for investigating endian of running CPU
Definition: hecmw_fstr_endian.c:18
hecmw_fstr_endian.h