Warning, /include/Geant4/tools/platform is written in an unsupported language. File is not indexed.
0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003
0004 #ifndef tools_platform
0005 #define tools_platform
0006
0007 // We do not byteswap on intel (LE) (common platform).
0008 // We have then a better compression on these machines.
0009 // NOTE : this is the contrary to what is done in CERN-ROOT (and Rio).
0010
0011 /* We prefer to handle endianity dynamically, but with cpp macro
0012 it would looks like (from luaconf.h) :
0013 #if defined(__i386__) || defined(__i386) || \
0014 defined(__X86__) || defined (__x86_64)
0015 #define TOOLS_IS_BE 0
0016 #define TOOLS_IS_LE 1
0017 #elif defined(__POWERPC__) || defined(__ppc__)
0018 #define TOOLS_IS_BE 1
0019 #define TOOLS_IS_LE 0
0020 #endif
0021 */
0022
0023 namespace tools {
0024
0025 inline bool is_little_endian() {
0026 unsigned int i = 1;
0027 unsigned char* b = (unsigned char*)&i;
0028 // BE = Big Endian, LE = Little Endian.
0029 // The Intels x86 are LE.
0030 // Mac PPC b[3] is 1 (BE)
0031 // Mac Intel b[0] is 1 (LE)
0032 // Linux i386 b[0] is 1 (LE)
0033 // Linux x86_64 b[0] is 1 (LE)
0034 return (b[0]==1?true:false);
0035 }
0036
0037 }
0038
0039 #if defined(__APPLE__)
0040 #include <TargetConditionals.h>
0041 #endif
0042
0043 namespace tools {
0044 namespace device {
0045
0046 #if defined(ANDROID) || TARGET_OS_IPHONE
0047 inline bool small_screen() {return true;}
0048 #elif defined(EMSCRIPTEN)
0049 inline bool small_screen() {return false;}
0050 #else
0051 inline bool small_screen() {return false;}
0052 #endif
0053
0054 inline unsigned int tex_mem_limit() {
0055 // glGet(GL_MAX_TEXTURE_SIZE) :
0056 // MacBookPro : it returns 8192.
0057 // SGS : it returns 2048.
0058 // iPad1 : it returns 2048.
0059 // iPod : it returns ?
0060 // Nexus 10 : it returns ?
0061
0062 // 1024*1024 //*3 = 3 145 728
0063 // 2048*2048 //*3 = 12 582 912
0064 // 4096*4096 //*3 = 50 331 648
0065 // 8192*8192 //*3 = 201 326 592
0066 // 8192*4096 //*3 = 100 663 296
0067 if(small_screen()) {
0068 //iOS : Apple says that max 2D tex size is 1024*1024 with two units
0069 // texture available. From doc on PowerVR MBX.
0070 return 2048*2048*3;
0071 } else {
0072 //limit = 4096*4096*3; //=8192*2048 //permit to pass ATLAS big image.
0073 //permit to pass fete_science_2010/power2/image_0.jpg
0074 return 8192*4096*3; //100663296
0075 }
0076 }
0077
0078 }}
0079
0080 #endif