physfs_internal.h
changeset 936 3b4b6c107a59
parent 933 02f861d084a8
child 938 ecbae90ae88d
equal deleted inserted replaced
934:d0d72a7c49a7 936:3b4b6c107a59
    29 #include <malloc.h>
    29 #include <malloc.h>
    30 #endif
    30 #endif
    31 
    31 
    32 #ifdef __cplusplus
    32 #ifdef __cplusplus
    33 extern "C" {
    33 extern "C" {
       
    34 #endif
       
    35 
       
    36 #ifdef __GNUC__
       
    37 #define PHYSFS_MINIMUM_GCC_VER(major, minor) \
       
    38     ( ((__GNUC__ << 16) + __GNUC_MINOR__) >= (((major) << 16) + (minor)) )
       
    39 #else
       
    40 #define PHYSFS_MINIMUM_GCC_VER(major, minor) (0)
    34 #endif
    41 #endif
    35 
    42 
    36 /*
    43 /*
    37  * Interface for small allocations. If you need a little scratch space for
    44  * Interface for small allocations. If you need a little scratch space for
    38  *  a throwaway buffer or string, use this. It will make small allocations
    45  *  a throwaway buffer or string, use this. It will make small allocations
  1018 #else
  1025 #else
  1019 #define __PHYSFS_SI64(x) x
  1026 #define __PHYSFS_SI64(x) x
  1020 #define __PHYSFS_UI64(x) x
  1027 #define __PHYSFS_UI64(x) x
  1021 #endif
  1028 #endif
  1022 
  1029 
       
  1030 
  1023 /*
  1031 /*
  1024  * Check if a ui64 will fit in the platform's address space.
  1032  * Check if a ui64 will fit in the platform's address space.
  1025  *  The initial sizeof check will optimize this macro out entirely on
  1033  *  The initial sizeof check will optimize this macro out entirely on
  1026  *  64-bit (and larger?!) platforms, and the other condition will
  1034  *  64-bit (and larger?!) platforms, and the other condition will
  1027  *  return zero or non-zero if the variable will fit in the platform's
  1035  *  return zero or non-zero if the variable will fit in the platform's
  1029  */
  1037  */
  1030 #define __PHYSFS_ui64FitsAddressSpace(s) ( \
  1038 #define __PHYSFS_ui64FitsAddressSpace(s) ( \
  1031     (sizeof (PHYSFS_uint64) > sizeof (size_t)) && \
  1039     (sizeof (PHYSFS_uint64) > sizeof (size_t)) && \
  1032     ((s) > (__PHYSFS_UI64(0xFFFFFFFFFFFFFFFF) >> (64-(sizeof(size_t)*8)))) \
  1040     ((s) > (__PHYSFS_UI64(0xFFFFFFFFFFFFFFFF) >> (64-(sizeof(size_t)*8)))) \
  1033 )
  1041 )
       
  1042 
  1034 
  1043 
  1035 /*
  1044 /*
  1036  * This is a strcasecmp() or stricmp() replacement that expects both strings
  1045  * This is a strcasecmp() or stricmp() replacement that expects both strings
  1037  *  to be in UTF-8 encoding. It will do "case folding" to decide if the
  1046  *  to be in UTF-8 encoding. It will do "case folding" to decide if the
  1038  *  Unicode codepoints in the strings match.
  1047  *  Unicode codepoints in the strings match.