00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "Core/precomp.h"
00020
00021 #ifdef BORLAND
00022 #pragma hdrstop
00023 #endif
00024
00025 #include "API/Core/IOData/cl_endian.h"
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 void CL_Endian::swap(void *data, int type_size, int total_times)
00043 {
00044 if (type_size == 1) return;
00045
00046 unsigned char *d = (unsigned char *) data;
00047
00048 for (int j=0; j<total_times; j++)
00049 {
00050 for (int i=0; i<type_size/2; i++)
00051 {
00052 unsigned char a = d[i];
00053 d[i] = d[type_size-1-i];
00054 d[type_size-1-i] = a;
00055 }
00056
00057 d += type_size;
00058 }
00059 }
00060
00061 bool CL_Endian::is_system_big()
00062 {
00063 #ifdef USE_BIG_ENDIAN
00064 return true;
00065 #else
00066 return false;
00067 #endif
00068 }
00069
00070 bool CL_Endian::is_system_64bit()
00071 {
00072 if (sizeof(int*) == 8) return true;
00073 return false;
00074 }