]> git.eshelyaron.com Git - emacs.git/commitdiff
(MOST_NEGATIVE_FIXNUM, MOST_POSITIVE_FIXNUM)
authorGerd Moellmann <gerd@gnu.org>
Sat, 6 Oct 2001 23:25:06 +0000 (23:25 +0000)
committerGerd Moellmann <gerd@gnu.org>
Sat, 6 Oct 2001 23:25:06 +0000 (23:25 +0000)
(FIXNUM_OVERFLOW_P): New macros.

src/lisp.h

index e7de504f464beabf04a0a67238478deabed62d2d..2080cf6b4e2dec7a0bc082310ce064286d33e37b 100644 (file)
@@ -387,6 +387,10 @@ extern size_t pure_size;
 #define make_number(N)         \
   ((((EMACS_INT) (N)) & VALMASK) | ((EMACS_INT) Lisp_Int) << VALBITS)
 
+#define make_fixnum(x) make_number (x)
+#define MOST_NEGATIVE_FIXNUM   ((EMACS_INT) 1 << (VALBITS - 1))
+#define MOST_POSITIVE_FIXNUM   (MOST_NEGATIVE_FIXNUM - 1)
+
 /* During garbage collection, XGCTYPE must be used for extracting types
  so that the mark bit is ignored.  XMARKBIT accesses the markbit.
  Markbits are used only in particular slots of particular structure types.
@@ -468,6 +472,16 @@ extern Lisp_Object make_number ();
 
 #endif /* NO_UNION_TYPE */
 
+/* Largest and smallest representable fixnum values.  */
+
+#define MOST_NEGATIVE_FIXNUM   ((EMACS_INT) 1 << (VALBITS - 1))
+#define MOST_POSITIVE_FIXNUM   (MOST_NEGATIVE_FIXNUM - 1)
+
+/* Value is non-zero if C integer I doesn't fit into a Lisp fixnum.  */
+
+#define FIXNUM_OVERFLOW_P(i) \
+  ((i) > MOST_POSITIVE_FIXNUM || (i) < MOST_NEGATIVE_FIXNUM)
+
 /* Extract a value or address from a Lisp_Object.  */
 
 #define XCONS(a) (eassert (GC_CONSP(a)),(struct Lisp_Cons *) XPNTR(a))