Ruby 3.5.0dev (2025-01-10 revision 5fab31b15e32622c4b71d1d347a41937e9f9c212)
limits.h
1#ifndef RUBY_BACKWARD2_LIMITS_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RUBY_BACKWARD2_LIMITS_H
25#include "ruby/internal/config.h"
26
27#ifdef HAVE_LIMITS_H
28# include <limits.h>
29#endif
30
32
33#ifndef LONG_MAX
34# /* assuming 32bit(2's complement) long */
35# define LONG_MAX 2147483647L
36#endif
37
38#ifndef LONG_MIN
39# define LONG_MIN (-LONG_MAX-1)
40#endif
41
42#ifndef CHAR_BIT
43# define CHAR_BIT 8
44#endif
45
46#ifdef LLONG_MAX
47# /* Take that. */
48#elif defined(LONG_LONG_MAX)
49# define LLONG_MAX LONG_LONG_MAX
50#elif defined(_I64_MAX)
51# define LLONG_MAX _I64_MAX
52#else
53# /* assuming 64bit(2's complement) long long */
54# define LLONG_MAX 9223372036854775807LL
55#endif
56
57#ifdef LLONG_MIN
58# /* Take that. */
59#elif defined(LONG_LONG_MIN)
60# define LLONG_MIN LONG_LONG_MIN
61#elif defined(_I64_MAX)
62# define LLONG_MIN _I64_MIN
63#else
64# define LLONG_MIN (-LLONG_MAX-1)
65#endif
66
67#ifdef SIZE_MAX
68# /* Take that. */
69#elif SIZEOF_SIZE_T == SIZEOF_LONG_LONG
70# define SIZE_MAX ULLONG_MAX
71# define SIZE_MIN ULLONG_MIN
72#elif SIZEOF_SIZE_T == SIZEOF_LONG
73# define SIZE_MAX ULONG_MAX
74# define SIZE_MIN ULONG_MIN
75#elif SIZEOF_SIZE_T == SIZEOF_INT
76# define SIZE_MAX UINT_MAX
77# define SIZE_MIN UINT_MIN
78#else
79# define SIZE_MAX USHRT_MAX
80# define SIZE_MIN USHRT_MIN
81#endif
82
83#ifdef SSIZE_MAX
84# /* Take that. */
85#elif SIZEOF_SIZE_T == SIZEOF_LONG_LONG
86# define SSIZE_MAX LLONG_MAX
87# define SSIZE_MIN LLONG_MIN
88#elif SIZEOF_SIZE_T == SIZEOF_LONG
89# define SSIZE_MAX LONG_MAX
90# define SSIZE_MIN LONG_MIN
91#elif SIZEOF_SIZE_T == SIZEOF_INT
92# define SSIZE_MAX INT_MAX
93# define SSIZE_MIN INT_MIN
94#else
95# define SSIZE_MAX SHRT_MAX
96# define SSIZE_MIN SHRT_MIN
97#endif
98
99#endif /* RUBY_BACKWARD2_LIMITS_H */
Defines old LONG_LONG.