inlib
1.2.0
|
00001 // Copyright (C) 2010, Guy Barrand. All rights reserved. 00002 // See the file inlib.license for terms. 00003 00004 #ifndef inlib_s2int64 00005 #define inlib_s2int64 00006 00007 #include "typedefs" 00008 00009 //NOTE : we do not put the below in typedefs to avoid including 00010 // cstdlib in typedefs. 00011 // It is used in inlib/io/ascii_buffer. 00012 00013 00014 #include <cstdlib> //strtol 00015 00016 namespace inlib { 00017 00018 #if defined(WIN32) && !defined(GNU_GCC) 00019 00020 typedef int64(*s2int64_func)(const char*,char**,int); 00021 inline int64 s2int64(const char* a_s,char** a_end,int a_base){ 00022 return _strtoi64(a_s,a_end,a_base); 00023 } 00024 00025 #elif defined(_LP64) 00026 00027 // 64 Bit Platforms 00028 00029 typedef int64(*s2int64_func)(const char*,char**,int); 00030 inline int64 s2int64(const char* a_s,char** a_end,int a_base){ 00031 return ::strtol(a_s,a_end,a_base); 00032 } 00033 00034 #else 00035 00036 // 32-Bit Platforms 00037 00038 typedef int64(*s2int64_func)(const char*,char**,int); 00039 inline int64 s2int64(const char* a_s,char** a_end,int a_base){ 00040 return ::strtoll(a_s,a_end,a_base); 00041 } 00042 00043 #endif 00044 00045 } 00046 00047 #endif