Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
38fdc11c
Commit
38fdc11c
authored
Jun 04, 2013
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reuse Py_MIN and Py_MAX macros: remove duplicate MIN/MAX macros
multiprocessing.h: remove unused MIN and MAX macros
parent
7edd8fff
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
25 additions
and
66 deletions
+25
-66
Modules/_bz2module.c
Modules/_bz2module.c
+5
-7
Modules/_cursesmodule.c
Modules/_cursesmodule.c
+5
-9
Modules/_multiprocessing/multiprocessing.h
Modules/_multiprocessing/multiprocessing.h
+0
-9
Modules/md5module.c
Modules/md5module.c
+1
-5
Modules/sha1module.c
Modules/sha1module.c
+1
-5
Modules/socketmodule.c
Modules/socketmodule.c
+2
-5
Objects/floatobject.c
Objects/floatobject.c
+4
-9
Objects/frameobject.c
Objects/frameobject.c
+3
-8
Objects/longobject.c
Objects/longobject.c
+4
-9
No files found.
Modules/_bz2module.c
View file @
38fdc11c
...
@@ -36,8 +36,6 @@
...
@@ -36,8 +36,6 @@
#define RELEASE_LOCK(obj)
#define RELEASE_LOCK(obj)
#endif
#endif
#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
typedef
struct
{
typedef
struct
{
PyObject_HEAD
PyObject_HEAD
...
@@ -157,7 +155,7 @@ compress(BZ2Compressor *c, char *data, size_t len, int action)
...
@@ -157,7 +155,7 @@ compress(BZ2Compressor *c, char *data, size_t len, int action)
/* On a 64-bit system, len might not fit in avail_in (an unsigned int).
/* On a 64-bit system, len might not fit in avail_in (an unsigned int).
Do compression in chunks of no more than UINT_MAX bytes each. */
Do compression in chunks of no more than UINT_MAX bytes each. */
if
(
c
->
bzs
.
avail_in
==
0
&&
len
>
0
)
{
if
(
c
->
bzs
.
avail_in
==
0
&&
len
>
0
)
{
c
->
bzs
.
avail_in
=
MIN
(
len
,
UINT_MAX
);
c
->
bzs
.
avail_in
=
Py_
MIN
(
len
,
UINT_MAX
);
len
-=
c
->
bzs
.
avail_in
;
len
-=
c
->
bzs
.
avail_in
;
}
}
...
@@ -173,7 +171,7 @@ compress(BZ2Compressor *c, char *data, size_t len, int action)
...
@@ -173,7 +171,7 @@ compress(BZ2Compressor *c, char *data, size_t len, int action)
c
->
bzs
.
next_out
=
PyBytes_AS_STRING
(
result
)
+
data_size
;
c
->
bzs
.
next_out
=
PyBytes_AS_STRING
(
result
)
+
data_size
;
buffer_left
=
PyBytes_GET_SIZE
(
result
)
-
data_size
;
buffer_left
=
PyBytes_GET_SIZE
(
result
)
-
data_size
;
}
}
c
->
bzs
.
avail_out
=
MIN
(
buffer_left
,
UINT_MAX
);
c
->
bzs
.
avail_out
=
Py_
MIN
(
buffer_left
,
UINT_MAX
);
}
}
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
...
@@ -370,7 +368,7 @@ decompress(BZ2Decompressor *d, char *data, size_t len)
...
@@ -370,7 +368,7 @@ decompress(BZ2Decompressor *d, char *data, size_t len)
d
->
bzs
.
next_in
=
data
;
d
->
bzs
.
next_in
=
data
;
/* On a 64-bit system, len might not fit in avail_in (an unsigned int).
/* On a 64-bit system, len might not fit in avail_in (an unsigned int).
Do decompression in chunks of no more than UINT_MAX bytes each. */
Do decompression in chunks of no more than UINT_MAX bytes each. */
d
->
bzs
.
avail_in
=
MIN
(
len
,
UINT_MAX
);
d
->
bzs
.
avail_in
=
Py_
MIN
(
len
,
UINT_MAX
);
len
-=
d
->
bzs
.
avail_in
;
len
-=
d
->
bzs
.
avail_in
;
d
->
bzs
.
next_out
=
PyBytes_AS_STRING
(
result
);
d
->
bzs
.
next_out
=
PyBytes_AS_STRING
(
result
);
d
->
bzs
.
avail_out
=
PyBytes_GET_SIZE
(
result
);
d
->
bzs
.
avail_out
=
PyBytes_GET_SIZE
(
result
);
...
@@ -399,7 +397,7 @@ decompress(BZ2Decompressor *d, char *data, size_t len)
...
@@ -399,7 +397,7 @@ decompress(BZ2Decompressor *d, char *data, size_t len)
if
(
d
->
bzs
.
avail_in
==
0
)
{
if
(
d
->
bzs
.
avail_in
==
0
)
{
if
(
len
==
0
)
if
(
len
==
0
)
break
;
break
;
d
->
bzs
.
avail_in
=
MIN
(
len
,
UINT_MAX
);
d
->
bzs
.
avail_in
=
Py_
MIN
(
len
,
UINT_MAX
);
len
-=
d
->
bzs
.
avail_in
;
len
-=
d
->
bzs
.
avail_in
;
}
}
if
(
d
->
bzs
.
avail_out
==
0
)
{
if
(
d
->
bzs
.
avail_out
==
0
)
{
...
@@ -410,7 +408,7 @@ decompress(BZ2Decompressor *d, char *data, size_t len)
...
@@ -410,7 +408,7 @@ decompress(BZ2Decompressor *d, char *data, size_t len)
d
->
bzs
.
next_out
=
PyBytes_AS_STRING
(
result
)
+
data_size
;
d
->
bzs
.
next_out
=
PyBytes_AS_STRING
(
result
)
+
data_size
;
buffer_left
=
PyBytes_GET_SIZE
(
result
)
-
data_size
;
buffer_left
=
PyBytes_GET_SIZE
(
result
)
-
data_size
;
}
}
d
->
bzs
.
avail_out
=
MIN
(
buffer_left
,
UINT_MAX
);
d
->
bzs
.
avail_out
=
Py_
MIN
(
buffer_left
,
UINT_MAX
);
}
}
}
}
if
(
data_size
!=
PyBytes_GET_SIZE
(
result
))
if
(
data_size
!=
PyBytes_GET_SIZE
(
result
))
...
...
Modules/_cursesmodule.c
View file @
38fdc11c
...
@@ -168,10 +168,6 @@ static char *screen_encoding = NULL;
...
@@ -168,10 +168,6 @@ static char *screen_encoding = NULL;
"must call start_color() first"); \
"must call start_color() first"); \
return 0; }
return 0; }
#ifndef MIN
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#endif
/* Utility Functions */
/* Utility Functions */
/*
/*
...
@@ -1212,7 +1208,7 @@ PyCursesWindow_GetStr(PyCursesWindowObject *self, PyObject *args)
...
@@ -1212,7 +1208,7 @@ PyCursesWindow_GetStr(PyCursesWindowObject *self, PyObject *args)
if
(
!
PyArg_ParseTuple
(
args
,
"i;n"
,
&
n
))
if
(
!
PyArg_ParseTuple
(
args
,
"i;n"
,
&
n
))
return
NULL
;
return
NULL
;
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
rtn2
=
wgetnstr
(
self
->
win
,
rtn
,
MIN
(
n
,
1023
));
rtn2
=
wgetnstr
(
self
->
win
,
rtn
,
Py_
MIN
(
n
,
1023
));
Py_END_ALLOW_THREADS
Py_END_ALLOW_THREADS
break
;
break
;
case
2
:
case
2
:
...
@@ -1232,11 +1228,11 @@ PyCursesWindow_GetStr(PyCursesWindowObject *self, PyObject *args)
...
@@ -1232,11 +1228,11 @@ PyCursesWindow_GetStr(PyCursesWindowObject *self, PyObject *args)
#ifdef STRICT_SYSV_CURSES
#ifdef STRICT_SYSV_CURSES
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
rtn2
=
wmove
(
self
->
win
,
y
,
x
)
==
ERR
?
ERR
:
rtn2
=
wmove
(
self
->
win
,
y
,
x
)
==
ERR
?
ERR
:
wgetnstr
(
self
->
win
,
rtn
,
MIN
(
n
,
1023
));
wgetnstr
(
self
->
win
,
rtn
,
Py_
MIN
(
n
,
1023
));
Py_END_ALLOW_THREADS
Py_END_ALLOW_THREADS
#else
#else
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
rtn2
=
mvwgetnstr
(
self
->
win
,
y
,
x
,
rtn
,
MIN
(
n
,
1023
));
rtn2
=
mvwgetnstr
(
self
->
win
,
y
,
x
,
rtn
,
Py_
MIN
(
n
,
1023
));
Py_END_ALLOW_THREADS
Py_END_ALLOW_THREADS
#endif
#endif
break
;
break
;
...
@@ -1374,7 +1370,7 @@ PyCursesWindow_InStr(PyCursesWindowObject *self, PyObject *args)
...
@@ -1374,7 +1370,7 @@ PyCursesWindow_InStr(PyCursesWindowObject *self, PyObject *args)
case
1
:
case
1
:
if
(
!
PyArg_ParseTuple
(
args
,
"i;n"
,
&
n
))
if
(
!
PyArg_ParseTuple
(
args
,
"i;n"
,
&
n
))
return
NULL
;
return
NULL
;
rtn2
=
winnstr
(
self
->
win
,
rtn
,
MIN
(
n
,
1023
));
rtn2
=
winnstr
(
self
->
win
,
rtn
,
Py_MIN
(
n
,
1023
));
break
;
break
;
case
2
:
case
2
:
if
(
!
PyArg_ParseTuple
(
args
,
"ii;y,x"
,
&
y
,
&
x
))
if
(
!
PyArg_ParseTuple
(
args
,
"ii;y,x"
,
&
y
,
&
x
))
...
@@ -1384,7 +1380,7 @@ PyCursesWindow_InStr(PyCursesWindowObject *self, PyObject *args)
...
@@ -1384,7 +1380,7 @@ PyCursesWindow_InStr(PyCursesWindowObject *self, PyObject *args)
case
3
:
case
3
:
if
(
!
PyArg_ParseTuple
(
args
,
"iii;y,x,n"
,
&
y
,
&
x
,
&
n
))
if
(
!
PyArg_ParseTuple
(
args
,
"iii;y,x,n"
,
&
y
,
&
x
,
&
n
))
return
NULL
;
return
NULL
;
rtn2
=
mvwinnstr
(
self
->
win
,
y
,
x
,
rtn
,
MIN
(
n
,
1023
));
rtn2
=
mvwinnstr
(
self
->
win
,
y
,
x
,
rtn
,
Py_
MIN
(
n
,
1023
));
break
;
break
;
default:
default:
PyErr_SetString
(
PyExc_TypeError
,
"instr requires 0 or 3 arguments"
);
PyErr_SetString
(
PyExc_TypeError
,
"instr requires 0 or 3 arguments"
);
...
...
Modules/_multiprocessing/multiprocessing.h
View file @
38fdc11c
...
@@ -99,13 +99,4 @@ PyObject *_PyMp_SetError(PyObject *Type, int num);
...
@@ -99,13 +99,4 @@ PyObject *_PyMp_SetError(PyObject *Type, int num);
extern
PyTypeObject
_PyMp_SemLockType
;
extern
PyTypeObject
_PyMp_SemLockType
;
/*
* Miscellaneous
*/
#ifndef MIN
# define MIN(x, y) ((x) < (y) ? x : y)
# define MAX(x, y) ((x) > (y) ? x : y)
#endif
#endif
/* MULTIPROCESSING_H */
#endif
/* MULTIPROCESSING_H */
Modules/md5module.c
View file @
38fdc11c
...
@@ -91,10 +91,6 @@ typedef struct {
...
@@ -91,10 +91,6 @@ typedef struct {
(y)[3] = (unsigned char)(((x)>>24)&255); (y)[2] = (unsigned char)(((x)>>16)&255); \
(y)[3] = (unsigned char)(((x)>>24)&255); (y)[2] = (unsigned char)(((x)>>16)&255); \
(y)[1] = (unsigned char)(((x)>>8)&255); (y)[0] = (unsigned char)((x)&255); }
(y)[1] = (unsigned char)(((x)>>8)&255); (y)[0] = (unsigned char)((x)&255); }
#ifndef MIN
#define MIN(x, y) ( ((x)<(y))?(x):(y) )
#endif
/* MD5 macros */
/* MD5 macros */
...
@@ -244,7 +240,7 @@ md5_process(struct md5_state *md5, const unsigned char *in, Py_ssize_t inlen)
...
@@ -244,7 +240,7 @@ md5_process(struct md5_state *md5, const unsigned char *in, Py_ssize_t inlen)
in
+=
MD5_BLOCKSIZE
;
in
+=
MD5_BLOCKSIZE
;
inlen
-=
MD5_BLOCKSIZE
;
inlen
-=
MD5_BLOCKSIZE
;
}
else
{
}
else
{
n
=
MIN
(
inlen
,
(
Py_ssize_t
)(
MD5_BLOCKSIZE
-
md5
->
curlen
));
n
=
Py_
MIN
(
inlen
,
(
Py_ssize_t
)(
MD5_BLOCKSIZE
-
md5
->
curlen
));
memcpy
(
md5
->
buf
+
md5
->
curlen
,
in
,
(
size_t
)
n
);
memcpy
(
md5
->
buf
+
md5
->
curlen
,
in
,
(
size_t
)
n
);
md5
->
curlen
+=
(
MD5_INT32
)
n
;
md5
->
curlen
+=
(
MD5_INT32
)
n
;
in
+=
n
;
in
+=
n
;
...
...
Modules/sha1module.c
View file @
38fdc11c
...
@@ -92,10 +92,6 @@ typedef struct {
...
@@ -92,10 +92,6 @@ typedef struct {
(y)[4] = (unsigned char)(((x)>>24)&255); (y)[5] = (unsigned char)(((x)>>16)&255); \
(y)[4] = (unsigned char)(((x)>>24)&255); (y)[5] = (unsigned char)(((x)>>16)&255); \
(y)[6] = (unsigned char)(((x)>>8)&255); (y)[7] = (unsigned char)((x)&255); }
(y)[6] = (unsigned char)(((x)>>8)&255); (y)[7] = (unsigned char)((x)&255); }
#ifndef MIN
#define MIN(x, y) ( ((x)<(y))?(x):(y) )
#endif
/* SHA1 macros */
/* SHA1 macros */
...
@@ -220,7 +216,7 @@ sha1_process(struct sha1_state *sha1,
...
@@ -220,7 +216,7 @@ sha1_process(struct sha1_state *sha1,
in
+=
SHA1_BLOCKSIZE
;
in
+=
SHA1_BLOCKSIZE
;
inlen
-=
SHA1_BLOCKSIZE
;
inlen
-=
SHA1_BLOCKSIZE
;
}
else
{
}
else
{
n
=
MIN
(
inlen
,
(
Py_ssize_t
)(
SHA1_BLOCKSIZE
-
sha1
->
curlen
));
n
=
Py_
MIN
(
inlen
,
(
Py_ssize_t
)(
SHA1_BLOCKSIZE
-
sha1
->
curlen
));
memcpy
(
sha1
->
buf
+
sha1
->
curlen
,
in
,
(
size_t
)
n
);
memcpy
(
sha1
->
buf
+
sha1
->
curlen
,
in
,
(
size_t
)
n
);
sha1
->
curlen
+=
(
SHA1_INT32
)
n
;
sha1
->
curlen
+=
(
SHA1_INT32
)
n
;
in
+=
n
;
in
+=
n
;
...
...
Modules/socketmodule.c
View file @
38fdc11c
...
@@ -95,9 +95,6 @@ Local naming conventions:
...
@@ -95,9 +95,6 @@ Local naming conventions:
#include "Python.h"
#include "Python.h"
#include "structmember.h"
#include "structmember.h"
#undef MAX
#define MAX(x, y) ((x) < (y) ? (y) : (x))
/* Socket object documentation */
/* Socket object documentation */
PyDoc_STRVAR
(
sock_doc
,
PyDoc_STRVAR
(
sock_doc
,
"socket([family[, type[, proto]]]) -> socket object
\n
\
"socket([family[, type[, proto]]]) -> socket object
\n
\
...
@@ -4819,7 +4816,7 @@ socket_inet_pton(PyObject *self, PyObject *args)
...
@@ -4819,7 +4816,7 @@ socket_inet_pton(PyObject *self, PyObject *args)
char
*
ip
;
char
*
ip
;
int
retval
;
int
retval
;
#ifdef ENABLE_IPV6
#ifdef ENABLE_IPV6
char
packed
[
MAX
(
sizeof
(
struct
in_addr
),
sizeof
(
struct
in6_addr
))];
char
packed
[
Py_
MAX
(
sizeof
(
struct
in_addr
),
sizeof
(
struct
in6_addr
))];
#else
#else
char
packed
[
sizeof
(
struct
in_addr
)];
char
packed
[
sizeof
(
struct
in_addr
)];
#endif
#endif
...
@@ -4870,7 +4867,7 @@ socket_inet_ntop(PyObject *self, PyObject *args)
...
@@ -4870,7 +4867,7 @@ socket_inet_ntop(PyObject *self, PyObject *args)
int
len
;
int
len
;
const
char
*
retval
;
const
char
*
retval
;
#ifdef ENABLE_IPV6
#ifdef ENABLE_IPV6
char
ip
[
MAX
(
INET_ADDRSTRLEN
,
INET6_ADDRSTRLEN
)
+
1
];
char
ip
[
Py_
MAX
(
INET_ADDRSTRLEN
,
INET6_ADDRSTRLEN
)
+
1
];
#else
#else
char
ip
[
INET_ADDRSTRLEN
+
1
];
char
ip
[
INET_ADDRSTRLEN
+
1
];
#endif
#endif
...
...
Objects/floatobject.c
View file @
38fdc11c
...
@@ -9,11 +9,6 @@
...
@@ -9,11 +9,6 @@
#include <ctype.h>
#include <ctype.h>
#include <float.h>
#include <float.h>
#undef MAX
#undef MIN
#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) < (y) ? (x) : (y))
/* Special free list
/* Special free list
free_list is a singly-linked list of available PyFloatObjects, linked
free_list is a singly-linked list of available PyFloatObjects, linked
...
@@ -1131,7 +1126,7 @@ float_hex(PyObject *v)
...
@@ -1131,7 +1126,7 @@ float_hex(PyObject *v)
}
}
m
=
frexp
(
fabs
(
x
),
&
e
);
m
=
frexp
(
fabs
(
x
),
&
e
);
shift
=
1
-
MAX
(
DBL_MIN_EXP
-
e
,
0
);
shift
=
1
-
Py_
MAX
(
DBL_MIN_EXP
-
e
,
0
);
m
=
ldexp
(
m
,
shift
);
m
=
ldexp
(
m
,
shift
);
e
-=
shift
;
e
-=
shift
;
...
@@ -1285,8 +1280,8 @@ float_fromhex(PyObject *cls, PyObject *arg)
...
@@ -1285,8 +1280,8 @@ float_fromhex(PyObject *cls, PyObject *arg)
fdigits
=
coeff_end
-
s_store
;
fdigits
=
coeff_end
-
s_store
;
if
(
ndigits
==
0
)
if
(
ndigits
==
0
)
goto
parse_error
;
goto
parse_error
;
if
(
ndigits
>
MIN
(
DBL_MIN_EXP
-
DBL_MANT_DIG
-
LONG_MIN
/
2
,
if
(
ndigits
>
Py_
MIN
(
DBL_MIN_EXP
-
DBL_MANT_DIG
-
LONG_MIN
/
2
,
LONG_MAX
/
2
+
1
-
DBL_MAX_EXP
)
/
4
)
LONG_MAX
/
2
+
1
-
DBL_MAX_EXP
)
/
4
)
goto
insane_length_error
;
goto
insane_length_error
;
/* [p <exponent>] */
/* [p <exponent>] */
...
@@ -1342,7 +1337,7 @@ float_fromhex(PyObject *cls, PyObject *arg)
...
@@ -1342,7 +1337,7 @@ float_fromhex(PyObject *cls, PyObject *arg)
/* lsb = exponent of least significant bit of the *rounded* value.
/* lsb = exponent of least significant bit of the *rounded* value.
This is top_exp - DBL_MANT_DIG unless result is subnormal. */
This is top_exp - DBL_MANT_DIG unless result is subnormal. */
lsb
=
MAX
(
top_exp
,
(
long
)
DBL_MIN_EXP
)
-
DBL_MANT_DIG
;
lsb
=
Py_
MAX
(
top_exp
,
(
long
)
DBL_MIN_EXP
)
-
DBL_MANT_DIG
;
x
=
0
.
0
;
x
=
0
.
0
;
if
(
exp
>=
lsb
)
{
if
(
exp
>=
lsb
)
{
...
...
Objects/frameobject.c
View file @
38fdc11c
...
@@ -7,11 +7,6 @@
...
@@ -7,11 +7,6 @@
#include "opcode.h"
#include "opcode.h"
#include "structmember.h"
#include "structmember.h"
#undef MIN
#undef MAX
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define OFF(x) offsetof(PyFrameObject, x)
#define OFF(x) offsetof(PyFrameObject, x)
static
PyMemberDef
frame_memberlist
[]
=
{
static
PyMemberDef
frame_memberlist
[]
=
{
...
@@ -160,8 +155,8 @@ frame_setlineno(PyFrameObject *f, PyObject* p_new_lineno)
...
@@ -160,8 +155,8 @@ frame_setlineno(PyFrameObject *f, PyObject* p_new_lineno)
/* We're now ready to look at the bytecode. */
/* We're now ready to look at the bytecode. */
PyBytes_AsStringAndSize
(
f
->
f_code
->
co_code
,
(
char
**
)
&
code
,
&
code_len
);
PyBytes_AsStringAndSize
(
f
->
f_code
->
co_code
,
(
char
**
)
&
code
,
&
code_len
);
min_addr
=
MIN
(
new_lasti
,
f
->
f_lasti
);
min_addr
=
Py_
MIN
(
new_lasti
,
f
->
f_lasti
);
max_addr
=
MAX
(
new_lasti
,
f
->
f_lasti
);
max_addr
=
Py_
MAX
(
new_lasti
,
f
->
f_lasti
);
/* You can't jump onto a line with an 'except' statement on it -
/* You can't jump onto a line with an 'except' statement on it -
* they expect to have an exception on the top of the stack, which
* they expect to have an exception on the top of the stack, which
...
@@ -293,7 +288,7 @@ frame_setlineno(PyFrameObject *f, PyObject* p_new_lineno)
...
@@ -293,7 +288,7 @@ frame_setlineno(PyFrameObject *f, PyObject* p_new_lineno)
break
;
break
;
}
}
min_delta_iblock
=
MIN
(
min_delta_iblock
,
delta_iblock
);
min_delta_iblock
=
Py_
MIN
(
min_delta_iblock
,
delta_iblock
);
if
(
op
>=
HAVE_ARGUMENT
)
{
if
(
op
>=
HAVE_ARGUMENT
)
{
addr
+=
2
;
addr
+=
2
;
...
...
Objects/longobject.c
View file @
38fdc11c
...
@@ -89,11 +89,6 @@ maybe_small_long(PyLongObject *v)
...
@@ -89,11 +89,6 @@ maybe_small_long(PyLongObject *v)
*/
*/
#define FIVEARY_CUTOFF 8
#define FIVEARY_CUTOFF 8
#undef MIN
#undef MAX
#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))
#define SIGCHECK(PyTryBlock) \
#define SIGCHECK(PyTryBlock) \
do { \
do { \
if (PyErr_CheckSignals()) PyTryBlock \
if (PyErr_CheckSignals()) PyTryBlock \
...
@@ -3029,7 +3024,7 @@ kmul_split(PyLongObject *n,
...
@@ -3029,7 +3024,7 @@ kmul_split(PyLongObject *n,
Py_ssize_t
size_lo
,
size_hi
;
Py_ssize_t
size_lo
,
size_hi
;
const
Py_ssize_t
size_n
=
ABS
(
Py_SIZE
(
n
));
const
Py_ssize_t
size_n
=
ABS
(
Py_SIZE
(
n
));
size_lo
=
MIN
(
size_n
,
size
);
size_lo
=
Py_
MIN
(
size_n
,
size
);
size_hi
=
size_n
-
size_lo
;
size_hi
=
size_n
-
size_lo
;
if
((
hi
=
_PyLong_New
(
size_hi
))
==
NULL
)
if
((
hi
=
_PyLong_New
(
size_hi
))
==
NULL
)
...
@@ -3300,7 +3295,7 @@ k_lopsided_mul(PyLongObject *a, PyLongObject *b)
...
@@ -3300,7 +3295,7 @@ k_lopsided_mul(PyLongObject *a, PyLongObject *b)
nbdone
=
0
;
nbdone
=
0
;
while
(
bsize
>
0
)
{
while
(
bsize
>
0
)
{
PyLongObject
*
product
;
PyLongObject
*
product
;
const
Py_ssize_t
nbtouse
=
MIN
(
bsize
,
asize
);
const
Py_ssize_t
nbtouse
=
Py_
MIN
(
bsize
,
asize
);
/* Multiply the next slice of b by a. */
/* Multiply the next slice of b by a. */
memcpy
(
bslice
->
ob_digit
,
b
->
ob_digit
+
nbdone
,
memcpy
(
bslice
->
ob_digit
,
b
->
ob_digit
+
nbdone
,
...
@@ -3591,7 +3586,7 @@ long_true_divide(PyObject *v, PyObject *w)
...
@@ -3591,7 +3586,7 @@ long_true_divide(PyObject *v, PyObject *w)
goto
underflow_or_zero
;
goto
underflow_or_zero
;
/* Choose value for shift; see comments for step 1 above. */
/* Choose value for shift; see comments for step 1 above. */
shift
=
MAX
(
diff
,
DBL_MIN_EXP
)
-
DBL_MANT_DIG
-
2
;
shift
=
Py_
MAX
(
diff
,
DBL_MIN_EXP
)
-
DBL_MANT_DIG
-
2
;
inexact
=
0
;
inexact
=
0
;
...
@@ -3662,7 +3657,7 @@ long_true_divide(PyObject *v, PyObject *w)
...
@@ -3662,7 +3657,7 @@ long_true_divide(PyObject *v, PyObject *w)
x_bits
=
(
x_size
-
1
)
*
PyLong_SHIFT
+
bits_in_digit
(
x
->
ob_digit
[
x_size
-
1
]);
x_bits
=
(
x_size
-
1
)
*
PyLong_SHIFT
+
bits_in_digit
(
x
->
ob_digit
[
x_size
-
1
]);
/* The number of extra bits that have to be rounded away. */
/* The number of extra bits that have to be rounded away. */
extra_bits
=
MAX
(
x_bits
,
DBL_MIN_EXP
-
shift
)
-
DBL_MANT_DIG
;
extra_bits
=
Py_
MAX
(
x_bits
,
DBL_MIN_EXP
-
shift
)
-
DBL_MANT_DIG
;
assert
(
extra_bits
==
2
||
extra_bits
==
3
);
assert
(
extra_bits
==
2
||
extra_bits
==
3
);
/* Round by directly modifying the low digit of x. */
/* Round by directly modifying the low digit of x. */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment