Mark Dickinson <dicki...@gmail.com> added the comment:

+#define _PyLong_IS_SMALL_INT(v) \
+    (((PyLongObject *)(v)) >= _PyLong_small_ints && \
+     ((PyLongObject *)(v)) < _PyLong_SMALL_INTS_END)
+/* These macros purposedly avoid a cast to int, since it is most of time
+   useless, and sometimes detrimental (because of truncation).
+   XXX _PyLong_AS_SMALL_INT might be slower if sizeof(PyLongObject) is not
+   a power of two.
+   */

Urk!  This is nasty.  :(

I don't think arbitrary comparisons of pointers give well-defined results, 
unless those pointers both happen to point into the same array.  (Might be 
wrong;  I don't have a copy of the C standard to hand.)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10044>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to