Commit e9126671 authored by Jeroen Demeyer's avatar Jeroen Demeyer

Fix types of values in libc.limits

parent 8cbdb269
# 5.2.4.2.1 Sizes of integer types <limits.h>
cdef extern from "<limits.h>":
const int CHAR_BIT
const int MB_LEN_MAX
enum: CHAR_BIT
enum: MB_LEN_MAX
const char CHAR_MIN
const char CHAR_MAX
enum: CHAR_MIN
enum: CHAR_MAX
const signed char SCHAR_MIN
const signed char SCHAR_MAX
const unsigned char UCHAR_MAX
enum: SCHAR_MIN
enum: SCHAR_MAX
enum: UCHAR_MAX
const short SHRT_MIN
const short SHRT_MAX
const unsigned short USHRT_MAX
enum: SHRT_MIN
enum: SHRT_MAX
enum: USHRT_MAX
const int INT_MIN
const int INT_MAX
const unsigned int UINT_MAX
enum: INT_MIN
enum: INT_MAX
enum: UINT_MAX
const long LONG_MIN
const long LONG_MAX
const unsigned long ULONG_MAX
enum: LONG_MIN
enum: LONG_MAX
enum: ULONG_MAX
enum: LLONG_MIN
enum: LLONG_MAX
enum: ULLONG_MAX
const long long LLONG_MIN
const long long LLONG_MAX
const unsigned long long ULLONG_MAX
......@@ -10,10 +10,7 @@ cimport cython
import sys
IS_PYPY = hasattr(sys, 'pypy_version_info')
cdef extern from *:
int INT_MAX
long LONG_MAX
long LONG_MIN
from libc.limits cimport INT_MAX, LONG_MAX, LONG_MIN
max_int = INT_MAX
max_long = LONG_MAX
......@@ -149,6 +146,15 @@ def format_c_numbers_max(int n, long l):
return s1, s2
def format_c_number_const():
"""
>>> s = format_c_number_const()
>>> s == '{0}'.format(max_long) or s
True
"""
return f"{LONG_MAX}"
def format_c_number_range(int n):
"""
>>> for i in range(-1000, 1000):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment