limits.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (C) 2017 Teluu Inc. (http://www.teluu.com)
  3. * Copyright (C) 2017 George Joseph <gjoseph@digium.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. */
  19. #ifndef __PJ_COMPAT_LIMITS_H__
  20. #define __PJ_COMPAT_LIMITS_H__
  21. /**
  22. * @file limits.h
  23. * @brief Provides integer limits normally found in limits.h.
  24. */
  25. #include <pj/config.h>
  26. #if defined(PJ_HAS_LIMITS_H) && PJ_HAS_LIMITS_H != 0
  27. # include <limits.h>
  28. #else
  29. # ifdef _MSC_VER
  30. # pragma message("limits.h is not found or not supported. LONG_MIN and "\
  31. "LONG_MAX will be defined by the library in "\
  32. "pj/compats/limits.h and overridable in config_site.h")
  33. # else
  34. # warning "limits.h is not found or not supported. LONG_MIN and LONG_MAX " \
  35. "will be defined by the library in pj/compats/limits.h and "\
  36. "overridable in config_site.h"
  37. # endif
  38. /* Minimum and maximum values a `signed long int' can hold. */
  39. # ifndef LONG_MAX
  40. # if __WORDSIZE == 64
  41. # define LONG_MAX 9223372036854775807L
  42. # else
  43. # define LONG_MAX 2147483647L
  44. # endif
  45. # endif
  46. # ifndef LONG_MIN
  47. # define LONG_MIN (-LONG_MAX - 1L)
  48. # endif
  49. /* Maximum value an `unsigned long int' can hold. (Minimum is 0.) */
  50. # ifndef ULONG_MAX
  51. # if __WORDSIZE == 64
  52. # define ULONG_MAX 18446744073709551615UL
  53. # else
  54. # define ULONG_MAX 4294967295UL
  55. # endif
  56. # endif
  57. #endif
  58. #endif /* __PJ_COMPAT_LIMITS_H__ */