emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] feature/tramp-thread-safe 2ff7017 1/2: Merge branch 'maste


From: Michael Albinus
Subject: [Emacs-diffs] feature/tramp-thread-safe 2ff7017 1/2: Merge branch 'master' into feature/tramp-thread-safe
Date: Fri, 17 Aug 2018 05:07:35 -0400 (EDT)

branch: feature/tramp-thread-safe
commit 2ff70179566cff8917f7cc33f360ed3b31b377ff
Merge: 5df7423 64eb9b7
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    Merge branch 'master' into feature/tramp-thread-safe
---
 build-aux/config.sub                  |   62 +-
 configure.ac                          |   30 +-
 doc/emacs/display.texi                |    6 +-
 doc/emacs/files.texi                  |   13 +-
 doc/emacs/maintaining.texi            |   11 +-
 doc/lispref/display.texi              |   14 +-
 doc/lispref/internals.texi            |   41 +-
 doc/lispref/numbers.texi              |  130 +-
 doc/lispref/objects.texi              |   26 +-
 doc/misc/gnus.texi                    |    6 +
 doc/misc/tramp.texi                   |   13 +-
 etc/NEWS                              |   60 +-
 lib-src/emacsclient.c                 |    4 +-
 lib-src/etags.c                       |    4 +-
 lib/gnulib.mk.in                      |    4 +-
 lib/regcomp.c                         |   27 +-
 lib/verify.h                          |    3 +-
 lisp/Makefile.in                      |    2 +-
 lisp/calendar/todo-mode.el            |  420 ++--
 lisp/cus-start.el                     |    1 +
 lisp/emacs-lisp/byte-opt.el           |    4 +-
 lisp/emacs-lisp/package.el            |   13 +-
 lisp/files.el                         |    2 +-
 lisp/gnus/nnimap.el                   |   93 +-
 lisp/hi-lock.el                       |   23 +-
 lisp/ibuffer.el                       |   27 +-
 lisp/international/ccl.el             |   18 +-
 lisp/international/fontset.el         |    4 +-
 lisp/international/iso-transl.el      |   24 +-
 lisp/international/mule-conf.el       |   10 +-
 lisp/international/mule.el            |   12 +-
 lisp/jsonrpc.el                       |  145 +-
 lisp/language/thai.el                 |    4 +-
 lisp/net/eudc-bob.el                  |  117 +-
 lisp/net/eudc-hotlist.el              |   10 +-
 lisp/net/eudc.el                      |   69 +-
 lisp/net/eudcb-bbdb.el                |   40 +-
 lisp/progmodes/xref.el                |    6 +-
 lisp/shadowfile.el                    |   23 +-
 lisp/simple.el                        |    2 +-
 lisp/startup.el                       |    4 +-
 lisp/textmodes/flyspell.el            |   37 +-
 lisp/textmodes/ispell.el              |    6 +
 lisp/thingatpt.el                     |   24 +-
 lisp/vc/vc-hooks.el                   |   30 +-
 lisp/w32-fns.el                       |    2 +-
 src/.gdbinit                          |   46 +-
 src/Makefile.in                       |    7 +-
 src/alloc.c                           |  589 ++---
 src/bidi.c                            |   12 +-
 src/buffer.c                          |  454 ++--
 src/buffer.h                          |    8 +-
 src/bytecode.c                        |   76 +-
 src/callint.c                         |   28 +-
 src/callproc.c                        |   24 +-
 src/casefiddle.c                      |   20 +-
 src/casetab.c                         |   32 +-
 src/category.c                        |   52 +-
 src/category.h                        |   12 +-
 src/ccl.c                             |  188 +-
 src/character.c                       |   84 +-
 src/character.h                       |    8 +-
 src/charset.c                         |  284 +--
 src/charset.h                         |    6 +-
 src/chartab.c                         |   96 +-
 src/cmds.c                            |   62 +-
 src/coding.c                          |  418 ++--
 src/composite.c                       |  154 +-
 src/composite.h                       |   56 +-
 src/conf_post.h                       |   18 +-
 src/data.c                            |  762 ++++--
 src/dbusbind.c                        |   74 +-
 src/decompress.c                      |    4 +-
 src/dired.c                           |   22 +-
 src/dispextern.h                      |   18 +-
 src/dispnew.c                         |   18 +-
 src/disptab.h                         |    4 +-
 src/doc.c                             |   28 +-
 src/dosfns.c                          |   68 +-
 src/editfns.c                         |  447 ++--
 src/emacs-module.c                    |   47 +-
 src/emacs.c                           |   48 +-
 src/eval.c                            |   56 +-
 src/fileio.c                          |  144 +-
 src/floatfns.c                        |   81 +-
 src/fns.c                             |  298 ++-
 src/font.c                            |  436 ++--
 src/font.h                            |   14 +-
 src/fontset.c                         |  147 +-
 src/frame.c                           |  366 +--
 src/frame.h                           |   14 +-
 src/fringe.c                          |   40 +-
 src/ftcrfont.c                        |    2 +-
 src/ftfont.c                          |   80 +-
 src/gfilenotify.c                     |   15 +-
 src/gnutls.c                          |   92 +-
 src/gtkutil.c                         |   24 +-
 src/image.c                           |  172 +-
 src/indent.c                          |  150 +-
 src/inotify.c                         |   16 +-
 src/insdel.c                          |   34 +-
 src/intervals.c                       |   50 +-
 src/json.c                            |   21 +-
 src/keyboard.c                        |  380 +--
 src/keyboard.h                        |    8 +-
 src/keymap.c                          |  218 +-
 src/kqueue.c                          |   40 +-
 src/lcms.c                            |   22 +-
 src/lisp.h                            |  448 ++--
 src/lread.c                           |  202 +-
 src/macfont.m                         |   62 +-
 src/macros.c                          |   22 +-
 src/marker.c                          |   12 +-
 src/menu.c                            |   34 +-
 src/mini-gmp-emacs.c                  |   32 +
 src/mini-gmp.c                        | 4452 +++++++++++++++++++++++++++++++++
 src/mini-gmp.h                        |  300 +++
 src/minibuf.c                         |   74 +-
 src/msdos.c                           |   44 +-
 src/nsfns.m                           |  156 +-
 src/nsfont.m                          |   24 +-
 src/nsimage.m                         |   18 +-
 src/nsmenu.m                          |    2 +-
 src/nsselect.m                        |   14 +-
 src/nsterm.m                          |   40 +-
 src/print.c                           |  220 +-
 src/process.c                         |  196 +-
 src/profiler.c                        |   24 +-
 src/search.c                          |   92 +-
 src/sound.c                           |   12 +-
 src/syntax.c                          |  190 +-
 src/syntax.h                          |    2 +-
 src/sysdep.c                          |   60 +-
 src/term.c                            |   34 +-
 src/termhooks.h                       |    2 +-
 src/terminal.c                        |    4 +-
 src/textprop.c                        |  248 +-
 src/undo.c                            |   34 +-
 src/unexcw.c                          |    6 +-
 src/w16select.c                       |    2 +-
 src/w32.c                             |   48 +-
 src/w32console.c                      |   10 +-
 src/w32cygwinx.c                      |   16 +-
 src/w32fns.c                          |  318 +--
 src/w32font.c                         |   40 +-
 src/w32inevt.c                        |    8 +-
 src/w32proc.c                         |   88 +-
 src/w32select.c                       |   14 +-
 src/w32term.c                         |   52 +-
 src/w32term.h                         |    4 +-
 src/w32uniscribe.c                    |   12 +-
 src/widget.c                          |   10 +-
 src/window.c                          |  370 +--
 src/xdisp.c                           |  655 +++--
 src/xfaces.c                          |  158 +-
 src/xfns.c                            |  234 +-
 src/xfont.c                           |   26 +-
 src/xftfont.c                         |   28 +-
 src/xmenu.c                           |   16 +-
 src/xml.c                             |    4 +-
 src/xrdb.c                            |    6 +-
 src/xselect.c                         |   80 +-
 src/xsettings.c                       |    2 +-
 src/xterm.c                           |  103 +-
 src/xwidget.c                         |   28 +-
 test/lisp/calendar/todo-mode-tests.el |   41 +
 test/lisp/international/ccl-tests.el  |  238 ++
 test/lisp/net/tramp-archive-tests.el  |   14 +
 test/lisp/net/tramp-tests.el          |   86 +-
 test/lisp/shadowfile-tests.el         |   46 +-
 test/lisp/thingatpt-tests.el          |    5 +-
 test/lisp/wdired-tests.el             |    4 +-
 test/src/data-tests.el                |  143 +-
 test/src/editfns-tests.el             |   47 +-
 test/src/emacs-module-tests.el        |    8 +-
 test/src/floatfns-tests.el            |   12 +
 test/src/fns-tests.el                 |   20 +
 test/src/lread-tests.el               |    4 +-
 test/src/print-tests.el               |    6 +
 179 files changed, 12331 insertions(+), 6555 deletions(-)

diff --git a/build-aux/config.sub b/build-aux/config.sub
index 52eb02e..97d38aa 100755
--- a/build-aux/config.sub
+++ b/build-aux/config.sub
@@ -569,12 +569,14 @@ case $basic_machine in
        1750a | 580 \
        | a29k \
        | aarch64 | aarch64_be \
+       | abacus \
        | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
        | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | 
alpha64pca5[67] \
        | am33_2.0 \
        | arc | arceb \
        | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv6m | 
armv[78][arm] \
        | avr | avr32 \
+       | asmjs \
        | ba \
        | be32 | be64 \
        | bfin \
@@ -628,7 +630,7 @@ case $basic_machine in
        | riscv | riscv32 | riscv64 \
        | rl78 | rx \
        | score \
-       | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | 
shbe | shle | sh[1234]le | sh3ele \
+       | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | 
shbe | shle | sh[1234]le | sh[23]ele \
        | sh64 | sh64le \
        | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | 
sparclite \
        | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
@@ -654,15 +656,18 @@ case $basic_machine in
        leon|leon[3-9])
                basic_machine=sparc-$basic_machine
                ;;
+       m6811-* | m68hc11-* | m6812-* | m68hc12-* | m68hcs12x-* | nvptx-* | 
picochip-*)
+               ;;
        m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
                basic_machine=$basic_machine-unknown
-               os=${os:-none}
                ;;
        m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65)
                ;;
        m9s12z | m68hcs12z | hcs12z | s12z)
                basic_machine=s12z-unknown
-               os=${os:-none}
+               ;;
+       m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
+               basic_machine=s12z-`echo "$basic_machine" | sed 's/^[^-]*-//'`
                ;;
        ms1)
                basic_machine=mt-unknown
@@ -672,7 +677,8 @@ case $basic_machine in
                ;;
        xgate)
                basic_machine=$basic_machine-unknown
-               os=${os:-none}
+               ;;
+       xgate-*)
                ;;
        xscaleeb)
                basic_machine=armeb-unknown
@@ -689,22 +695,26 @@ case $basic_machine in
          basic_machine=$basic_machine-pc
          ;;
        # Recognize the basic CPU types with company name.
-       580-* \
+       1750a-* | 580-* \
        | a29k-* \
        | aarch64-* | aarch64_be-* \
+       | abacus-* \
        | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
        | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
-       | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
-       | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+       | alphapca5[67]-* | alpha64pca5[67]-* \
+       | am33_2.0-* \
+       | arc-* | arceb-* \
+       | arm-*  | arm[lb]e-* | arme[lb]-* | armv*-* \
        | avr-* | avr32-* \
+       | asmjs-* \
        | ba-* \
        | be32-* | be64-* \
        | bfin-* | bs2000-* \
        | c[123]* | c30-* | [cjt]90-* | c4x-* \
        | c8051-* | clipper-* | craynv-* | csky-* | cydra-* \
-       | d10v-* | d30v-* | dlx-* \
-       | e2k-* | elxsi-* \
-       | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+       | d10v-* | d30v-* | dlx-* | dsp16xx-* \
+       | e2k-* | elxsi-* | epiphany-* \
+       | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | ft32-* | fx80-* \
        | h8300-* | h8500-* \
        | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
        | hexagon-* \
@@ -714,8 +724,8 @@ case $basic_machine in
        | le32-* | le64-* \
        | lm32-* \
        | m32c-* | m32r-* | m32rle-* \
-       | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-       | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
+       | m5200-* | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* | 
v70-* | w65-* \
+       | m88110-* | m88k-* | maxq-* | mb-* | mcore-* | mep-* | metag-* \
        | microblaze-* | microblazeel-* \
        | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
        | mips16-* \
@@ -739,6 +749,7 @@ case $basic_machine in
        | mipsr5900-* | mipsr5900el-* \
        | mipstx39-* | mipstx39el-* \
        | mmix-* \
+       | mn10200-* | mn10300-* \
        | moxie-* \
        | mt-* \
        | msp430-* \
@@ -748,6 +759,7 @@ case $basic_machine in
        | none-* | np1-* | ns16k-* | ns32k-* \
        | open8-* \
        | or1k*-* \
+       | or32-* \
        | orion-* \
        | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
        | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
@@ -755,14 +767,15 @@ case $basic_machine in
        | pyramid-* \
        | riscv-* | riscv32-* | riscv64-* \
        | rl78-* | romp-* | rs6000-* | rx-* \
-       | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* 
| sheb-* | shbe-* \
-       | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+       | score-* \
+       | sh-* | sh[1234]-* | sh[24]a-* | sh[24]ae[lb]-* | sh[23]e-* | 
she[lb]-* | sh[lb]e-* \
+       | sh[1234]e[lb]-* |  sh[12345][lb]e-* | sh[23]ele-* | sh64-* | sh64le-* 
\
        | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | 
sparclet-* \
        | sparclite-* \
        | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
+       | spu-* \
        | tahoe-* \
        | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
-       | tile*-* \
        | tron-* \
        | ubicom32-* \
        | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
@@ -787,9 +800,6 @@ case $basic_machine in
        3b*)
                basic_machine=we32k-att
                ;;
-       abacus)
-               basic_machine=abacus-unknown
-               ;;
        alliant | fx80)
                basic_machine=fx80-alliant
                ;;
@@ -805,9 +815,6 @@ case $basic_machine in
        amiga | amiga-*)
                basic_machine=m68k-unknown
                ;;
-       asmjs)
-               basic_machine=asmjs-unknown
-               ;;
        blackfin-*)
                basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'`
                os=linux
@@ -1154,6 +1161,9 @@ case $basic_machine in
        sh5el)
                basic_machine=sh5le-unknown
                ;;
+       sh5el-*)
+               basic_machine=sh5le-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+               ;;
        simso-wrs)
                basic_machine=sparclite-wrs
                os=vxworks
@@ -1179,9 +1189,11 @@ case $basic_machine in
        sun386 | sun386i | roadrunner)
                basic_machine=i386-sun
                ;;
+       tile*-*)
+               ;;
        tile*)
                basic_machine=$basic_machine-unknown
-               os=linux-gnu
+               os=${os:-linux-gnu}
                ;;
        tx39)
                basic_machine=mipstx39-unknown
@@ -1214,7 +1226,6 @@ case $basic_machine in
                ;;
        none)
                basic_machine=none-none
-               os=${os:-none}
                ;;
 
 # Here we handle the default manufacturer of certain CPU types.  It is in
@@ -1246,9 +1257,6 @@ case $basic_machine in
        we32k)
                basic_machine=we32k-att
                ;;
-       sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
-               basic_machine=sh-unknown
-               ;;
        cydra)
                basic_machine=cydra-cydrome
                ;;
@@ -1354,7 +1362,7 @@ case $os in
             | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
             | aos* | aros* | cloudabi* | sortix* \
             | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
-            | clix* | riscos* | uniplus* | iris* | rtu* | xenix* \
+            | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
             | knetbsd* | mirbsd* | netbsd* \
             | bitrig* | openbsd* | solidbsd* | libertybsd* \
             | ekkobsd* | kfreebsd* | freebsd* | riscix* | lynxos* \
diff --git a/configure.ac b/configure.ac
index b691867..e5d094c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -966,6 +966,7 @@ AS_IF([test $gl_gcc_warnings = no],
   nw="$nw -Wsync-nand"              # irrelevant here, and provokes ObjC 
warning
   nw="$nw -Wunsafe-loop-optimizations" # OK to suppress unsafe optimizations
   nw="$nw -Wbad-function-cast"      # These casts are no worse than others.
+  nw="$nw -Wabi"                    # Not useful, perceived as noise
 
   # Emacs doesn't care about shadowing; see
   # <https://lists.gnu.org/r/emacs-diffs/2011-11/msg00265.html>.
@@ -4302,6 +4303,32 @@ AC_SUBST(KRB5LIB)
 AC_SUBST(DESLIB)
 AC_SUBST(KRB4LIB)
 
+AC_ARG_WITH([libgmp],
+  [AS_HELP_STRING([--without-libgmp],
+                 [don't use the GNU Multiple Precision (GMP) library;
+                  this is the default on systems lacking libgmp.])])
+GMP_LIB=
+GMP_OBJ=mini-gmp-emacs.o
+HAVE_GMP=no
+case $with_libgmp in
+  no) ;;
+  yes) HAVE_GMP=yes GMP_LIB=-lgmp;;
+  *) AC_CHECK_HEADERS([gmp.h],
+       [OLIBS=$LIBS
+       AC_SEARCH_LIBS([__gmpz_roinit_n], [gmp])
+       LIBS=$OLIBS
+       case $ac_cv_search___gmpz_roinit_n in
+         'none needed') HAVE_GMP=yes;;
+         -*) HAVE_GMP=yes GMP_LIB=$ac_cv_search___gmpz_roinit_n;;
+       esac]);;
+esac
+if test "$HAVE_GMP" = yes; then
+  GMP_OBJ=
+  AC_DEFINE([HAVE_GMP], 1, [Define to 1 if you have recent-enough GMP.])
+fi
+AC_SUBST([GMP_LIB])
+AC_SUBST([GMP_OBJ])
+
 AC_CHECK_HEADERS(valgrind/valgrind.h)
 
 AC_CHECK_MEMBERS([struct unipair.unicode], [], [], [[#include <linux/kd.h>]])
@@ -5398,7 +5425,7 @@ emacs_config_features=
 for opt in XAW3D XPM JPEG TIFF GIF PNG RSVG CAIRO IMAGEMAGICK SOUND GPM DBUS \
   GCONF GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT \
   LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS X_TOOLKIT OLDXMENU X11 NS MODULES \
-  THREADS XWIDGETS LIBSYSTEMD JSON CANNOT_DUMP LCMS2; do
+  THREADS XWIDGETS LIBSYSTEMD JSON CANNOT_DUMP LCMS2 GMP; do
 
     case $opt in
       CANNOT_DUMP) eval val=\${$opt} ;;
@@ -5450,6 +5477,7 @@ AS_ECHO(["  Does Emacs use -lXaw3d?                       
          ${HAVE_XAW3D
   Does Emacs use -lxft?                                   ${HAVE_XFT}
   Does Emacs use -lsystemd?                               ${HAVE_LIBSYSTEMD}
   Does Emacs use -ljansson?                               ${HAVE_JSON}
+  Does Emacs use -lgmp?                                   ${HAVE_GMP}
   Does Emacs directly use zlib?                           ${HAVE_ZLIB}
   Does Emacs have dynamic modules support?                ${HAVE_MODULES}
   Does Emacs use toolkit scroll bars?                     
${USE_TOOLKIT_SCROLL_BARS}
diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi
index 2f5ce80..d9a08b9 100644
--- a/doc/emacs/display.texi
+++ b/doc/emacs/display.texi
@@ -974,8 +974,10 @@ the buffer is loaded.  For example, to highlight all 
occurrences of
 the word ``whim'' using the default face (a yellow background), type
 @kbd{M-s h r whim @key{RET} @key{RET}}.  Any face can be used for
 highlighting, Hi Lock provides several of its own and these are
-pre-loaded into a list of default values.  While being prompted
-for a face use @kbd{M-n} and @kbd{M-p} to cycle through them.
+pre-loaded into a list of default values.  While being prompted for a
+face use @kbd{M-n} and @kbd{M-p} to cycle through them.  A prefix
+numeric argument limits the highlighting to the corresponding
+subexpression.
 
 @vindex hi-lock-auto-select-face
 Setting the option @code{hi-lock-auto-select-face} to a address@hidden
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
index 7a728aa..4d5605e 100644
--- a/doc/emacs/files.texi
+++ b/doc/emacs/files.texi
@@ -1051,13 +1051,16 @@ separate file, without altering the file you actually 
use.  This is
 called @dfn{auto-saving}.  It prevents you from losing more than a
 limited amount of work if the system crashes.
 
address@hidden auto-save-no-message
   When Emacs determines that it is time for auto-saving, it considers
 each buffer, and each is auto-saved if auto-saving is enabled for it
-and it has been changed since the last time it was auto-saved.  The
-message @samp{Auto-saving...} is displayed in the echo area during
-auto-saving, if any files are actually auto-saved.  Errors occurring
-during auto-saving are caught so that they do not interfere with the
-execution of commands you have been typing.
+and it has been changed since the last time it was auto-saved.  When
+the @code{auto-save-no-message} variable is set to @code{nil} (the
+default), the message @samp{Auto-saving...} is displayed in the echo
+area during auto-saving, if any files are actually auto-saved; to
+disable these messages, customize the variable to a address@hidden
+value.  Errors occurring during auto-saving are caught so that they do
+not interfere with the execution of commands you have been typing.
 
 @menu
 * Files: Auto Save Files.       The file where auto-saved changes are
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi
index b31cacf..5c3017a 100644
--- a/doc/emacs/maintaining.texi
+++ b/doc/emacs/maintaining.texi
@@ -1987,9 +1987,14 @@ Restart one of the last 2 commands above, from the 
current location of point.
 
 @kindex M-?
 @findex xref-find-references
-  @kbd{M-?} finds all the references for the identifier at point.  If
-there's no identifier at point, or when invoked with a prefix
-argument, the command prompts for the identifier, with completion.  It
+  @kbd{M-?} finds all the references for the identifier at point,
+prompting for the identifier as needed, with completion.  Depending on
+the current backend (@pxref{Xref}), the command may prompt even if it
+finds a valid identifier at point.  When invoked with a prefix
+argument, it always prompts for the identifier.  (If you want it to
+prompt always, customize the value of the variable
address@hidden to @code{t}; or set it to @code{nil}
+to prompt only if there's no usable identifier at point.)  The command
 then presents the @file{*xref*} buffer with all the references to the
 identifier, showing the file name and the line where the identifier is
 referenced.  The XREF mode commands are available in this buffer, see
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index fef5188..ea9a305 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -3498,11 +3498,15 @@ cons @code{(@var{from} . @var{to})}, where @var{from} 
and @var{to} are
 character codepoints.  In that case, use @var{font-spec} for all the
 characters in the range @var{from} and @var{to} (inclusive).
 
address@hidden may be a charset.  In that case, use
address@hidden for all character in the charsets.
address@hidden may be a charset (@pxref{Character Sets}).  In that
+case, use @var{font-spec} for all the characters in the charset.
 
address@hidden may be a script name.  In that case, use
address@hidden for all character in the charsets.
address@hidden may be a script name (@pxref{Character Properties}).
+In that case, use @var{font-spec} for all the characters belonging to
+the script.
+
address@hidden may be @code{nil}, which means to use @var{font-spec}
+for any character which no font-spec is specified.
 
 @var{font-spec} may be a font-spec object created by the function
 @code{font-spec} (@pxref{Low-Level Font}).
@@ -3512,7 +3516,7 @@ where @var{family} is a family name of a font (possibly 
including a
 foundry name at the head), @var{registry} is a registry name of a font
 (possibly including an encoding name at the tail).
 
address@hidden may be a font name string.
address@hidden may be a font name, a string.
 
 @var{font-spec} may be @code{nil}, which explicitly specifies that
 there's no font for the specified @var{character}.  This is useful,
diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi
index 6575286..3fe2844 100644
--- a/doc/lispref/internals.texi
+++ b/doc/lispref/internals.texi
@@ -246,8 +246,8 @@ of 8k bytes, and small vectors are packed into blocks of 4k 
bytes).
 
 @cindex vector-like objects, storage
 @cindex storage of vector-like Lisp objects
-  Beyond the basic vector, a lot of objects like window, buffer, and
-frame are managed as if they were vectors.  The corresponding C data
+  Beyond the basic vector, a lot of objects like markers, overlays and
+buffers are managed as if they were vectors.  The corresponding C data
 structures include the @code{union vectorlike_header} field whose
 @code{size} member contains the subtype enumerated by @code{enum pvec_type}
 and an information about how many @code{Lisp_Object} fields this structure
@@ -318,7 +318,6 @@ future allocations.  So an overall result is:
 @example
 ((@code{conses} @var{cons-size} @var{used-conses} @var{free-conses})
  (@code{symbols} @var{symbol-size} @var{used-symbols} @var{free-symbols})
- (@code{miscs} @var{misc-size} @var{used-miscs} @var{free-miscs})
  (@code{strings} @var{string-size} @var{used-strings} @var{free-strings})
  (@code{string-bytes} @var{byte-size} @var{used-bytes})
  (@code{vectors} @var{vector-size} @var{used-vectors})
@@ -334,7 +333,7 @@ Here is an example:
 @example
 (garbage-collect)
       @result{} ((conses 16 49126 8058) (symbols 48 14607 0)
-                 (miscs 40 34 56) (strings 32 2942 2607)
+                 (strings 32 2942 2607)
                  (string-bytes 1 78607) (vectors 16 7247)
                  (vector-slots 8 341609 29474) (floats 8 71 102)
                  (intervals 56 27 26) (buffers 944 8)
@@ -366,19 +365,6 @@ The number of symbols in use.
 The number of symbols for which space has been obtained from
 the operating system, but that are not currently being used.
 
address@hidden misc-size
-Internal size of a miscellaneous entity, i.e.,
address@hidden (union Lisp_Misc)}, which is a size of the
-largest type enumerated in @code{enum Lisp_Misc_Type}.
-
address@hidden used-miscs
-The number of miscellaneous objects in use.  These include markers
-and overlays, plus certain objects not visible to users.
-
address@hidden free-miscs
-The number of miscellaneous objects for which space has been obtained
-from the operating system, but that are not currently being used.
-
 @item string-size
 Internal size of a string header, i.e., @code{sizeof (struct Lisp_String)}.
 
@@ -593,6 +579,8 @@ in this Emacs session.
 @defvar vector-cells-consed
 The total number of vector cells that have been allocated so far
 in this Emacs session.
+This includes vector-like objects such as markers and overlays, plus
+certain objects not visible to users.
 @end defvar
 
 @defvar symbols-consed
@@ -605,12 +593,6 @@ The total number of string characters that have been 
allocated so far
 in this session.
 @end defvar
 
address@hidden misc-objects-consed
-The total number of miscellaneous objects that have been allocated so
-far in this session.  These include markers and overlays, plus
-certain objects not visible to users.
address@hidden defvar
-
 @defvar intervals-consed
 The total number of intervals that have been allocated so far
 in this Emacs session.
@@ -1001,7 +983,7 @@ a special type to represent the pointers to all of them, 
which is known as
   In C, the tagged pointer is an object of type @code{Lisp_Object}.  Any
 initialized variable of such a type always holds the value of one of the
 following basic data types: integer, symbol, string, cons cell, float,
-vectorlike or miscellaneous object.  Each of these data types has the
+or vectorlike object.  Each of these data types has the
 corresponding tag value.  All tags are enumerated by @code{enum Lisp_Type}
 and placed into a 3-bit bitfield of the @code{Lisp_Object}.  The rest of the
 bits is the value itself.  Integers are immediate, i.e., directly
@@ -1033,18 +1015,13 @@ Symbol, the unique-named entity commonly used as an 
identifier.
 
 @item struct Lisp_Float
 Floating-point value.
-
address@hidden union Lisp_Misc
-Miscellaneous kinds of objects which don't fit into any of the above.
 @end table
 
   These types are the first-class citizens of an internal type system.
-Since the tag space is limited, all other types are the subtypes of either
address@hidden or @code{Lisp_Misc}.  Vector subtypes are enumerated
+Since the tag space is limited, all other types are the subtypes of
address@hidden  Vector subtypes are enumerated
 by @code{enum pvec_type}, and nearly all complex objects like windows, buffers,
-frames, and processes fall into this category.  The rest of special types,
-including markers and overlays, are enumerated by @code{enum Lisp_Misc_Type}
-and form the set of subtypes of @code{Lisp_Misc}.
+frames, and processes fall into this category.
 
   Below there is a description of a few subtypes of @code{Lisp_Vectorlike}.
 Buffer object represents the text to display and edit.  Window is the part
diff --git a/doc/lispref/numbers.texi b/doc/lispref/numbers.texi
index a3317c9..bd633b7 100644
--- a/doc/lispref/numbers.texi
+++ b/doc/lispref/numbers.texi
@@ -14,9 +14,9 @@
 fractional parts, such as @minus{}4.5, 0.0, and 2.71828.  They can
 also be expressed in exponential notation: @samp{1.5e2} is the same as
 @samp{150.0}; here, @samp{e2} stands for ten to the second power, and
-that is multiplied by 1.5.  Integer computations are exact, though
-they may overflow.  Floating-point computations often involve rounding
-errors, as the numbers have a fixed amount of precision.
+that is multiplied by 1.5.  Integer computations are exact.
+Floating-point computations often involve rounding errors, as the
+numbers have a fixed amount of precision.
 
 @menu
 * Integer Basics::            Representation and range of integers.
@@ -34,7 +34,15 @@ errors, as the numbers have a fixed amount of precision.
 @node Integer Basics
 @section Integer Basics
 
-  The range of values for an integer depends on the machine.  The
+  Integers in Emacs Lisp can have arbitrary precision.
+
+  Under the hood, though, there are two kinds of integers: smaller
+ones, called @dfn{fixnums}, and larger ones, called @dfn{bignums}
+Some functions in Emacs only accept fixnums.  Also, while fixnums can
+always be compared for equality with @code{eq}, bignums require the
+use of @code{eql}.
+
+  The range of values for a fixnum depends on the machine.  The
 minimum range is @minus{}536,870,912 to 536,870,911 (30 bits; i.e.,
 @ifnottex
 @minus{}2**29
@@ -49,9 +57,7 @@ to
 @tex
 @math{2^{29}-1}),
 @end tex
-but many machines provide a wider range.  Many examples in this
-chapter assume the minimum integer width of 30 bits.
address@hidden overflow
+but many machines provide a wider range.
 
   The Lisp reader reads an integer as a nonempty sequence
 of decimal digits with optional initial sign and optional
@@ -91,14 +97,8 @@ For example:
 #24r1k @result{} 44
 @end example
 
-  If an integer is outside the Emacs range, the Lisp reader ordinarily
-signals an overflow.  However, if a too-large plain integer ends in a
-period, the Lisp reader treats it as a floating-point number instead.
-This lets an Emacs Lisp program specify a large integer that is
-quietly approximated by a floating-point number on machines with
-limited word width.  For example, @samp{536870912.} is a
-floating-point number if Emacs integers are only 30 bits wide and is
-an integer otherwise.
+  An integer is read as a fixnum if it is in the correct range.
+Otherwise, it will be read as a bignum.
 
   To understand how various functions work on integers, especially the
 bitwise operators (@pxref{Bitwise Operations}), it is often helpful to
@@ -141,16 +141,6 @@ In binary, the decimal integer 4 is 100.  Consequently,
 0111...111111 (30 bits total)
 @end example
 
-  Since the arithmetic functions do not check whether integers go
-outside their range, when you add 1 to 536,870,911, the value is the
-negative integer @minus{}536,870,912:
-
address@hidden
-(+ 1 536870911)
-     @result{} -536870912
-     @result{} 1000...000000 (30 bits total)
address@hidden example
-
   Many of the functions described in this chapter accept markers for
 arguments in place of numbers.  (@xref{Markers}.)  Since the actual
 arguments to such functions may be either numbers or markers, we often
@@ -160,8 +150,8 @@ value is a marker, its position value is used and its 
buffer is ignored.
 @cindex largest Lisp integer
 @cindex maximum Lisp integer
 @defvar most-positive-fixnum
-The value of this variable is the largest integer that Emacs Lisp can
-handle.  Typical values are
+The value of this variable is the largest ``small'' integer that Emacs
+Lisp can handle.  Typical values are
 @ifnottex
 2**29 @minus{} 1
 @end ifnottex
@@ -181,8 +171,8 @@ on 64-bit platforms.
 @cindex smallest Lisp integer
 @cindex minimum Lisp integer
 @defvar most-negative-fixnum
-The value of this variable is the smallest integer that Emacs Lisp can
-handle.  It is negative.  Typical values are
+The value of this variable is the smallest small integer that Emacs
+Lisp can handle.  It is negative.  Typical values are
 @ifnottex
 @minus{}2**29
 @end ifnottex
@@ -327,6 +317,18 @@ use otherwise), but the @code{zerop} predicate requires a 
number as
 its argument.  See also @code{integer-or-marker-p} and
 @code{number-or-marker-p}, in @ref{Predicates on Markers}.
 
address@hidden bignump object
+This predicate tests whether its argument is a large integer, and
+returns @code{t} if so, @code{nil} otherwise.  Unlike small integers,
+large integers can be @code{=} or @code{eql} even if they are not @code{eq}.
address@hidden defun
+
address@hidden fixnump object
+This predicate tests whether its argument is a small integer, and
+returns @code{t} if so, @code{nil} otherwise.  Small integers can be
+compared with @code{eq}.
address@hidden defun
+
 @defun floatp object
 This predicate tests whether its argument is floating point
 and returns @code{t} if so, @code{nil} otherwise.
@@ -367,17 +369,17 @@ if so, @code{nil} otherwise.  The argument must be a 
number.
 
   To test numbers for numerical equality, you should normally use
 @code{=} instead of non-numeric comparison predicates like @code{eq},
address@hidden and @code{equal}.  Distinct floating-point objects can be
-numerically equal.  If you use @code{eq} to compare them, you test
-whether they are the same @emph{object}; if you use @code{eql} or
address@hidden, you test whether their values are
address@hidden and @code{equal}.  Distinct floating-point and large
+integer objects can be numerically equal.  If you use @code{eq} to
+compare them, you test whether they are the same @emph{object}; if you
+use @code{eql} or @code{equal}, you test whether their values are
 @emph{indistinguishable}.  In contrast, @code{=} uses numeric
 comparison, and sometimes returns @code{t} when a non-numeric
 comparison would return @code{nil} and vice versa.  @xref{Float
 Basics}.
 
-  In Emacs Lisp, each integer is a unique Lisp object.
-Therefore, @code{eq} is equivalent to @code{=} where integers are
+  In Emacs Lisp, each small integer is a unique Lisp object.
+Therefore, @code{eq} is equivalent to @code{=} where small integers are
 concerned.  It is sometimes convenient to use @code{eq} for comparing
 an unknown value with an integer, because @code{eq} does not report an
 error if the unknown value is not a number---it accepts arguments of
@@ -405,15 +407,6 @@ Here's a function to do this:
          fuzz-factor)))
 @end example
 
address@hidden CL note---integers vrs @code{eq}
address@hidden
address@hidden Lisp note:} Comparing numbers in Common Lisp always requires
address@hidden because Common Lisp implements multi-word integers, and two
-distinct integer objects can have the same numeric value.  Emacs Lisp
-can have just one integer object for any given value because it has a
-limited range of integers.
address@hidden quotation
-
 @defun = number-or-marker &rest number-or-markers
 This function tests whether all its arguments are numerically equal,
 and returns @code{t} if so, @code{nil} otherwise.
@@ -423,7 +416,8 @@ and returns @code{t} if so, @code{nil} otherwise.
 This function acts like @code{eq} except when both arguments are
 numbers.  It compares numbers by type and numeric value, so that
 @code{(eql 1.0 1)} returns @code{nil}, but @code{(eql 1.0 1.0)} and
address@hidden(eql 1 1)} both return @code{t}.
address@hidden(eql 1 1)} both return @code{t}.  This can be used to compare
+large integers as well as small ones.
 @end defun
 
 @defun /= number-or-marker1 number-or-marker2
@@ -583,10 +577,6 @@ Except for @code{%}, each of these functions accepts both 
integer and
 floating-point arguments, and returns a floating-point number if any
 argument is floating point.
 
-  Emacs Lisp arithmetic functions do not check for integer overflow.
-Thus @code{(1+ 536870911)} may evaluate to
address@hidden, depending on your hardware.
-
 @defun 1+ number-or-marker
 This function returns @var{number-or-marker} plus 1.
 For example,
@@ -912,35 +902,6 @@ On the other hand, shifting one place to the right looks 
like this:
 @noindent
 As the example illustrates, shifting one place to the right divides the
 value of a positive integer by two, rounding downward.
-
-The function @code{lsh}, like all Emacs Lisp arithmetic functions, does
-not check for overflow, so shifting left can discard significant bits
-and change the sign of the number.  For example, left shifting
-536,870,911 produces @minus{}2 in the 30-bit implementation:
-
address@hidden
-(lsh 536870911 1)          ; @r{left shift}
-     @result{} -2
address@hidden example
-
-In binary, the argument looks like this:
-
address@hidden
address@hidden
-;; @r{Decimal 536,870,911}
-0111...111111 (30 bits total)
address@hidden group
address@hidden example
-
address@hidden
-which becomes the following when left shifted:
-
address@hidden
address@hidden
-;; @r{Decimal @minus{}2}
-1111...111110 (30 bits total)
address@hidden group
address@hidden example
 @end defun
 
 @defun ash integer1 count
@@ -967,19 +928,6 @@ looks like this:
 @end group
 @end example
 
-In contrast, shifting the pattern of bits one place to the right with
address@hidden looks like this:
-
address@hidden
address@hidden
-(lsh -6 -1) @result{} 536870909
-;; @r{Decimal @minus{}6 becomes decimal 536,870,909.}
-1111...111010 (30 bits total)
-     @result{}
-0111...111101 (30 bits total)
address@hidden group
address@hidden example
-
 Here are other examples:
 
 @c !!! Check if lined up in smallbook format!  XDVI shows problem
diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi
index b94de80..8c92de1 100644
--- a/doc/lispref/objects.texi
+++ b/doc/lispref/objects.texi
@@ -166,7 +166,10 @@ latter are unique to Emacs Lisp.
 @node Integer Type
 @subsection Integer Type
 
-  The range of values for an integer depends on the machine.  The
+  Under the hood, there are two kinds of integers---small integers,
+called @dfn{fixnums}, and large integers, called @dfn{bignums}.
+
+  The range of values for a fixnum depends on the machine.  The
 minimum range is @minus{}536,870,912 to 536,870,911 (30 bits; i.e.,
 @ifnottex
 @minus{}2**29
@@ -182,8 +185,14 @@ to
 @math{2^{29}-1})
 @end tex
 but many machines provide a wider range.
-Emacs Lisp arithmetic functions do not check for integer overflow.  Thus
address@hidden(1+ 536870911)} is @minus{}536,870,912 if Emacs integers are 30 
bits.
+
+  Bignums can have arbitrary precision.  Operations that overflow a
+fixnum will return a bignum instead.
+
+  Fixnums can be compared with @code{eq}, but bignums require
address@hidden or @code{=}.  The @code{fixnump} predicate can be used to
+detect such small integers, and @code{bignump} can be used to detect
+large integers.
 
   The read syntax for integers is a sequence of (base ten) digits with an
 optional sign at the beginning and an optional period at the end.  The
@@ -200,11 +209,6 @@ leading @samp{+} or a final @samp{.}.
 @end example
 
 @noindent
-As a special exception, if a sequence of digits specifies an integer
-too large or too small to be a valid integer object, the Lisp reader
-reads it as a floating-point number (@pxref{Floating-Point Type}).
-For instance, if Emacs integers are 30 bits, @code{536870912} is read
-as the floating-point number @code{536870912.0}.
 
   @xref{Numbers}, for more information.
 
@@ -1895,6 +1899,9 @@ with references to further information.
 @item arrayp
 @xref{Array Functions, arrayp}.
 
address@hidden bignump
address@hidden on Numbers, floatp}.
+
 @item bool-vector-p
 @xref{Bool-Vectors, bool-vector-p}.
 
@@ -1928,6 +1935,9 @@ with references to further information.
 @item custom-variable-p
 @xref{Variable Definitions, custom-variable-p}.
 
address@hidden fixnump
address@hidden on Numbers, floatp}.
+
 @item floatp
 @xref{Predicates on Numbers, floatp}.
 
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index 6793ed2..6ccb9e5 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -14320,6 +14320,12 @@ fetch all textual parts, while leaving the rest on the 
server.
 If address@hidden, record all @acronym{IMAP} commands in the
 @samp{"*imap log*"} buffer.
 
address@hidden nnimap-use-namespaces
+If address@hidden, omit the IMAP namespace prefix in nnimap group
+names.  If your IMAP mailboxes are called something like @samp{INBOX}
+and @samp{INBOX.Lists.emacs}, but you'd like the nnimap group names to
+be @samp{INBOX} and @samp{Lists.emacs}, you should enable this option.
+
 @end table
 
 
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index fd188a7..78f55e0 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -3290,7 +3290,9 @@ When including @value{tramp}'s messages in the bug 
report, increase
 the verbosity level to 6 (@pxref{Traces and Profiles, Traces}) in the
 @file{~/.emacs} file before repeating steps to the bug.  Include the
 contents of the @file{*tramp/foo*} and @file{*debug tramp/foo*}
-buffers with the bug report.
+buffers with the bug report.  Both buffers could contain
address@hidden characters which are relevant for analysis, append
+the buffers as attachments to the bug report.
 
 @strong{Note} that a verbosity level greater than 6 is not necessary
 at this stage.  Also note that a verbosity level of 6 or greater, the
@@ -4022,6 +4024,15 @@ export EDITOR=/path/to/emacsclient.sh
 
 
 @item
+How to determine wheter a buffer is remote?
+
+The buffer-local variable @code{default-directory} tells this.  If the
+form @code{(file-remote-p default-directory)} returns address@hidden,
+the buffer is remote.  See the optional arguments of
address@hidden for determining details of the remote connection.
+
+
address@hidden
 How to disable other packages from calling @value{tramp}?
 
 There are packages that call @value{tramp} without the user ever
diff --git a/etc/NEWS b/etc/NEWS
index 631f04a..ae418fc 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -24,6 +24,12 @@ When you add a new item, use the appropriate mark if you are 
sure it applies,
 
 * Installation Changes in Emacs 27.1
 
+** Emacs now uses GMP, the GNU Multiple Precision library.
+By default, if 'configure' does not find a suitable libgmp, it
+arranges for the included mini-gmp library to be built and used.
+The new 'configure' option --without-libgmp uses mini-gmp even if a
+suitable libgmp is available.
+
 ** The new configure option '--with-json' adds support for JSON using
 the Jansson library.  It is on by default; use 'configure
 --with-json=no' to build without Jansson support.  The new JSON
@@ -53,6 +59,18 @@ option --enable-check-lisp-object-type is therefore no 
longer as
 useful and so is no longer enabled by default in developer builds,
 to reduce differences between developer and production builds.
 
+** Ibuffer
+
+---
+*** New toggle 'ibuffer-do-toggle-lock', bound to 'L'.
+
+** Gnus
+
++++
+*** The nnimap backend now has support for IMAP namespaces.
+This feature can be enabled by setting the new 'nnimap-use-namespaces'
+server variable to non-nil.
+
 
 * Startup Changes in Emacs 27.1
 
@@ -189,6 +207,11 @@ from a remote host.
 This triggers to search the program on the remote host as indicated by
 'default-directory'.
 
++++
+** New variable 'auto-save-no-message'.
+When set to t, no message will be shown when auto-saving (default
+value: nil).
+
 
 * Editing Changes in Emacs 27.1
 
@@ -381,6 +404,10 @@ buffer with the article(s) attached.
 *** 'erc-button-google-url' has been renamed 'erc-button-search-url'
 and its value has been changed to Duck Duck Go.
 
+** EUDC
+
+*** XEmacs support has been removed.
+
 ** eww/shr
 
 *** When opening external links in eww/shr (typically with the
@@ -700,6 +727,19 @@ to signal the main thread, e.g., when they encounter an 
error.
 +++
 *** 'thread-join' returns the result of the finished thread now.
 
+---
+** thingatpt.el supports a new "thing" called 'uuid'.
+A symbol 'uuid' can be passed to thing-at-point and it returns the
+UUID at point.
+
+
+** Interactive automatic highlighting
+
++++
+*** 'highlight-regexp' can now highlight subexpressions.
+The now command accepts a prefix numeric argument to choose the
+subexpression.
+
 
 * New Modes and Packages in Emacs 27.1
 
@@ -767,15 +807,6 @@ as new-style, bind the new variable 
'force-new-style-backquotes' to t.
 integer, Emacs now signals an error if the number is too large for the
 implementation to format.
 
-+++
-** The Lisp reader now signals an overflow for plain decimal integers
-that do not end in '.' and are outside Emacs range.  Formerly the Lisp
-reader silently converted them to floating-point numbers, and signaled
-overflow only for integers with a radix that are outside machine range.
-To get the old behavior, set the new, experimental variable
-read-integer-overflow-as-float to t and please email
address@hidden if you need that.
-
 ---
 ** Some functions and variables obsolete since Emacs 22 have been removed:
 archive-mouse-extract, assoc-ignore-case, assoc-ignore-representation,
@@ -824,6 +855,12 @@ is backwards-compatible with versions of Emacs in which 
the old function
 exists.  See the node "Displaying Buffers in Side Windows" in the ELisp
 manual for more details.
 
+** garbage collection no longer treats miscellaneous objects specially;
+they are now allocated like any other pseudovector.  As a result, the
+'garbage-collect' and 'memory-use-count' functions no longer return a
+'misc' component, and the 'misc-objects-consed' variable has been
+removed.
+
 
 * Lisp Changes in Emacs 27.1
 
@@ -833,6 +870,11 @@ Given a proper list as argument, this predicate returns 
its length;
 otherwise, it returns nil.  'format-proper-list-p' is now an obsolete
 alias for the new function.
 
++++
+** Emacs Lisp integers can be of arbitrary precision.  The new
+predicates 'bignump' and 'fixnump' can be used to distinguish between
+the types of integers.
+
 ** define-minor-mode automatically documents the meaning of ARG
 
 +++
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 739e6d5..4fe3a58 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -1117,7 +1117,9 @@ find_tty (const char **tty_type, const char **tty_name, 
int noabort)
        }
     }
 
-  if (strcmp (type, "eterm") == 0)
+  const char *inside_emacs = egetenv ("INSIDE_EMACS");
+  if (inside_emacs && strstr (inside_emacs, ",term:")
+      && strprefix ("eterm", type))
     {
       if (noabort)
        return 0;
diff --git a/lib-src/etags.c b/lib-src/etags.c
index ee50670..102d867 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -85,7 +85,9 @@ char pot_etags_version[] = "@(#) pot revision number is 
17.38.1.4";
 #  define DEBUG true
 #else
 #  define DEBUG  false
-#  define NDEBUG               /* disable assert */
+#  ifndef NDEBUG
+#   define NDEBUG              /* disable assert */
+#  endif
 #endif
 
 #include <config.h>
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in
index 7ad3908..666105b 100644
--- a/lib/gnulib.mk.in
+++ b/lib/gnulib.mk.in
@@ -238,6 +238,8 @@ GL_GENERATE_STDALIGN_H = @GL_GENERATE_STDALIGN_H@
 GL_GENERATE_STDDEF_H = @GL_GENERATE_STDDEF_H@
 GL_GENERATE_STDINT_H = @GL_GENERATE_STDINT_H@
 GMALLOC_OBJ = @GMALLOC_OBJ@
+GMP_LIB = @GMP_LIB@
+GMP_OBJ = @GMP_OBJ@
 GNULIB_ALPHASORT = @GNULIB_ALPHASORT@
 GNULIB_ATOLL = @GNULIB_ATOLL@
 GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
@@ -1720,7 +1722,7 @@ BUILT_SOURCES += $(GETOPT_H) $(GETOPT_CDEFS_H)
 
 # We need the following in order to create <getopt.h> when the system
 # doesn't have one that works with the given compiler.
-getopt.h: getopt.in.h $(top_builddir)/config.status
+getopt.h: getopt.in.h $(top_builddir)/config.status $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''GUARD_PREFIX''@|GL|g' \
diff --git a/lib/regcomp.c b/lib/regcomp.c
index 53eb226..0e4816c 100644
--- a/lib/regcomp.c
+++ b/lib/regcomp.c
@@ -2684,15 +2684,14 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, 
re_dfa_t *dfa,
 
 # ifdef RE_ENABLE_I18N
 /* Convert the byte B to the corresponding wide character.  In a
-   unibyte locale, treat B as itself if it is an encoding error.
-   In a multibyte locale, return WEOF if B is an encoding error.  */
+   unibyte locale, treat B as itself.  In a multibyte locale, return
+   WEOF if B is an encoding error.  */
 static wint_t
 parse_byte (unsigned char b, re_charset_t *mbcset)
 {
-  wint_t wc = __btowc (b);
-  return wc == WEOF && !mbcset ? b : wc;
+  return mbcset == NULL ? b : __btowc (b);
 }
-#endif
+# endif
 
   /* Local function for parse_bracket_exp only used in case of NOT _LIBC.
      Build the range expression which starts from START_ELEM, and ends
@@ -3531,18 +3530,10 @@ build_equiv_class (bitset_t sbcset, const unsigned char 
*name)
            continue;
          /* Compare only if the length matches and the collation rule
             index is the same.  */
-         if (len == weights[idx2 & 0xffffff] && (idx1 >> 24) == (idx2 >> 24))
-           {
-             int cnt = 0;
-
-             while (cnt <= len &&
-                    weights[(idx1 & 0xffffff) + 1 + cnt]
-                    == weights[(idx2 & 0xffffff) + 1 + cnt])
-               ++cnt;
-
-             if (cnt > len)
-               bitset_set (sbcset, ch);
-           }
+         if (len == weights[idx2 & 0xffffff] && (idx1 >> 24) == (idx2 >> 24)
+             && memcmp (weights + (idx1 & 0xffffff) + 1,
+                        weights + (idx2 & 0xffffff) + 1, len) == 0)
+           bitset_set (sbcset, ch);
        }
       /* Check whether the array has enough space.  */
       if (BE (*equiv_class_alloc == mbcset->nequiv_classes, 0))
@@ -3802,9 +3793,9 @@ free_charset (re_charset_t *cset)
 # ifdef _LIBC
   re_free (cset->coll_syms);
   re_free (cset->equiv_classes);
+# endif
   re_free (cset->range_starts);
   re_free (cset->range_ends);
-# endif
   re_free (cset->char_classes);
   re_free (cset);
 }
diff --git a/lib/verify.h b/lib/verify.h
index bc7f99d..3b57dde 100644
--- a/lib/verify.h
+++ b/lib/verify.h
@@ -276,7 +276,8 @@ template <int w>
      when 'assume' silences warnings even with older GCCs.  */
 # define assume(R) ((R) ? (void) 0 : __builtin_trap ())
 #else
-# define assume(R) ((void) (0 && (R)))
+  /* Some tools grok NOTREACHED, e.g., Oracle Studio 12.6.  */
+# define assume(R) ((R) ? (void) 0 : /*NOTREACHED*/ (void) 0)
 #endif
 
 /* @assert.h omit end@  */
diff --git a/lisp/Makefile.in b/lisp/Makefile.in
index ccc5323..c447598 100644
--- a/lisp/Makefile.in
+++ b/lisp/Makefile.in
@@ -341,7 +341,7 @@ compile-clean:
          if test -f "$$el" || test ! -f "$${el}c"; then :; else \
            echo rm "$${el}c"; \
            rm "$${el}c"; \
-         fi \
+         fi; \
        done
 
 .PHONY: gen-lisp leim semantic
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el
index c1c2921..08da75d 100644
--- a/lisp/calendar/todo-mode.el
+++ b/lisp/calendar/todo-mode.el
@@ -1242,9 +1242,10 @@ this command should be used with caution."
   (widen)
   (todo-edit-mode)
   (remove-overlays)
-  (display-warning 'todo (format "\
+  (display-warning
+   'todo (format "\
 
-Type %s to return to Todo mode.
+Type %s to return to Todo%s mode.
 
 This also runs a file format check and signals an error if
 the format has become invalid.  However, this check cannot
@@ -1254,7 +1255,12 @@ You can repair this inconsistency by invoking the command
 `todo-repair-categories-sexp', but this will revert any
 renumbering of the categories you have made, so you will
 have to renumber them again (see `(todo-mode) Reordering
-Categories')." (substitute-command-keys "\\[todo-edit-quit]"))))
+Categories').
+"
+                 (substitute-command-keys "\\[todo-edit-quit]")
+                 (if (equal "toda" (file-name-extension
+                                    (buffer-file-name)))
+                     " Archive" ""))))
 
 (defun todo-add-category (&optional file cat)
   "Add a new category to a todo file.
@@ -1830,7 +1836,6 @@ consist of the last todo items and the first done items."
 (defvar todo-date-from-calendar nil
   "Helper variable for setting item date from the Emacs Calendar.")
 
-(defvar todo-insert-item--keys-so-far)
 (defvar todo-insert-item--parameters)
 
 (defun todo-insert-item (&optional arg)
@@ -1852,8 +1857,7 @@ already been entered and which remain available.  See
 `(todo-mode) Inserting New Items' for details of the parameters,
 their associated keys and their effects."
   (interactive "P")
-  (setq todo-insert-item--keys-so-far "i")
-  (todo-insert-item--next-param nil (list arg) todo-insert-item--parameters))
+  (todo-insert-item--next-param (list arg) todo-insert-item--parameters nil 
"i"))
 
 (defun todo-insert-item--basic (&optional arg diary-type date-type time where)
   "Function implementing the core of `todo-insert-item'."
@@ -2101,17 +2105,14 @@ the item at point."
               (let (todo-show-with-done) (todo-category-select)))))
       (if ov (delete-overlay ov)))))
 
-(defvar todo-edit-item--param-key-alist)
-(defvar todo-edit-done-item--param-key-alist)
-
 (defun todo-edit-item (&optional arg)
   "Choose an editing operation for the current item and carry it out."
   (interactive "P")
   (let ((marked (assoc (todo-current-category) todo-categories-with-marks)))
     (cond ((and (todo-done-item-p) (not marked))
-          (todo-edit-item--next-key todo-edit-done-item--param-key-alist))
+          (todo-edit-item--next-key 'done arg))
          ((or marked (todo-item-string))
-          (todo-edit-item--next-key todo-edit-item--param-key-alist arg)))))
+          (todo-edit-item--next-key 'todo arg)))))
 
 (defun todo-edit-item--text (&optional arg)
   "Function providing the text editing facilities of `todo-edit-item'."
@@ -2245,7 +2246,9 @@ made in the number or names of categories."
       ;; (todo-repair-categories-sexp)
       ;; Compare (todo-make-categories-list t) with sexp and if
       ;; different ask (todo-update-categories-sexp) ?
-      (todo-mode)
+      (if (equal (file-name-extension (buffer-file-name)) "toda")
+          (todo-archive-mode)
+        (todo-mode))
       (let* ((cat-beg (concat "^" (regexp-quote todo-category-beg)
                              "\\(.*\\)$"))
             (curline (buffer-substring-no-properties
@@ -5099,7 +5102,7 @@ again."
 
 (defun todo-check-format ()
   "Signal an error if the current todo file is ill-formatted.
-Otherwise return t.  Display a message if the file is well-formed
+Otherwise return t.  Display a warning if the file is well-formed
 but the categories sexp differs from the current value of
 `todo-categories'."
   (save-excursion
@@ -5133,12 +5136,14 @@ but the categories sexp differs from the current value 
of
            (forward-line)))
        ;; Warn user if categories sexp has changed.
        (unless (string= ssexp cats)
-         (message (concat "The sexp at the beginning of the file differs "
-                          "from the value of `todo-categories'.\n"
-                          "If the sexp is wrong, you can fix it with "
-                          "M-x todo-repair-categories-sexp,\n"
-                          "but note this reverts any changes you have "
-                          "made in the order of the categories."))))))
+          (display-warning 'todo "\
+
+The sexp at the beginning of the file differs from the value of
+`todo-categories'. If the sexp is wrong, you can fix it with
+M-x todo-repair-categories-sexp, but note this reverts any
+changes you have made in the order of the categories.
+"
+                           )))))
   t)
 
 (defun todo-item-start ()
@@ -5523,12 +5528,14 @@ of each other."
 ;;; Generating and applying item insertion and editing key sequences
 ;; 
-----------------------------------------------------------------------------
 
-;; Thanks to Stefan Monnier for suggesting dynamically generating item
-;; insertion commands and their key bindings, and offering an elegant
-;; implementation, which, however, relies on lexical scoping and so
-;; cannot be used here until the Calendar code used by todo-mode.el is
-;; converted to lexical binding.  Hence, the following implementation
-;; uses dynamic binding.
+;; Thanks to Stefan Monnier for (i) not only suggesting dynamically
+;; generating item insertion commands and their key bindings but also
+;; offering an elegant implementation which, however, since it used
+;; lexical binding, was at the time incompatible with the Calendar and
+;; Diary code in todo-mode.el; and (ii) later making that code
+;; compatible with lexical binding, so that his implementation, of
+;; which the following is a somewhat expanded version, could be
+;; realized in todo-mode.el.
 
 (defconst todo-insert-item--parameters
   '((default copy) (diary nonmarking) (calendar date dayname) time (here 
region))
@@ -5536,91 +5543,33 @@ of each other."
 Passed by `todo-insert-item' to `todo-insert-item--next-param' to
 dynamically create item insertion commands.")
 
-(defconst todo-insert-item--param-key-alist
-  '((default    . "i")
-    (copy       . "p")
-    (diary      . "y")
-    (nonmarking . "k")
-    (calendar   . "c")
-    (date       . "d")
-    (dayname    . "n")
-    (time       . "t")
-    (here       . "h")
-    (region     . "r"))
-  "List pairing item insertion parameters with their completion keys.")
-
-(defsubst todo-insert-item--keyof (param)
-  "Return key paired with item insertion PARAM."
-  (cdr (assoc param todo-insert-item--param-key-alist)))
-
-(defun todo-insert-item--argsleft (key list)
-  "Return sublist of LIST whose first member corresponds to KEY."
-  (let (l sym)
-    (mapc (lambda (m)
-           (when (consp m)
-             (catch 'found1
-               (dolist (s m)
-                 (when (equal key (todo-insert-item--keyof s))
-                   (throw 'found1 (setq sym s))))))
-           (if sym
-               (progn
-                 (push sym l)
-                 (setq sym nil))
-             (push m l)))
-         list)
-    (setq list (reverse l)))
-  (memq (catch 'found2
-         (dolist (e todo-insert-item--param-key-alist)
-           (when (equal key (cdr e))
-             (throw 'found2 (car e)))))
-       list))
-
-(defsubst todo-insert-item--this-key () (char-to-string last-command-event))
-
-(defvar todo-insert-item--keys-so-far ""
-  "String of item insertion keys so far entered for this command.")
-
-(defvar todo-insert-item--args nil)
-(defvar todo-insert-item--argleft nil)
-(defvar todo-insert-item--argsleft nil)
-(defvar todo-insert-item--newargsleft nil)
-
-(defun todo-insert-item--apply-args ()
-  "Build list of arguments for item insertion and apply them.
-The list consists of item insertion parameters that can be passed
-as insertion command arguments in fixed positions.  If a position
-in the list is not occupied by the corresponding parameter, it is
-occupied by nil."
-  (let* ((arg (list (car todo-insert-item--args)))
-        (args (nconc (cdr todo-insert-item--args)
-                     (list (car (todo-insert-item--argsleft
-                                 (todo-insert-item--this-key)
-                                 todo-insert-item--argsleft)))))
-        (arglist (if (= 4 (length args))
-                     args
-                   (let ((v (make-vector 4 nil)) elt)
-                     (while args
-                       (setq elt (pop args))
-                       (cond ((memq elt '(diary nonmarking))
-                              (aset v 0 elt))
-                             ((memq elt '(calendar date dayname))
-                              (aset v 1 elt))
-                             ((eq elt 'time)
-                              (aset v 2 elt))
-                             ((memq elt '(copy here region))
-                              (aset v 3 elt))))
-                     (append v nil)))))
-    (apply #'todo-insert-item--basic (nconc arg arglist))))
-
-(defun todo-insert-item--next-param (last args argsleft)
-  "Build item insertion command from LAST, ARGS and ARGSLEFT and call it.
-Dynamically generate key bindings, prompting with the keys
-already entered and those still available."
-  (cl-assert argsleft)
+(defun todo-insert-item--next-param (args params last keys-so-far)
+  "Generate and invoke an item insertion command.
+Dynamically generate the command, its arguments ARGS and its key
+binding by recursing through the list of parameters PARAMS,
+taking the LAST from a sublist and prompting with KEYS-SO-FAR
+keys already entered and those still available."
+  (cl-assert params)
   (let* ((map (make-sparse-keymap))
+         (param-key-alist '((default    . "i")
+                            (copy       . "p")
+                            (diary      . "y")
+                            (nonmarking . "k")
+                            (calendar   . "c")
+                            (date       . "d")
+                            (dayname    . "n")
+                            (time       . "t")
+                            (here       . "h")
+                            (region     . "r")))
+         ;; Return key paired with given item insertion parameter.
+         (key-of (lambda (param) (cdr (assoc param param-key-alist))))
+         ;; The key just typed.
+         (this-key (lambda () (char-to-string last-command-event)))
          (prompt nil)
-         (addprompt
-         (lambda (k name)
+         ;; Add successively entered keys to the prompt and show what
+         ;; possibilities remain.
+         (add-to-prompt
+         (lambda (key name)
            (setq prompt
                  (concat prompt
                          (format
@@ -5630,80 +5579,119 @@ already entered and those still available."
                            "%s=>%s"
                            (when (memq name '(copy nonmarking dayname region))
                              " }"))
-                          (propertize k 'face 'todo-key-prompt)
-                          name))))))
-    (setq todo-insert-item--args args)
-    (setq todo-insert-item--argsleft argsleft)
+                          (propertize key 'face 'todo-key-prompt)
+                          name)))))
+         ;; Return the sublist of the given list of parameters whose
+         ;; first member is paired with the given key.
+         (get-params
+          (lambda (key lst)
+            (setq lst (if (consp lst) lst (list lst)))
+            (let (l sym)
+              (mapc (lambda (m)
+                      (when (consp m)
+                        (catch 'found1
+                          (dolist (s m)
+                            (when (equal key (funcall key-of s))
+                              (throw 'found1 (setq sym s))))))
+                      (if sym
+                          (progn
+                            (push sym l)
+                            (setq sym nil))
+                        (push m l)))
+                    lst)
+              (setq lst (reverse l)))
+            (memq (catch 'found2
+                    (dolist (e param-key-alist)
+                      (when (equal key (cdr e))
+                        (throw 'found2 (car e)))))
+                  lst)))
+         ;; Build list of arguments for item insertion and then
+         ;; execute the basic insertion function. The list consists of
+         ;; item insertion parameters that can be passed as insertion
+         ;; command arguments in fixed positions.  If a position in
+         ;; the list is not occupied by the corresponding parameter,
+         ;; it is occupied by nil.
+         (gen-and-exec
+          (lambda ()
+            (let* ((arg (list (car args))) ; Possible prefix argument.
+                  (rest (nconc (cdr args)
+                               (list (car (funcall get-params
+                                                    (funcall this-key)
+                                                    params)))))
+                  (parlist (if (= 4 (length rest))
+                                rest
+                              (let ((v (make-vector 4 nil)) elt)
+                                (while rest
+                                  (setq elt (pop rest))
+                                  (cond ((memq elt '(diary nonmarking))
+                                         (aset v 0 elt))
+                                        ((memq elt '(calendar date dayname))
+                                         (aset v 1 elt))
+                                        ((eq elt 'time)
+                                         (aset v 2 elt))
+                                        ((memq elt '(copy here region))
+                                         (aset v 3 elt))))
+                                (append v nil)))))
+              (apply #'todo-insert-item--basic (nconc arg parlist)))))
+         ;; Operate on a copy of the parameter list so the original is
+         ;; not consumed, thus available for the next key typed.
+         (params0 params))
     (when last
       (if (memq last '(default copy))
          (progn
-           (setq todo-insert-item--argsleft nil)
-           (todo-insert-item--apply-args))
-       (let ((k (todo-insert-item--keyof last)))
-         (funcall addprompt k (make-symbol (concat (symbol-name last) ":GO!")))
-         (define-key map (todo-insert-item--keyof last)
+           (setq params0 nil)
+            (funcall gen-and-exec))
+        (let ((key (funcall key-of last)))
+         (funcall add-to-prompt key (make-symbol
+                                      (concat (symbol-name last) ":GO!")))
+         (define-key map (funcall key-of last)
            (lambda () (interactive)
-             (todo-insert-item--apply-args))))))
-    (while todo-insert-item--argsleft
-      (let ((x (car todo-insert-item--argsleft)))
-       (setq todo-insert-item--newargsleft (cdr todo-insert-item--argsleft))
-        (dolist (argleft (if (consp x) x (list x)))
-         (let ((k (todo-insert-item--keyof argleft)))
-           (funcall addprompt k argleft)
-           (define-key map k
-             (if (null todo-insert-item--newargsleft)
-                 (lambda () (interactive)
-                   (todo-insert-item--apply-args))
-               (lambda () (interactive)
-                 (setq todo-insert-item--keys-so-far
-                       (concat todo-insert-item--keys-so-far " "
-                               (todo-insert-item--this-key)))
-                 (todo-insert-item--next-param
-                  (car (todo-insert-item--argsleft
-                        (todo-insert-item--this-key)
-                        todo-insert-item--argsleft))
-                  (nconc todo-insert-item--args
-                         (list (car (todo-insert-item--argsleft
-                                     (todo-insert-item--this-key)
-                                     todo-insert-item--argsleft))))
-                  (cdr (todo-insert-item--argsleft
-                        (todo-insert-item--this-key)
-                        todo-insert-item--argsleft)))))))))
-      (setq todo-insert-item--argsleft todo-insert-item--newargsleft))
-    (when prompt (message "Press a key (so far `%s'): %s"
-                         todo-insert-item--keys-so-far prompt))
+             (funcall gen-and-exec))))))
+    (while params0
+      (let* ((x (car params0))
+             (restparams (cdr params0)))
+        (dolist (param (if (consp x) x (list x)))
+          (let ((key (funcall key-of param)))
+            (funcall add-to-prompt key param)
+            (define-key map key
+              (if (null restparams)
+                  (lambda () (interactive)
+                    (funcall gen-and-exec))
+                (lambda () (interactive)
+                  (setq keys-so-far (concat keys-so-far " " (funcall 
this-key)))
+                  (todo-insert-item--next-param
+                   (nconc args (list (car (funcall get-params
+                                                   (funcall this-key) param))))
+                   (cdr (funcall get-params (funcall this-key) params))
+                   (car (funcall get-params (funcall this-key) param))
+                   keys-so-far))))))
+        (setq params0 restparams)))
     (set-transient-map map)
-    (setq todo-insert-item--argsleft argsleft)))
-
-(defconst todo-edit-item--param-key-alist
-  '((edit       . "e")
-    (header     . "h")
-    (multiline  . "m")
-    (diary      . "y")
-    (nonmarking . "k")
-    (date       . "d")
-    (time       . "t"))
-  "Alist of item editing parameters and their keys.")
-
-(defconst todo-edit-item--date-param-key-alist
-  '((full       . "f")
-    (calendar   . "c")
-    (today      . "a")
-    (dayname    . "n")
-    (year       . "y")
-    (month      . "m")
-    (daynum     . "d"))
-  "Alist of item date editing parameters and their keys.")
-
-(defconst todo-edit-done-item--param-key-alist
-  '((add/edit   . "c")
-    (delete     . "d"))
-  "Alist of done item comment editing parameters and their keys.")
-
-(defvar        todo-edit-item--prompt "Press a key (so far `e'): ")
-
-(defun todo-edit-item--next-key (params &optional arg)
-  (let* ((p->k (mapconcat (lambda (elt)
+    (when prompt (message "Press a key (so far `%s'): %s" keys-so-far prompt))
+    (setq params0 params)))
+
+(defun todo-edit-item--next-key (type &optional arg)
+  (let* ((todo-param-key-alist '((edit       . "e")
+                                 (header     . "h")
+                                 (multiline  . "m")
+                                 (diary      . "y")
+                                 (nonmarking . "k")
+                                 (date       . "d")
+                                 (time       . "t")))
+         (done-param-key-alist '((add/edit   . "c")
+                                 (delete     . "d")))
+         (date-param-key-alist '((full       . "f")
+                                 (calendar   . "c")
+                                 (today      . "a")
+                                 (dayname    . "n")
+                                 (year       . "y")
+                                 (month      . "m")
+                                 (daynum     . "d")))
+         (params (pcase type
+                   ('todo todo-param-key-alist)
+                   ('done done-param-key-alist)
+                   ('date date-param-key-alist)))
+         (p->k (mapconcat (lambda (elt)
                            (format "%s=>%s"
                                    (propertize (cdr elt) 'face
                                                'todo-key-prompt)
@@ -5712,31 +5700,32 @@ already entered and those still available."
                                                        '(add/edit delete))
                                              " comment"))))
                          params " "))
-        (key-prompt (substitute-command-keys todo-edit-item--prompt))
+        (key-prompt (substitute-command-keys
+                      (concat "Press a key (so far `e"
+                              (if (eq type 'date) " d" "")
+                              "'): ")))
         (this-key (let ((key (read-key (concat key-prompt p->k))))
                     (and (characterp key) (char-to-string key))))
         (this-param (car (rassoc this-key params))))
     (pcase this-param
-      (`edit (todo-edit-item--text))
-      (`header (todo-edit-item--text 'include-header))
-      (`multiline (todo-edit-item--text 'multiline))
-      (`add/edit (todo-edit-item--text 'comment-edit))
-      (`delete (todo-edit-item--text 'comment-delete))
-      (`diary (todo-edit-item--diary-inclusion))
-      (`nonmarking (todo-edit-item--diary-inclusion 'nonmarking))
-      (`date (let ((todo-edit-item--prompt "Press a key (so far `e d'): "))
-              (todo-edit-item--next-key
-               todo-edit-item--date-param-key-alist arg)))
-      (`full (progn (todo-edit-item--header 'date)
+      ('edit (todo-edit-item--text))
+      ('header (todo-edit-item--text 'include-header))
+      ('multiline (todo-edit-item--text 'multiline))
+      ('add/edit (todo-edit-item--text 'comment-edit))
+      ('delete (todo-edit-item--text 'comment-delete))
+      ('diary (todo-edit-item--diary-inclusion))
+      ('nonmarking (todo-edit-item--diary-inclusion 'nonmarking))
+      ('date (todo-edit-item--next-key 'date arg))
+      ('full (progn (todo-edit-item--header 'date)
                    (when todo-always-add-time-string
                      (todo-edit-item--header 'time))))
-      (`calendar (todo-edit-item--header 'calendar))
-      (`today (todo-edit-item--header 'today))
-      (`dayname (todo-edit-item--header 'dayname))
-      (`year (todo-edit-item--header 'year arg))
-      (`month (todo-edit-item--header 'month arg))
-      (`daynum (todo-edit-item--header 'day arg))
-      (`time (todo-edit-item--header 'time)))))
+      ('calendar (todo-edit-item--header 'calendar))
+      ('today (todo-edit-item--header 'today))
+      ('dayname (todo-edit-item--header 'dayname))
+      ('year (todo-edit-item--header 'year arg))
+      ('month (todo-edit-item--header 'month arg))
+      ('daynum (todo-edit-item--header 'day arg))
+      ('time (todo-edit-item--header 'time)))))
 
 ;; 
-----------------------------------------------------------------------------
 ;;; Todo minibuffer utilities
@@ -6732,32 +6721,19 @@ Added to `window-configuration-change-hook' in Todo 
mode."
   (setq-local todo-current-todo-file (file-truename (buffer-file-name)))
   (setq-local todo-show-done-only t))
 
-(defun todo-mode-external-set ()
-  "Set `todo-categories' externally to `todo-current-todo-file'."
-  (setq-local todo-current-todo-file todo-global-current-todo-file)
-  (let ((cats (with-current-buffer
-                 ;; Can't use find-buffer-visiting when
-                 ;; `todo-show-categories-table' is called on first
-                 ;; invocation of `todo-show', since there is then
-                 ;; no buffer visiting the current file.
-                 (find-file-noselect todo-current-todo-file 'nowarn)
-               (or todo-categories
-                   ;; In Todo Edit mode todo-categories is now nil
-                   ;; since it uses same buffer as Todo mode but
-                   ;; doesn't have the latter's local variables.
-                   (save-excursion
-                     (goto-char (point-min))
-                     (read (buffer-substring-no-properties
-                            (line-beginning-position)
-                            (line-end-position))))))))
-    (setq-local todo-categories cats)))
-
 (define-derived-mode todo-edit-mode text-mode "Todo-Ed"
   "Major mode for editing multiline todo items.
 
 \\{todo-edit-mode-map}"
   (todo-modes-set-1)
-  (todo-mode-external-set)
+  (if (> (buffer-size) (- (point-max) (point-min)))
+      ;; Editing one item in an indirect buffer, so buffer-file-name is nil.
+      (setq-local todo-current-todo-file todo-global-current-todo-file)
+    ;; When editing archive file, make sure it is current todo file.
+    (setq-local todo-current-todo-file (file-truename (buffer-file-name)))
+    ;; Need this when editing the whole file to return to the category
+    ;; editing was invoked from.
+    (setq-local todo-categories (todo-set-categories)))
   (setq buffer-read-only nil))
 
 (put 'todo-categories-mode 'mode-class 'special)
@@ -6766,7 +6742,15 @@ Added to `window-configuration-change-hook' in Todo 
mode."
   "Major mode for displaying and editing todo categories.
 
 \\{todo-categories-mode-map}"
-  (todo-mode-external-set))
+  (setq-local todo-current-todo-file todo-global-current-todo-file)
+  (setq-local todo-categories
+             ;; Can't use find-buffer-visiting when
+             ;; `todo-show-categories-table' is called on first
+             ;; invocation of `todo-show', since there is then no
+             ;; buffer visiting the current file.
+              (with-current-buffer (find-file-noselect
+                                    todo-current-todo-file 'nowarn)
+                todo-categories)))
 
 (put 'todo-filtered-items-mode 'mode-class 'special)
 
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index f31d1df..1a5b3ca 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -345,6 +345,7 @@ Leaving \"Default\" unchecked is equivalent with specifying 
a default of
             ;; keyboard.c
             (meta-prefix-char keyboard character)
             (auto-save-interval auto-save integer)
+             (auto-save-no-message auto-save boolean "27.1")
             (auto-save-timeout auto-save (choice (const :tag "off" nil)
                                                  (integer :format "%v")))
             (echo-keystrokes minibuffer number)
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 5c0b5e3..1920503 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -1195,14 +1195,14 @@
         window-width zerop))
       (side-effect-and-error-free-fns
        '(arrayp atom
-        bobp bolp bool-vector-p
+        bignump bobp bolp bool-vector-p
         buffer-end buffer-list buffer-size buffer-string bufferp
         car-safe case-table-p cdr-safe char-or-string-p characterp
         charsetp commandp cons consp
         current-buffer current-global-map current-indentation
         current-local-map current-minor-mode-maps current-time
         eobp eolp eq equal eventp
-        floatp following-char framep
+        fixnump floatp following-char framep
         get-largest-window get-lru-window
         hash-table-p
         identity ignore integerp integer-or-marker-p interactive-p
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 3623352..cacc8b0 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1754,6 +1754,15 @@ if it is still empty."
       (indirect indirect-deps)
       (t        (delete-dups (append direct-deps indirect-deps))))))
 
+(defun package--user-installed-p (package)
+  "Return non-nil if PACKAGE is a user-installed package.
+PACKAGE is the package name, a symbol.  Check whether the package
+was installed into `package-user-dir' where we assume to have
+control over."
+  (let* ((pkg-desc (cadr (assq package package-alist)))
+         (dir (package-desc-dir pkg-desc)))
+    (file-in-directory-p dir package-user-dir)))
+
 (defun package--removable-packages ()
   "Return a list of names of packages no longer needed.
 These are packages which are neither contained in
@@ -1763,7 +1772,9 @@ These are packages which are neither contained in
                          ;; `p' and its dependencies are needed.
                          append (cons p (package--get-deps p)))))
     (cl-loop for p in (mapcar #'car package-alist)
-             unless (memq p needed)
+             unless (or (memq p needed)
+                        ;; Do not auto-remove external packages.
+                        (not (package--user-installed-p p)))
              collect p)))
 
 (defun package--used-elsewhere-p (pkg-desc &optional pkg-list all)
diff --git a/lisp/files.el b/lisp/files.el
index 4054934..d5dab88 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1895,7 +1895,7 @@ killed."
           ;; softly-dedicated.
          (let ((newbuf
                  (find-file-noselect filename nil nil wildcards async)))
-            (switch-to-buffer newbuf)))
+            (switch-to-buffer (if (consp newbuf) (car newbuf) newbuf))))
       (when (eq obuf (current-buffer))
        ;; This executes if find-file gets an error
        ;; and does not really find anything.
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index 3b39731..12892c5 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -55,6 +55,13 @@
 If nnimap-stream is `ssl', this will default to `imaps'.  If not,
 it will default to `imap'.")
 
+(defvoo nnimap-use-namespaces nil
+  "Whether to use IMAP namespaces.
+If in Gnus your folder names in all start with (e.g.) `INBOX',
+you probably want to set this to t.  The effects of this are
+purely cosmetic, but changing this variable will affect the
+names of your nnimap groups. ")
+
 (defvoo nnimap-stream 'undecided
   "How nnimap talks to the IMAP server.
 The value should be either `undecided', `ssl' or `tls',
@@ -110,6 +117,8 @@ some servers.")
 
 (defvoo nnimap-current-infos nil)
 
+(defvoo nnimap-namespace nil)
+
 (defun nnimap-decode-gnus-group (group)
   (decode-coding-string group 'utf-8))
 
@@ -166,6 +175,19 @@ textual parts.")
 
 (defvar nnimap-inhibit-logging nil)
 
+(defun nnimap-group-to-imap (group)
+  "Convert Gnus group name to IMAP mailbox name."
+  (let* ((inbox (if nnimap-namespace
+                    (substring nnimap-namespace 0 -1) nil)))
+    (utf7-encode
+     (cond ((or (not inbox)
+                (string-equal group inbox))
+            group)
+           ((string-prefix-p "#" group)
+            (substring group 1))
+           (t
+            (concat nnimap-namespace group))) t)))
+
 (defun nnimap-buffer ()
   (nnimap-find-process-buffer nntp-server-buffer))
 
@@ -442,7 +464,8 @@ textual parts.")
             (props (cdr stream-list))
             (greeting (plist-get props :greeting))
             (capabilities (plist-get props :capabilities))
-            (stream-type (plist-get props :type)))
+            (stream-type (plist-get props :type))
+             (server (nnoo-current-server 'nnimap)))
        (when (and stream (not (memq (process-status stream) '(open run))))
          (setq stream nil))
 
@@ -475,9 +498,7 @@ textual parts.")
                                ;; the virtual server name and the address
                                (nnimap-credentials
                                (gnus-delete-duplicates
-                                (list
-                                  (nnoo-current-server 'nnimap)
-                                 nnimap-address))
+                                (list server nnimap-address))
                                 ports
                                 nnimap-user))))
                  (setq nnimap-object nil)
@@ -496,8 +517,17 @@ textual parts.")
                      (dolist (response (cddr (nnimap-command "CAPABILITY")))
                        (when (string= "CAPABILITY" (upcase (car response)))
                          (setf (nnimap-capabilities nnimap-object)
-                               (mapcar #'upcase (cdr response))))))
-                 ;; If the login failed, then forget the credentials
+                               (mapcar #'upcase (cdr response)))))
+                      (when (and nnimap-use-namespaces
+                                 (nnimap-capability "NAMESPACE"))
+                        (erase-buffer)
+                        (nnimap-wait-for-response (nnimap-send-command 
"NAMESPACE"))
+                        (let ((response (nnimap-last-response-string)))
+                          (when (string-match
+                                 
"^\\*\\W+NAMESPACE\\W+((\"\\([^\"\n]+\\)\"\\W+\"\\(.\\)\"))\\W+"
+                                 response)
+                            (setq nnimap-namespace (match-string 1 
response))))))
+                  ;; If the login failed, then forget the credentials
                  ;; that are now possibly cached.
                  (dolist (host (list (nnoo-current-server 'nnimap)
                                      nnimap-address))
@@ -837,7 +867,7 @@ textual parts.")
       (with-current-buffer (nnimap-buffer)
        (erase-buffer)
        (let ((group-sequence
-              (nnimap-send-command "SELECT %S" (utf7-encode group t)))
+              (nnimap-send-command "SELECT %S" (nnimap-group-to-imap group)))
              (flag-sequence
               (nnimap-send-command "UID FETCH 1:* FLAGS")))
          (setf (nnimap-group nnimap-object) group)
@@ -870,13 +900,13 @@ textual parts.")
   (setq group (nnimap-decode-gnus-group group))
   (when (nnimap-change-group nil server)
     (with-current-buffer (nnimap-buffer)
-      (car (nnimap-command "CREATE %S" (utf7-encode group t))))))
+      (car (nnimap-command "CREATE %S" (nnimap-group-to-imap group))))))
 
 (deffoo nnimap-request-delete-group (group &optional _force server)
   (setq group (nnimap-decode-gnus-group group))
   (when (nnimap-change-group nil server)
     (with-current-buffer (nnimap-buffer)
-      (car (nnimap-command "DELETE %S" (utf7-encode group t))))))
+      (car (nnimap-command "DELETE %S" (nnimap-group-to-imap group))))))
 
 (deffoo nnimap-request-rename-group (group new-name &optional server)
   (setq group (nnimap-decode-gnus-group group))
@@ -884,7 +914,7 @@ textual parts.")
     (with-current-buffer (nnimap-buffer)
       (nnimap-unselect-group)
       (car (nnimap-command "RENAME %S %S"
-                          (utf7-encode group t) (utf7-encode new-name t))))))
+                          (nnimap-group-to-imap group) (nnimap-group-to-imap 
new-name))))))
 
 (defun nnimap-unselect-group ()
   ;; Make sure we don't have this group open read/write by asking
@@ -944,7 +974,7 @@ textual parts.")
                                "UID COPY %d %S"))
                     (result (nnimap-command
                              command article
-                             (utf7-encode internal-move-group t))))
+                              (nnimap-group-to-imap internal-move-group))))
                 (when (and (car result) (not can-move))
                   (nnimap-delete-article article))
                 (cons internal-move-group
@@ -1011,7 +1041,7 @@ textual parts.")
                     "UID MOVE %s %S"
                   "UID COPY %s %S")
                 (nnimap-article-ranges (gnus-compress-sequence articles))
-                (utf7-encode (gnus-group-real-name nnmail-expiry-target) t))
+                (nnimap-group-to-imap (gnus-group-real-name 
nnmail-expiry-target)))
                (set (if can-move 'deleted-articles 'articles-to-delete) 
articles))))
       t)
      (t
@@ -1136,7 +1166,7 @@ If LIMIT, first try to limit the search to the N last 
articles."
                      (unsubscribe "UNSUBSCRIBE")))))
       (when command
        (with-current-buffer (nnimap-buffer)
-         (nnimap-command "%s %S" (cadr command) (utf7-encode group t)))))))
+         (nnimap-command "%s %S" (cadr command) (nnimap-group-to-imap 
group)))))))
 
 (deffoo nnimap-request-set-mark (group actions &optional server)
   (setq group (nnimap-decode-gnus-group group))
@@ -1191,7 +1221,7 @@ If LIMIT, first try to limit the search to the N last 
articles."
            (nnimap-unselect-group))
          (erase-buffer)
          (setq sequence (nnimap-send-command
-                         "APPEND %S {%d}" (utf7-encode group t)
+                         "APPEND %S {%d}" (nnimap-group-to-imap group)
                          (length message)))
          (unless nnimap-streaming
            (nnimap-wait-for-connection "^[+]"))
@@ -1271,8 +1301,12 @@ If LIMIT, first try to limit the search to the N last 
articles."
 
 (defun nnimap-get-groups ()
   (erase-buffer)
-  (let ((sequence (nnimap-send-command "LIST \"\" \"*\""))
-       groups)
+  (let* ((sequence (nnimap-send-command "LIST \"\" \"*\""))
+         (prefix nnimap-namespace)
+         (prefix-len (if prefix (length prefix) nil))
+         (inbox (if prefix
+                    (substring prefix 0 -1) nil))
+         groups)
     (nnimap-wait-for-response sequence)
     (subst-char-in-region (point-min) (point-max)
                          ?\\ ?% t)
@@ -1289,11 +1323,16 @@ If LIMIT, first try to limit the search to the N last 
articles."
                           (skip-chars-backward " \r\"")
                           (point)))))
        (unless (member '%NoSelect flags)
-         (push (utf7-decode (if (stringp group)
-                                group
-                              (format "%s" group))
-                             t)
-               groups))))
+          (let* ((group (utf7-decode (if (stringp group) group
+                                       (format "%s" group)) t))
+                 (group (cond ((or (not prefix)
+                                   (equal inbox group))
+                               group)
+                              ((string-prefix-p prefix group)
+                               (substring group prefix-len))
+                              (t
+                               (concat "#" group)))))
+            (push group groups)))))
     (nreverse groups)))
 
 (defun nnimap-get-responses (sequences)
@@ -1319,7 +1358,7 @@ If LIMIT, first try to limit the search to the N last 
articles."
            (dolist (group groups)
              (setf (nnimap-examined nnimap-object) group)
              (push (list (nnimap-send-command "EXAMINE %S"
-                                              (utf7-encode group t))
+                                              (nnimap-group-to-imap group))
                          group)
                    sequences))
            (nnimap-wait-for-response (caar sequences))
@@ -1391,7 +1430,7 @@ If LIMIT, first try to limit the search to the N last 
articles."
                   unexist)
              (push
               (list (nnimap-send-command "EXAMINE %S (%s (%s %s))"
-                                         (utf7-encode group t)
+                                         (nnimap-group-to-imap group)
                                          (nnimap-quirk "QRESYNC")
                                          uidvalidity modseq)
                     'qresync
@@ -1413,7 +1452,7 @@ If LIMIT, first try to limit the search to the N last 
articles."
                (cl-incf (nnimap-initial-resync nnimap-object))
                (setq start 1))
              (push (list (nnimap-send-command "%s %S" command
-                                              (utf7-encode group t))
+                                              (nnimap-group-to-imap group))
                          (nnimap-send-command "UID FETCH %d:* FLAGS" start)
                          start group command)
                    sequences))))
@@ -1847,7 +1886,7 @@ Return the server's response to the SELECT or EXAMINE 
command."
                                       (if read-only
                                           "EXAMINE"
                                         "SELECT")
-                                      (utf7-encode group t))))
+                                      (nnimap-group-to-imap group))))
           (when (car result)
             (setf (nnimap-group nnimap-object) group
                   (nnimap-select-result nnimap-object) result)
@@ -2105,7 +2144,7 @@ Return the server's response to the SELECT or EXAMINE 
command."
            (dolist (spec specs)
              (when (and (not (member (car spec) groups))
                         (not (eq (car spec) 'junk)))
-               (nnimap-command "CREATE %S" (utf7-encode (car spec) t))))
+               (nnimap-command "CREATE %S" (nnimap-group-to-imap (car spec)))))
            ;; Then copy over all the messages.
            (erase-buffer)
            (dolist (spec specs)
@@ -2121,7 +2160,7 @@ Return the server's response to the SELECT or EXAMINE 
command."
                                     "UID MOVE %s %S"
                                   "UID COPY %s %S")
                                 (nnimap-article-ranges ranges)
-                                (utf7-encode group t))
+                               (nnimap-group-to-imap group))
                                ranges)
                          sequences)))))
            ;; Wait for the last COPY response...
diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el
index 13ebffb..08b5811 100644
--- a/lisp/hi-lock.el
+++ b/lisp/hi-lock.el
@@ -429,10 +429,12 @@ highlighting will not update as you type."
 ;;;###autoload
 (defalias 'highlight-regexp 'hi-lock-face-buffer)
 ;;;###autoload
-(defun hi-lock-face-buffer (regexp &optional face)
+(defun hi-lock-face-buffer (regexp &optional face subexp)
   "Set face of each match of REGEXP to FACE.
 Interactively, prompt for REGEXP using `read-regexp', then FACE.
-Use the global history list for FACE.
+Use the global history list for FACE.  Limit face setting to the
+corresponding SUBEXP (interactively, the prefix argument) of REGEXP.
+If SUBEXP is omitted or nil, the entire REGEXP is highlighted.
 
 Use Font lock mode, if enabled, to highlight REGEXP.  Otherwise,
 use overlays for highlighting.  If overlays are used, the
@@ -441,10 +443,11 @@ highlighting will not update as you type."
    (list
     (hi-lock-regexp-okay
      (read-regexp "Regexp to highlight" 'regexp-history-last))
-    (hi-lock-read-face-name)))
+    (hi-lock-read-face-name)
+    current-prefix-arg))
   (or (facep face) (setq face 'hi-yellow))
   (unless hi-lock-mode (hi-lock-mode 1))
-  (hi-lock-set-pattern regexp face))
+  (hi-lock-set-pattern regexp face subexp))
 
 ;;;###autoload
 (defalias 'highlight-phrase 'hi-lock-face-phrase-buffer)
@@ -686,11 +689,14 @@ with completion and history."
       (add-to-list 'hi-lock-face-defaults face t))
     (intern face)))
 
-(defun hi-lock-set-pattern (regexp face)
-  "Highlight REGEXP with face FACE."
+(defun hi-lock-set-pattern (regexp face &optional subexp)
+  "Highlight SUBEXP of REGEXP with face FACE.
+If omitted or nil, SUBEXP defaults to zero, i.e. the entire
+REGEXP is highlighted."
   ;; Hashcons the regexp, so it can be passed to remove-overlays later.
   (setq regexp (hi-lock--hashcons regexp))
-  (let ((pattern (list regexp (list 0 (list 'quote face) 'prepend)))
+  (setq subexp (or subexp 0))
+  (let ((pattern (list regexp (list subexp (list 'quote face) 'prepend)))
         (no-matches t))
     ;; Refuse to highlight a text that is already highlighted.
     (if (assoc regexp hi-lock-interactive-patterns)
@@ -712,7 +718,8 @@ with completion and history."
             (goto-char search-start)
             (while (re-search-forward regexp search-end t)
               (when no-matches (setq no-matches nil))
-              (let ((overlay (make-overlay (match-beginning 0) (match-end 0))))
+              (let ((overlay (make-overlay (match-beginning subexp)
+                                           (match-end subexp))))
                 (overlay-put overlay 'hi-lock-overlay t)
                 (overlay-put overlay 'hi-lock-overlay-regexp regexp)
                 (overlay-put overlay 'face face))
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index 0fd2971..78dab1c 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -579,6 +579,7 @@ directory, like `default-directory'."
     (define-key map (kbd "R") 'ibuffer-do-rename-uniquely)
     (define-key map (kbd "S") 'ibuffer-do-save)
     (define-key map (kbd "T") 'ibuffer-do-toggle-read-only)
+    (define-key map (kbd "L") 'ibuffer-do-toggle-lock)
     (define-key map (kbd "r") 'ibuffer-do-replace-regexp)
     (define-key map (kbd "V") 'ibuffer-do-revert)
     (define-key map (kbd "W") 'ibuffer-do-view-and-eval)
@@ -851,6 +852,10 @@ directory, like `default-directory'."
       '(menu-item "Print" ibuffer-do-print))
     (define-key-after operate-map [do-toggle-modified]
       '(menu-item "Toggle modification flag" ibuffer-do-toggle-modified))
+    (define-key-after operate-map [do-toggle-read-only]
+      '(menu-item "Toggle read-only flag" ibuffer-do-toggle-read-only))
+    (define-key-after operate-map [do-toggle-lock]
+      '(menu-item "Toggle lock flag" ibuffer-do-toggle-lock))
     (define-key-after operate-map [do-revert]
       '(menu-item "Revert" ibuffer-do-revert
         :help "Revert marked buffers to their associated file"))
@@ -1349,6 +1354,16 @@ Otherwise, toggle read only status."
    :modifier-p t)
   (read-only-mode (if (integerp arg) arg 'toggle)))
 
+(define-ibuffer-op ibuffer-do-toggle-lock (&optional arg)
+  "Toggle locked status in marked buffers.
+If optional ARG is a non-negative integer, lock buffers.
+If ARG is a negative integer or 0, unlock buffers.
+Otherwise, toggle lock status."
+  (:opstring "toggled lock status in"
+   :interactive "P"
+   :modifier-p t)
+  (emacs-lock-mode (if (integerp arg) arg 'toggle)))
+
 (define-ibuffer-op ibuffer-do-delete ()
   "Kill marked buffers as with `kill-this-buffer'."
   (:opstring "killed"
@@ -1896,11 +1911,9 @@ If point is on a group name, this function operates on 
that group."
      (let ((procs 0)
           (files 0))
        (dolist (string strings)
-        (if (string-match "\\(?:\\`([[:ascii:]]+)\\)" string)
-            (progn (setq procs (1+ procs))
-                   (if (< (match-end 0) (length string))
-                       (setq files (1+ files))))
-          (setq files (1+ files))))
+         (when (get-text-property 1 'ibuffer-process string)
+           (setq procs (1+ procs)))
+        (setq files (1+ files)))
        (concat (cond ((zerop files) "No files")
                     ((= 1 files) "1 file")
                     (t (format "%d files" files)))
@@ -1912,7 +1925,8 @@ If point is on a group name, this function operates on 
that group."
        (filename (ibuffer-make-column-filename buffer mark)))
     (if proc
        (concat (propertize (format "(%s %s)" proc (process-status proc))
-                           'font-lock-face 'italic)
+                           'font-lock-face 'italic
+                            'ibuffer-process proc)
                (if (> (length filename) 0)
                    (format " %s" filename)
                  ""))
@@ -2498,6 +2512,7 @@ Operations on marked buffers:
   `\\[ibuffer-do-view-other-frame]' - View the marked buffers in another frame.
   `\\[ibuffer-do-revert]' - Revert the marked buffers.
   `\\[ibuffer-do-toggle-read-only]' - Toggle read-only state of marked buffers.
+  `\\[ibuffer-do-toggle-lock]' - Toggle lock state of marked buffers.
   `\\[ibuffer-do-delete]' - Kill the marked buffers.
   `\\[ibuffer-do-isearch]' - Do incremental search in the marked buffers.
   `\\[ibuffer-do-isearch-regexp]' - Isearch for regexp in the marked buffers.
diff --git a/lisp/international/ccl.el b/lisp/international/ccl.el
index d2f490d..58083f0 100644
--- a/lisp/international/ccl.el
+++ b/lisp/international/ccl.el
@@ -184,11 +184,19 @@
 (defvar ccl-current-ic 0
   "The current index for `ccl-program-vector'.")
 
+;; The CCL compiled codewords are 28bits, but the CCL implementation
+;; assumes that the codewords are sign-extended, so that data constants in
+;; the upper part of the codeword are signed. This function truncates a
+;; codeword to 28bits, and then sign extends the result to a fixnum.
+(defun ccl-fixnum (code)
+  "Convert a CCL code word to a fixnum value."
+  (- (logxor (logand code #x0fffffff) #x08000000) #x08000000))
+
 (defun ccl-embed-data (data &optional ic)
   "Embed integer DATA in `ccl-program-vector' at `ccl-current-ic' and
 increment it.  If IC is specified, embed DATA at IC."
   (if ic
-      (aset ccl-program-vector ic data)
+      (aset ccl-program-vector ic (ccl-fixnum data))
     (let ((len (length ccl-program-vector)))
       (if (>= ccl-current-ic len)
          (let ((new (make-vector (* len 2) nil)))
@@ -196,7 +204,7 @@ increment it.  If IC is specified, embed DATA at IC."
              (setq len (1- len))
              (aset new len (aref ccl-program-vector len)))
            (setq ccl-program-vector new))))
-    (aset ccl-program-vector ccl-current-ic data)
+    (aset ccl-program-vector ccl-current-ic (ccl-fixnum data))
     (setq ccl-current-ic (1+ ccl-current-ic))))
 
 (defun ccl-embed-symbol (symbol prop)
@@ -230,7 +238,8 @@ proper index number for SYMBOL.  PROP should be
 `ccl-program-vector' at IC without altering the other bit field."
   (let ((relative (- ccl-current-ic (1+ ic))))
     (aset ccl-program-vector ic
-         (logior (aref ccl-program-vector ic) (ash relative 8)))))
+         (logior (aref ccl-program-vector ic)
+                  (ccl-fixnum (ash relative 8))))))
 
 (defun ccl-embed-code (op reg data &optional reg2)
   "Embed CCL code for the operation OP and arguments REG and DATA in
@@ -986,7 +995,8 @@ is a list of CCL-BLOCKs."
 (defun ccl-get-next-code ()
   "Return a CCL code in `ccl-code' at `ccl-current-ic'."
   (prog1
-      (aref ccl-code ccl-current-ic)
+      (let ((code (aref ccl-code ccl-current-ic)))
+        (if (numberp code) (ccl-fixnum code) code))
     (setq ccl-current-ic (1+ ccl-current-ic))))
 
 (defun ccl-dump-1 ()
diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el
index d4ade3c..9bd05ce 100644
--- a/lisp/international/fontset.el
+++ b/lisp/international/fontset.el
@@ -79,7 +79,7 @@
        ("cns11643.92p7-0" . chinese-cns11643-7)
        ("big5" . big5)
        ("viscii" . viscii)
-       ("tis620" . thai-iso8859-11)
+       ("tis620" . tis620-2533)
        ("microsoft-cp1251" . windows-1251)
        ("koi8-r" . koi8-r)
        ("jisx0213.2000-1" . japanese-jisx0213-1)
@@ -139,7 +139,7 @@
        (cyrillic-iso8859-5 . iso-8859-5)
        (greek-iso8859-7 . iso-8859-7)
        (arabic-iso8859-6 . iso-8859-6)
-       (thai-tis620 . thai-iso8859-11)
+       (thai-tis620 . tis620-2533)
        (latin-jisx0201 . jisx0201)
        (katakana-jisx0201 . jisx0201)
        (chinese-big5-1 . big5)
diff --git a/lisp/international/iso-transl.el b/lisp/international/iso-transl.el
index 1af5c64..0856b4f 100644
--- a/lisp/international/iso-transl.el
+++ b/lisp/international/iso-transl.el
@@ -234,18 +234,18 @@ sequence VECTOR.  (VECTOR is normally one character 
long.)")
 ;; Language-specific translation lists.
 (defvar iso-transl-language-alist
   '(("Esperanto"
-     ("C"  . [?Æ])
-     ("G"  . [?Ø])
-     ("H"  . [?¦])
-     ("J"  . [?¬])
-     ("S"  . [?Þ])
-     ("U"  . [?Ý])
-     ("c"  . [?æ])
-     ("g"  . [?ø])
-     ("h"  . [?¶])
-     ("j"  . [?¼])
-     ("s"  . [?þ])
-     ("u"  . [?ý]))
+     ("C"  . [?Ĉ])
+     ("G"  . [?Ĝ])
+     ("H"  . [?Ĥ])
+     ("J"  . [?Ĵ])
+     ("S"  . [?Ŝ])
+     ("U"  . [?Ŭ])
+     ("c"  . [?ĉ])
+     ("g"  . [?ĝ])
+     ("h"  . [?ĥ])
+     ("j"  . [?ĵ])
+     ("s"  . [?ŝ])
+     ("u"  . [?ŭ]))
     ("French"
      ("C"  . [?Ç])
      ("c"  . [?ç]))
diff --git a/lisp/international/mule-conf.el b/lisp/international/mule-conf.el
index a635c67..3affeec 100644
--- a/lisp/international/mule-conf.el
+++ b/lisp/international/mule-conf.el
@@ -201,7 +201,6 @@
 ;; plus nbsp
 (define-iso-single-byte-charset 'iso-8859-11 'thai-iso8859-11
   "ISO/IEC 8859/11" "Latin/Thai" 166 ?T nil "8859-11")
-(define-charset-alias 'tis620-2533 'thai-iso8859-11)
 
 ;; 8859-12 doesn't (yet?) exist.
 
@@ -223,13 +222,20 @@
 ;; Can this be shared with 8859-11?
 ;; N.b. not all of these are defined in Unicode.
 (define-charset 'thai-tis620
-  "TIS620.2533"
+  "MULE charset for TIS620.2533"
   :short-name "TIS620.2533"
   :iso-final-char ?T
   :emacs-mule-id 133
   :code-space [32 127]
   :code-offset #x0E00)
 
+(define-charset 'tis620-2533
+  "TIS620.2533, a.k.a. TIS-620.  Like `thai-iso8859-11', but without NBSP."
+  :short-name "TIS620.2533"
+  :ascii-compatible-p t
+  :code-space [0 255]
+  :superset '(ascii (thai-tis620 . 128)))
+
 (define-charset 'jisx0201
   "JISX0201"
   :short-name "JISX0201"
diff --git a/lisp/international/mule.el b/lisp/international/mule.el
index a5e7477..0267b15 100644
--- a/lisp/international/mule.el
+++ b/lisp/international/mule.el
@@ -2545,7 +2545,17 @@ This function is intended to be added to 
`auto-coding-functions'."
       (let* ((match (match-string 2))
             (sym (intern (downcase match))))
        (if (coding-system-p sym)
-           sym
+            ;; If the encoding tag is UTF-8 and the buffer's
+            ;; encoding is one of the variants of UTF-8, use the
+            ;; buffer's encoding.  This allows, e.g., saving an
+            ;; HTML file as UTF-8 with BOM when the tag says UTF-8.
+            (let ((sym-type (coding-system-type sym))
+                  (bfcs-type
+                   (coding-system-type buffer-file-coding-system)))
+              (if (and (coding-system-equal 'utf-8 sym-type)
+                       (coding-system-equal 'utf-8 bfcs-type))
+                  buffer-file-coding-system
+               sym))
          (message "Warning: unknown coding system \"%s\"" match)
          nil)))))
 
diff --git a/lisp/jsonrpc.el b/lisp/jsonrpc.el
index b2ccea5..14d730a 100644
--- a/lisp/jsonrpc.el
+++ b/lisp/jsonrpc.el
@@ -6,7 +6,7 @@
 ;; Maintainer: João Távora <address@hidden>
 ;; Keywords: processes, languages, extensions
 ;; Package-Requires: ((emacs "25.2"))
-;; Version: 1.0.0
+;; Version: 1.0.6
 
 ;; This is an Elpa :core package.  Don't use functionality that is not
 ;; compatible with Emacs 25.2.
@@ -74,7 +74,11 @@
     :documentation "A hash table of request ID to continuation lambdas.")
    (-events-buffer
     :accessor jsonrpc--events-buffer
-    :documentation "A buffer pretty-printing the JSON-RPC RPC events")
+    :documentation "A buffer pretty-printing the JSONRPC events")
+   (-events-buffer-scrollback-size
+    :initarg :events-buffer-scrollback-size
+    :accessor jsonrpc--events-buffer-scrollback-size
+    :documentation "Max size of events buffer.  0 disables, nil means 
infinite.")
    (-deferred-actions
     :initform (make-hash-table :test #'equal)
     :accessor jsonrpc--deferred-actions
@@ -193,9 +197,7 @@ dispatcher in CONNECTION."
           (when timer (cancel-timer timer)))
         (remhash id (jsonrpc--request-continuations connection))
         (if error (funcall (nth 1 continuations) error)
-          (funcall (nth 0 continuations) result)))
-       (;; An abnormal situation
-        id (jsonrpc--warn "No continuation for id %s" id)))
+          (funcall (nth 0 continuations) result))))
       (jsonrpc--call-deferred connection))))
 
 
@@ -256,37 +258,62 @@ Returns nil."
   (apply #'jsonrpc--async-request-1 connection method params args)
   nil)
 
-(cl-defun jsonrpc-request (connection method params &key deferred timeout)
+(cl-defun jsonrpc-request (connection
+                           method params &key
+                           deferred timeout
+                           cancel-on-input
+                           cancel-on-input-retval)
   "Make a request to CONNECTION, wait for a reply.
 Like `jsonrpc-async-request' for CONNECTION, METHOD and PARAMS,
-but synchronous, i.e. this function doesn't exit until anything
-interesting (success, error or timeout) happens.  Furthermore, it
-only exits locally (returning the JSONRPC result object) if the
-request is successful, otherwise exit non-locally with an error
-of type `jsonrpc-error'.
+but synchronous.
 
-DEFERRED is passed to `jsonrpc-async-request', which see."
+Except in the case of a non-nil CANCEL-ON-INPUT (explained
+below), this function doesn't exit until anything interesting
+happens (success reply, error reply, or timeout).  Furthermore,
+it only exits locally (returning the JSONRPC result object) if
+the request is successful, otherwise it exits non-locally with an
+error of type `jsonrpc-error'.
+
+DEFERRED is passed to `jsonrpc-async-request', which see.
+
+If CANCEL-ON-INPUT is non-nil and the user inputs something while
+the functino is waiting, then it exits immediately, returning
+CANCEL-ON-INPUT-RETVAL.  Any future replies (normal or error) are
+ignored."
   (let* ((tag (cl-gensym "jsonrpc-request-catch-tag")) id-and-timer
+         cancelled
          (retval
-          (unwind-protect ; protect against user-quit, for example
+          (unwind-protect
               (catch tag
                 (setq
                  id-and-timer
                  (jsonrpc--async-request-1
                   connection method params
-                  :success-fn (lambda (result) (throw tag `(done ,result)))
+                  :success-fn (lambda (result)
+                                (unless cancelled
+                                  (throw tag `(done ,result))))
                   :error-fn
                   (jsonrpc-lambda
                       (&key code message data)
-                    (throw tag `(error (jsonrpc-error-code . ,code)
-                                       (jsonrpc-error-message . ,message)
-                                       (jsonrpc-error-data . ,data))))
+                    (unless cancelled
+                      (throw tag `(error (jsonrpc-error-code . ,code)
+                                         (jsonrpc-error-message . ,message)
+                                         (jsonrpc-error-data . ,data)))))
                   :timeout-fn
                   (lambda ()
-                    (throw tag '(error (jsonrpc-error-message . "Timed out"))))
+                    (unless cancelled
+                      (throw tag '(error (jsonrpc-error-message . "Timed 
out")))))
                   :deferred deferred
                   :timeout timeout))
-                (while t (accept-process-output nil 30)))
+                (cond (cancel-on-input
+                       (while (sit-for 30))
+                       (setq cancelled t)
+                       `(cancelled ,cancel-on-input-retval))
+                      (t (while t (accept-process-output nil 30)))))
+            ;; In normal operation, cancellation is handled by the
+            ;; timeout function and response filter, but we still have
+            ;; to protect against user-quit (C-g) or the
+            ;; `cancel-on-input' case.
             (pcase-let* ((`(,id ,timer) id-and-timer))
               (remhash id (jsonrpc--request-continuations connection))
               (remhash (list deferred (current-buffer))
@@ -388,16 +415,22 @@ connection object, called when the process dies .")
   "Return non-nil if JSONRPC connection CONN is running."
   (process-live-p (jsonrpc--process conn)))
 
-(cl-defmethod jsonrpc-shutdown ((conn jsonrpc-process-connection))
-  "Shutdown the JSONRPC connection CONN."
-  (cl-loop
-   with proc = (jsonrpc--process conn)
-   do
-   (delete-process proc)
-   (accept-process-output nil 0.1)
-   while (not (process-get proc 'jsonrpc-sentinel-done))
-   do (jsonrpc--warn
-       "Sentinel for %s still hasn't run,  deleting it!" proc)))
+(cl-defmethod jsonrpc-shutdown ((conn jsonrpc-process-connection)
+                                &optional cleanup)
+  "Wait for JSONRPC connection CONN to shutdown.
+With optional CLEANUP, kill any associated buffers. "
+  (unwind-protect
+      (cl-loop
+       with proc = (jsonrpc--process conn)
+       do
+       (delete-process proc)
+       (accept-process-output nil 0.1)
+       while (not (process-get proc 'jsonrpc-sentinel-done))
+       do (jsonrpc--warn
+           "Sentinel for %s still hasn't run,  deleting it!" proc))
+    (when cleanup
+      (kill-buffer (process-buffer (jsonrpc--process conn)))
+      (kill-buffer (jsonrpc-stderr-buffer conn)))))
 
 (defun jsonrpc-stderr-buffer (conn)
   "Get CONN's standard error buffer, if any."
@@ -629,27 +662,39 @@ TIMEOUT is nil)."
 CONNECTION is the current connection.  MESSAGE is a JSON-like
 plist.  TYPE is a symbol saying if this is a client or server
 originated."
-  (with-current-buffer (jsonrpc-events-buffer connection)
-    (cl-destructuring-bind (&key method id error &allow-other-keys) message
-      (let* ((inhibit-read-only t)
-             (subtype (cond ((and method id)       'request)
-                            (method                'notification)
-                            (id                    'reply)
-                            (t                     'message)))
-             (type
-              (concat (format "%s" (or type 'internal))
-                      (if type
-                          (format "-%s" subtype)))))
-        (goto-char (point-max))
-        (let ((msg (format "%s%s%s %s:\n%s\n"
-                           type
-                           (if id (format " (id:%s)" id) "")
-                           (if error " ERROR" "")
-                           (current-time-string)
-                           (pp-to-string message))))
-          (when error
-            (setq msg (propertize msg 'face 'error)))
-          (insert-before-markers msg))))))
+  (let ((max (jsonrpc--events-buffer-scrollback-size connection)))
+    (when (or (null max) (cl-plusp max))
+      (with-current-buffer (jsonrpc-events-buffer connection)
+        (cl-destructuring-bind (&key method id error &allow-other-keys) message
+          (let* ((inhibit-read-only t)
+                 (subtype (cond ((and method id)       'request)
+                                (method                'notification)
+                                (id                    'reply)
+                                (t                     'message)))
+                 (type
+                  (concat (format "%s" (or type 'internal))
+                          (if type
+                              (format "-%s" subtype)))))
+            (goto-char (point-max))
+            (prog1
+                (let ((msg (format "%s%s%s %s:\n%s\n"
+                                   type
+                                   (if id (format " (id:%s)" id) "")
+                                   (if error " ERROR" "")
+                                   (current-time-string)
+                                   (pp-to-string message))))
+                  (when error
+                    (setq msg (propertize msg 'face 'error)))
+                  (insert-before-markers msg))
+              ;; Trim the buffer if it's too large
+              (when max
+                (save-excursion
+                  (goto-char (point-min))
+                  (while (> (buffer-size) max)
+                    (delete-region (point) (progn (forward-line 1)
+                                                  (forward-sexp 1)
+                                                  (forward-line 2)
+                                                  (point)))))))))))))
 
 (provide 'jsonrpc)
 ;;; jsonrpc.el ends here
diff --git a/lisp/language/thai.el b/lisp/language/thai.el
index c655845..a896fe5 100644
--- a/lisp/language/thai.el
+++ b/lisp/language/thai.el
@@ -36,7 +36,7 @@
   "8-bit encoding for ASCII (MSB=0) and Thai TIS620 (MSB=1)."
   :coding-type 'charset
   :mnemonic ?T
-  :charset-list '(thai-iso8859-11))
+  :charset-list '(tis620-2533))
 
 (define-coding-system-alias 'th-tis620 'thai-tis620)
 (define-coding-system-alias 'tis620 'thai-tis620)
@@ -47,7 +47,7 @@
          (charset thai-tis620)
          (coding-system thai-tis620 iso-8859-11 cp874)
          (coding-priority thai-tis620)
-         (nonascii-translation . iso-8859-11)
+         (nonascii-translation . tis620-2533)
          (input-method . "thai-kesmanee")
          (unibyte-display . thai-tis620)
          (features thai-util)
diff --git a/lisp/net/eudc-bob.el b/lisp/net/eudc-bob.el
index 584d1a9..f63e807 100644
--- a/lisp/net/eudc-bob.el
+++ b/lisp/net/eudc-bob.el
@@ -25,8 +25,15 @@
 
 ;;; Commentary:
 
+;; eudc-bob.el presents binary entries in LDAP results in interactive
+;; ways.  For example, it will display JPEG binary data as an inline
+;; image in the results buffer.  See also
+;; https://tools.ietf.org/html/rfc2798.
+
 ;;; Usage:
-;;    See the corresponding info file
+
+;; The eudc-bob interactive functions are invoked when the user
+;; interacts with an `eudc-query-form' results buffer.
 
 ;;; Code:
 
@@ -148,40 +155,21 @@ display a button."
   "Toggle inline display of an image."
   (interactive)
   (when (eudc-bob-can-display-inline-images)
-    (cond ((featurep 'xemacs)
-          (let ((overlays (append (overlays-at (1- (point)))
-                                  (overlays-at (point))))
-                overlay glyph)
-            (setq overlay (car overlays))
-            (while (and overlay
-                        (not (setq glyph (overlay-get overlay 'glyph))))
-              (setq overlays (cdr overlays))
-              (setq overlay (car overlays)))
-            (if overlay
-                (if (overlay-get overlay 'end-glyph)
-                    (progn
-                      (overlay-put overlay 'end-glyph nil)
-                      (overlay-put overlay 'invisible nil))
-                  (overlay-put overlay 'end-glyph glyph)
-                  (overlay-put overlay 'invisible t)))))
-         (t
-          (let* ((overlays (append (overlays-at (1- (point)))
-                                   (overlays-at (point))))
-                 image)
-
-            ;; Search overlay with an image.
-            (while (and overlays (null image))
-              (let ((prop (overlay-get (car overlays) 'eudc-image)))
-                (if (eq 'image (car-safe prop))
-                    (setq image prop)
-                  (setq overlays (cdr overlays)))))
-
-            ;; Toggle that overlay's image display.
-            (when overlays
-              (let ((overlay (car overlays)))
-                (overlay-put overlay 'display
-                             (if (overlay-get overlay 'display)
-                                 nil image)))))))))
+    (let* ((overlays (append (overlays-at (1- (point)))
+                            (overlays-at (point))))
+          image)
+      ;; Search overlay with an image.
+      (while (and overlays (null image))
+       (let ((prop (overlay-get (car overlays) 'eudc-image)))
+         (if (eq 'image (car-safe prop))
+             (setq image prop)
+           (setq overlays (cdr overlays)))))
+      ;; Toggle that overlay's image display.
+      (when overlays
+       (let ((overlay (car overlays)))
+         (overlay-put overlay 'display
+                      (if (overlay-get overlay 'display)
+                          nil image)))))))
 
 (defun eudc-bob-display-audio (data)
   "Display a button for audio DATA."
@@ -265,25 +253,19 @@ display a button."
   (interactive "@e")
   (run-hooks 'activate-menubar-hook)
   (eudc-jump-to-event event)
-  (if (featurep 'xemacs)
-      (progn
-       (run-hooks 'activate-popup-menu-hook)
-       (popup-menu (eudc-bob-menu)))
-    (let ((result (x-popup-menu t (eudc-bob-menu)))
-         command)
-      (if result
-         (progn
-           (setq command (lookup-key (eudc-bob-menu)
-                                     (apply 'vector result)))
-           (command-execute command))))))
+  (let ((result (x-popup-menu t (eudc-bob-menu)))
+       command)
+    (if result
+       (progn
+         (setq command (lookup-key (eudc-bob-menu)
+                                   (apply 'vector result)))
+         (command-execute command)))))
 
 (setq eudc-bob-generic-keymap
       (let ((map (make-sparse-keymap)))
        (define-key map "s" 'eudc-bob-save-object)
        (define-key map "!" 'eudc-bob-pipe-object-to-external-program)
-       (define-key map (if (featurep 'xemacs)
-                           [button3]
-                         [down-mouse-3]) 'eudc-bob-popup-menu)
+       (define-key map [down-mouse-3] 'eudc-bob-popup-menu)
        map))
 
 (setq eudc-bob-image-keymap
@@ -294,25 +276,19 @@ display a button."
 (setq eudc-bob-sound-keymap
       (let ((map (make-sparse-keymap)))
        (define-key map [return] 'eudc-bob-play-sound-at-point)
-       (define-key map (if (featurep 'xemacs)
-                           [button2]
-                         [down-mouse-2]) 'eudc-bob-play-sound-at-mouse)
+       (define-key map [down-mouse-2] 'eudc-bob-play-sound-at-mouse)
        map))
 
 (setq eudc-bob-url-keymap
       (let ((map (make-sparse-keymap)))
        (define-key map [return] 'browse-url-at-point)
-       (define-key map (if (featurep 'xemacs)
-                           [button2]
-                         [down-mouse-2]) 'browse-url-at-mouse)
+       (define-key map [down-mouse-2] 'browse-url-at-mouse)
        map))
 
 (setq eudc-bob-mail-keymap
       (let ((map (make-sparse-keymap)))
        (define-key map [return] 'goto-address-at-point)
-       (define-key map (if (featurep 'xemacs)
-                           [button2]
-                         [down-mouse-2]) 'goto-address-at-point)
+       (define-key map [down-mouse-2] 'goto-address-at-point)
        map))
 
 (set-keymap-parent eudc-bob-image-keymap eudc-bob-generic-keymap)
@@ -320,19 +296,18 @@ display a button."
 
 ;; If the first arguments can be nil here, then these 3 can be
 ;; defconsts once more.
-(when (not (featurep 'xemacs))
-  (easy-menu-define eudc-bob-generic-menu
-    eudc-bob-generic-keymap
-    ""
-    eudc-bob-generic-menu)
-  (easy-menu-define eudc-bob-image-menu
-    eudc-bob-image-keymap
-    ""
-    eudc-bob-image-menu)
-  (easy-menu-define eudc-bob-sound-menu
-    eudc-bob-sound-keymap
-    ""
-    eudc-bob-sound-menu))
+(easy-menu-define eudc-bob-generic-menu
+  eudc-bob-generic-keymap
+  ""
+  eudc-bob-generic-menu)
+(easy-menu-define eudc-bob-image-menu
+  eudc-bob-image-keymap
+  ""
+  eudc-bob-image-menu)
+(easy-menu-define eudc-bob-sound-menu
+  eudc-bob-sound-keymap
+  ""
+  eudc-bob-sound-menu)
 
 ;;;###autoload
 (defun eudc-display-generic-binary (data)
diff --git a/lisp/net/eudc-hotlist.el b/lisp/net/eudc-hotlist.el
index a739561..0762445 100644
--- a/lisp/net/eudc-hotlist.el
+++ b/lisp/net/eudc-hotlist.el
@@ -55,11 +55,6 @@ These are the special commands of this mode:
     t -- Transpose the server at point and the previous one
     q -- Commit the changes and quit.
     x -- Quit without committing the changes."
-  (when (featurep 'xemacs)
-    (setq mode-popup-menu eudc-hotlist-menu)
-    (when (featurep 'menubar)
-      (set-buffer-menubar current-menubar)
-      (add-submenu nil (cons "EUDC-Hotlist" (cdr (cdr eudc-hotlist-menu))))))
   (setq buffer-read-only t))
 
 ;;;###autoload
@@ -179,10 +174,9 @@ These are the special commands of this mode:
     ["Save and Quit" eudc-hotlist-quit-edit t]
     ["Exit without Saving" kill-this-buffer t]))
 
-(when (not (featurep 'xemacs))
-  (easy-menu-define eudc-hotlist-emacs-menu
+(easy-menu-define eudc-hotlist-emacs-menu
     eudc-hotlist-mode-map
     ""
-    eudc-hotlist-menu))
+    eudc-hotlist-menu)
 
 ;;; eudc-hotlist.el ends here
diff --git a/lisp/net/eudc.el b/lisp/net/eudc.el
index 00d8c60..a28fa6a 100644
--- a/lisp/net/eudc.el
+++ b/lisp/net/eudc.el
@@ -630,9 +630,7 @@ These are the special commands of EUDC mode:
     n -- Move to next record.
     p -- Move to previous record.
     b -- Insert record at point into the BBDB database."
-  (if (not (featurep 'xemacs))
-      (easy-menu-define eudc-emacs-menu eudc-mode-map "" (eudc-menu))
-    (setq mode-popup-menu (eudc-menu))))
+  (easy-menu-define eudc-emacs-menu eudc-mode-map "" (eudc-menu)))
 
 ;;}}}
 
@@ -1140,33 +1138,11 @@ queries the server for the existing fields and displays 
a corresponding form."
            eudc-tail-menu)))
 
 (defun eudc-install-menu ()
-  (cond
-   ((and (featurep 'xemacs) (featurep 'menubar))
-    (add-submenu '("Tools") (eudc-menu)))
-   ((not (featurep 'xemacs))
-    (cond
-     ((fboundp 'easy-menu-create-menu)
-      (define-key
-       global-map
-       [menu-bar tools directory-search]
-       (cons "Directory Servers"
-             (easy-menu-create-menu "Directory Servers" (cdr (eudc-menu))))))
-     ((fboundp 'easy-menu-add-item)
-      (let ((menu (eudc-menu)))
-       (easy-menu-add-item nil '("tools") (easy-menu-create-menu (car menu)
-                                                                 (cdr menu)))))
-     ((fboundp 'easy-menu-create-keymaps)
-      (easy-menu-define eudc-menu-map eudc-mode-map "Directory Client Menu" 
(eudc-menu))
-      (define-key
-       global-map
-       [menu-bar tools eudc]
-       (cons "Directory Servers"
-             (easy-menu-create-keymaps "Directory Servers"
-                                        (cdr (eudc-menu))))))
-     (t
-      (error "Unknown version of easymenu"))))
-   ))
-
+  (define-key
+    global-map
+    [menu-bar tools directory-search]
+    (cons "Directory Servers"
+         (easy-menu-create-menu "Directory Servers" (cdr (eudc-menu))))))
 
 ;;; Load time initializations :
 
@@ -1182,7 +1158,7 @@ queries the server for the existing fields and displays a 
corresponding form."
   (eudc-install-menu))
 
 
-;; The following installs a short menu for EUDC at XEmacs startup.
+;; The following installs a short menu for EUDC at Emacs startup.
 
 ;;;###autoload
 (defun eudc-load-eudc ()
@@ -1196,8 +1172,7 @@ This does nothing except loading eudc by autoload 
side-effect."
   nil)
 
 ;;;###autoload
-(cond
- ((not (featurep 'xemacs))
+(progn
   (defvar eudc-tools-menu
     (let ((map (make-sparse-keymap "Directory Servers")))
       (define-key map [phone]
@@ -1222,34 +1197,6 @@ This does nothing except loading eudc by autoload 
side-effect."
                    :help ,(purecopy "Load the Emacs Unified Directory 
Client")))
       map))
   (fset 'eudc-tools-menu (symbol-value 'eudc-tools-menu)))
- (t
-  (let ((menu  '("Directory Servers"
-                ["Load Hotlist of Servers" eudc-load-eudc t]
-                ["New Server" eudc-set-server t]
-                ["---" nil nil]
-                ["Query with Form" eudc-query-form t]
-                ["Expand Inline Query" eudc-expand-inline t]
-                ["---" nil nil]
-                ["Get Email" eudc-get-email t]
-                ["Get Phone" eudc-get-phone t])))
-    (if (not (featurep 'eudc-autoloads))
-       (if (featurep 'xemacs)
-           (if (and (featurep 'menubar)
-                    (not (featurep 'infodock)))
-               (add-submenu '("Tools") menu))
-         (require 'easymenu)
-         (cond
-          ((fboundp 'easy-menu-add-item)
-           (easy-menu-add-item nil '("tools")
-                               (easy-menu-create-menu (car menu)
-                                                      (cdr menu))))
-          ((fboundp 'easy-menu-create-keymaps)
-           (define-key
-             global-map
-             [menu-bar tools eudc]
-             (cons "Directory Servers"
-                   (easy-menu-create-keymaps "Directory Servers"
-                                             (cdr menu)))))))))))
 
 ;;}}}
 
diff --git a/lisp/net/eudcb-bbdb.el b/lisp/net/eudcb-bbdb.el
index fb618d1..ac4814a 100644
--- a/lisp/net/eudcb-bbdb.el
+++ b/lisp/net/eudcb-bbdb.el
@@ -47,10 +47,13 @@
 BBDB < 3 used `net'; BBDB >= 3 uses `mail'."
   ;; This just-in-time translation permits upgrading from BBDB 2 to
   ;; BBDB 3 without restarting Emacs.
-  (if (and (eq field-symbol 'net)
-          (eudc--using-bbdb-3-or-newer-p))
-      'mail
-    field-symbol))
+  (cond ((and (eq field-symbol 'net)
+             (eudc--using-bbdb-3-or-newer-p))
+         'mail)
+        ((and (eq field-symbol 'company)
+             (eudc--using-bbdb-3-or-newer-p))
+         'organization)
+        (t field-symbol)))
 
 (defvar eudc-bbdb-attributes-translation-alist
   '((name . lastname)
@@ -124,18 +127,31 @@ BBDB < 3 used `net'; BBDB >= 3 uses `mail'."
 (declare-function bbdb-record-addresses "ext:bbdb" t) ; via bbdb-defstruct
 (declare-function bbdb-records          "ext:bbdb"
                   (&optional dont-check-disk already-in-db-buffer))
+(declare-function bbdb-record-notes "ext:bbdb" t) ; via bbdb-defstruct
+
+;; External, BBDB >= 3.
+(declare-function bbdb-phone-label "ext:bbdb" t) ; via bbdb-defstruct
+(declare-function bbdb-record-phone "ext:bbdb" t) ; via bbdb-defstruct
+(declare-function bbdb-record-address "ext:bbdb" t) ; via bbdb-defstruct
+(declare-function bbdb-record-xfield "ext:bbdb" t) ; via bbdb-defstruct
 
 (defun eudc-bbdb-extract-phones (record)
   (require 'bbdb)
   (mapcar (function
           (lambda (phone)
             (if eudc-bbdb-use-locations-as-attribute-names
-                (cons (intern (bbdb-phone-location phone))
+                (cons (intern (if (eudc--using-bbdb-3-or-newer-p)
+                                   (bbdb-phone-label phone)
+                                 (bbdb-phone-location phone)))
                       (bbdb-phone-string phone))
               (cons 'phones (format "%s: %s"
-                                    (bbdb-phone-location phone)
+                                    (if (eudc--using-bbdb-3-or-newer-p)
+                                         (bbdb-phone-label phone)
+                                       (bbdb-phone-location phone))
                                     (bbdb-phone-string phone))))))
-         (bbdb-record-phones record)))
+         (if (eudc--using-bbdb-3-or-newer-p)
+              (bbdb-record-phone record)
+            (bbdb-record-phones record))))
 
 (defun eudc-bbdb-extract-addresses (record)
   (require 'bbdb)
@@ -157,7 +173,9 @@ BBDB < 3 used `net'; BBDB >= 3 uses `mail'."
                   (cons (intern (bbdb-address-location address)) val)
                 (cons 'addresses (concat (bbdb-address-location address)
                                          "\n" val))))
-            (bbdb-record-addresses record))))
+            (if (eudc--using-bbdb-3-or-newer-p)
+                (bbdb-record-address record)
+              (bbdb-record-addresses record)))))
 
 (defun eudc-bbdb-format-record-as-result (record)
   "Format the BBDB RECORD as a EUDC query result record.
@@ -176,7 +194,11 @@ The record is filtered according to 
`eudc-bbdb-current-return-attributes'"
        (setq val (eudc-bbdb-extract-phones record)))
        ((eq attr 'addresses)
        (setq val (eudc-bbdb-extract-addresses record)))
-       ((memq attr '(firstname lastname aka company net notes))
+       ((eq attr 'notes)
+        (if (eudc--using-bbdb-3-or-newer-p)
+            (setq val (bbdb-record-xfield record 'notes))
+          (setq val (bbdb-record-notes record))))
+       ((memq attr '(firstname lastname aka company net))
        (setq val (eval
                   (list (intern
                          (concat "bbdb-record-"
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 7bd1668..c85fe67 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -869,7 +869,11 @@ buffer where the user can select from the list."
 ;;;###autoload
 (defun xref-find-references (identifier)
   "Find references to the identifier at point.
-With prefix argument, prompt for the identifier."
+This command might prompt for the identifier as needed, perhaps
+offering the symbol at point as the default.
+With prefix argument, or if `xref-prompt-for-identifier' is t,
+always prompt for the identifier.  If `xref-prompt-for-identifier'
+is nil, prompt only if there's no usable symbol at point."
   (interactive (list (xref--read-identifier "Find references of: ")))
   (xref--find-xrefs identifier 'references identifier nil))
 
diff --git a/lisp/shadowfile.el b/lisp/shadowfile.el
index 86280c3..180d502 100644
--- a/lisp/shadowfile.el
+++ b/lisp/shadowfile.el
@@ -628,26 +628,17 @@ Consider them as regular expressions if third arg REGEXP 
is true."
 
 (defun shadow-add-to-todo ()
   "If current buffer has shadows, add them to the list needing to be copied."
-  (message "shadow-add-to-todo 1 %s" (current-buffer))
-  (message "shadow-add-to-todo 2 %s" (buffer-file-name))
-  (message "shadow-add-to-todo 3 %s" (shadow-expand-file-name 
(buffer-file-name  (current-buffer))))
-  (message "shadow-add-to-todo 4 %s" (shadow-shadows-of 
(shadow-expand-file-name (buffer-file-name (current-buffer)))))
   (let ((shadows (shadow-shadows-of
                  (shadow-expand-file-name
                   (buffer-file-name (current-buffer))))))
     (when shadows
-      (message "shadow-add-to-todo 5 %s" shadows)
-      (message "shadow-add-to-todo 6 %s" shadow-files-to-copy)
-      (message "shadow-add-to-todo 7 %s" (shadow-union shadows 
shadow-files-to-copy))
       (setq shadow-files-to-copy
            (shadow-union shadows shadow-files-to-copy))
       (when (not shadow-inhibit-message)
        (message "%s" (substitute-command-keys
                       "Use \\[shadow-copy-files] to update shadows."))
        (sit-for 1))
-      (message "shadow-add-to-todo 8")
-      (shadow-write-todo-file)
-      (message "shadow-add-to-todo 9")))
+      (shadow-write-todo-file)))
   nil)     ; Return nil for write-file-functions
 
 (defun shadow-remove-from-todo (pair)
@@ -714,26 +705,18 @@ defined, the old hashtable info is invalid."
   "Write out information to `shadow-todo-file'.
 With non-nil argument also saves the buffer."
   (save-excursion
-    (message "shadow-write-todo-file 1 %s" shadow-todo-buffer)
     (if (not shadow-todo-buffer)
        (setq shadow-todo-buffer (find-file-noselect shadow-todo-file)))
-    (message "shadow-write-todo-file 2 %s" shadow-todo-buffer)
     (set-buffer shadow-todo-buffer)
-    (message "shadow-write-todo-file 3 %s" shadow-todo-buffer)
     (setq buffer-read-only nil)
     (delete-region (point-min) (point-max))
-    (message "shadow-write-todo-file 4 %s" shadow-todo-buffer)
     (shadow-insert-var 'shadow-files-to-copy)
-    (message "shadow-write-todo-file 5 %s" save)
-    (if save (shadow-save-todo-file))
-    (message "shadow-write-todo-file 6 %s" save)))
+    (if save (shadow-save-todo-file))))
 
 (defun shadow-save-todo-file ()
-  (message "shadow-save-todo-file 1 %s" shadow-todo-buffer)
   (if (and shadow-todo-buffer (buffer-modified-p shadow-todo-buffer))
       (with-current-buffer shadow-todo-buffer
-        (message "shadow-save-todo-file 2 %s" shadow-todo-buffer)
-        (condition-case nil            ; have to continue even in case of
+       (condition-case nil             ; have to continue even in case of
            (basic-save-buffer)         ; error, otherwise kill-emacs might
          (error                        ; not work!
           (message "WARNING: Can't save shadow todo file; it is locked!")
diff --git a/lisp/simple.el b/lisp/simple.el
index 8a8d248..277c141 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -6066,7 +6066,7 @@ into account variable-width characters and line 
continuation.
 If nil, `line-move' moves point by logical lines.
 A non-nil setting of `goal-column' overrides the value of this variable
 and forces movement by logical lines.
-A window that is  horizontally scrolled also forces movement by logical
+A window that is horizontally scrolled also forces movement by logical
 lines."
   :type 'boolean
   :group 'editing-basics
diff --git a/lisp/startup.el b/lisp/startup.el
index c1e56fc..4eb71ab 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -2534,9 +2534,9 @@ nil default-directory" name)
                    ((eq initial-buffer-choice t)
                     (get-buffer-create "*scratch*"))
                    (t
-                    (error "initial-buffer-choice must be a string, a 
function, or t.")))))
+                    (error "`initial-buffer-choice' must be a string, a 
function, or t")))))
         (unless (buffer-live-p buf)
-          (error "initial-buffer-choice is not a live buffer."))
+          (error "Value returned by `initial-buffer-choice' is not a live 
buffer: %S" buf))
         (setq displayable-buffers (cons buf (delq buf displayable-buffers)))))
 
     ;; Display the first two buffers in `displayable-buffers'.  If
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index 69bba10..f6a809b 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -1424,10 +1424,20 @@ determined by `flyspell-large-region'."
 The list of incorrect words should be in `flyspell-external-ispell-buffer'.
 \(We finish by killing that buffer and setting the variable to nil.)
 The buffer to mark them in is `flyspell-large-region-buffer'."
-  (let (words-not-found
-       (ispell-otherchars (ispell-get-otherchars))
-       (buffer-scan-pos flyspell-large-region-beg)
-       case-fold-search)
+  (let* (words-not-found
+         (flyspell-casechars (flyspell-get-casechars))
+         (ispell-otherchars (ispell-get-otherchars))
+         (ispell-many-otherchars-p (ispell-get-many-otherchars-p))
+         (word-chars (concat flyspell-casechars
+                             "+\\("
+                             (if (not (string= "" ispell-otherchars))
+                                 (concat ispell-otherchars "?"))
+                             flyspell-casechars
+                             "+\\)"
+                             (if ispell-many-otherchars-p
+                                 "*" "?")))
+         (buffer-scan-pos flyspell-large-region-beg)
+         case-fold-search)
     (with-current-buffer flyspell-external-ispell-buffer
       (goto-char (point-min))
       ;; Loop over incorrect words, in the order they were reported,
@@ -1457,11 +1467,18 @@ The buffer to mark them in is 
`flyspell-large-region-buffer'."
                              ;; Move back into the match
                              ;; so flyspell-get-word will find it.
                              (forward-char -1)
-                             (flyspell-get-word)))
+                              ;; Is this a word that matches the
+                              ;; current dictionary?
+                              (if (looking-at word-chars)
+                                 (flyspell-get-word))))
                           (found (car found-list))
                           (found-length (length found))
                           (misspell-length (length word)))
                      (when (or
+                             ;; Misspelled word is not from the
+                             ;; language supported by the current
+                             ;; dictionary.
+                             (null found)
                             ;; Size matches, we really found it.
                             (= found-length misspell-length)
                             ;; Matches as part of a boundary-char separated
@@ -1483,13 +1500,21 @@ The buffer to mark them in is 
`flyspell-large-region-buffer'."
                             ;; backslash) and none of the previous
                             ;; conditions match.
                             (and (not ispell-really-aspell)
+                                  (not ispell-really-hunspell)
+                                  (not ispell-really-enchant)
                                  (save-excursion
                                    (goto-char (- (nth 1 found-list) 1))
                                    (if (looking-at "[\\]" )
                                        t
                                      nil))))
                        (setq keep nil)
-                       (flyspell-word nil t)
+                        ;; Don't try spell-checking words whose
+                        ;; characters don't match CASECHARS, because
+                        ;; flyspell-word will then consider as
+                        ;; misspelling the preceding word that matches
+                        ;; CASECHARS.
+                        (or (null found)
+                           (flyspell-word nil t))
                        ;; Search for next misspelled word will begin from
                        ;; end of last validated match.
                        (setq buffer-scan-pos (point))))
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index e6f436f..87bcb5d 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -1173,6 +1173,12 @@ dictionary from that list was found."
     ;; Parse and set values for default dictionary.
     (setq hunspell-default-dict (or hunspell-multi-dict
                                    (car hunspell-default-dict)))
+    ;; If hunspell-default-dict is nil, ispell-parse-hunspell-affix-file
+    ;; will barf with an error message that doesn't help users figure
+    ;; out what is wrong.  Produce an error message that points to the
+    ;; root cause of the problem.
+    (or hunspell-default-dict
+        (error "Can't find Hunspell dictionary with a .aff affix file"))
     (setq hunspell-default-dict-entry
          (ispell-parse-hunspell-affix-file hunspell-default-dict))
     ;; Create an alist of found dicts with only names, except for default dict.
diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el
index 7fcb3bc..679401e 100644
--- a/lisp/thingatpt.el
+++ b/lisp/thingatpt.el
@@ -61,7 +61,7 @@
   "Move forward to the end of the Nth next THING.
 THING should be a symbol specifying a type of syntactic entity.
 Possibilities include `symbol', `list', `sexp', `defun',
-`filename', `url', `email', `word', `sentence', `whitespace',
+`filename', `url', `email', `uuid', `word', `sentence', `whitespace',
 `line', and `page'."
   (let ((forward-op (or (get thing 'forward-op)
                        (intern-soft (format "forward-%s" thing)))))
@@ -76,7 +76,7 @@ Possibilities include `symbol', `list', `sexp', `defun',
   "Determine the start and end buffer locations for the THING at point.
 THING should be a symbol specifying a type of syntactic entity.
 Possibilities include `symbol', `list', `sexp', `defun',
-`filename', `url', `email', `word', `sentence', `whitespace',
+`filename', `url', `email', `uuid', `word', `sentence', `whitespace',
 `line', and `page'.
 
 See the file `thingatpt.el' for documentation on how to define a
@@ -134,7 +134,7 @@ positions of the thing found."
   "Return the THING at point.
 THING should be a symbol specifying a type of syntactic entity.
 Possibilities include `symbol', `list', `sexp', `defun',
-`filename', `url', `email', `word', `sentence', `whitespace',
+`filename', `url', `email', `uuid', `word', `sentence', `whitespace',
 `line', `number', and `page'.
 
 When the optional argument NO-PROPERTIES is non-nil,
@@ -564,6 +564,24 @@ with angle brackets.")
 (put 'buffer 'end-op (lambda () (goto-char (point-max))))
 (put 'buffer 'beginning-op (lambda () (goto-char (point-min))))
 
+;; UUID
+
+(defconst thing-at-point-uuid-regexp
+  (rx bow
+      (repeat 8 hex-digit) "-"
+      (repeat 4 hex-digit) "-"
+      (repeat 4 hex-digit) "-"
+      (repeat 4 hex-digit) "-"
+      (repeat 12 hex-digit)
+      eow)
+  "A regular expression matching a UUID.
+See RFC 4122 for the description of the format.")
+
+(put 'uuid 'bounds-of-thing-at-point
+     (lambda ()
+       (when (thing-at-point-looking-at thing-at-point-uuid-regexp 36)
+         (cons (match-beginning 0) (match-end 0)))))
+
 ;;  Aliases
 
 (defun word-at-point ()
diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index 21ea764..f88ced8 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -692,24 +692,26 @@ visiting FILE.
 If BACKEND is passed use it as the VC backend when computing the result."
   (interactive (list buffer-file-name))
   (setq backend (or backend (vc-backend file)))
-  (if (not backend)
-      (setq vc-mode nil)
+  (cond
+   ((not backend)
+    (setq vc-mode nil))
+   ((null vc-display-status)
+    (setq vc-mode (concat " " (symbol-name backend))))
+   (t
     (let* ((ml-string (vc-call-backend backend 'mode-line-string file))
           (ml-echo (get-text-property 0 'help-echo ml-string)))
       (setq vc-mode
            (concat
             " "
-            (if (null vc-display-status)
-                (symbol-name backend)
-              (propertize
-               ml-string
-               'mouse-face 'mode-line-highlight
-               'help-echo
-               (concat (or ml-echo
-                           (format "File under the %s version control system"
-                                   backend))
-                       "\nmouse-1: Version Control menu")
-               'local-map vc-mode-line-map)))))
+            (propertize
+             ml-string
+             'mouse-face 'mode-line-highlight
+             'help-echo
+             (concat (or ml-echo
+                         (format "File under the %s version control system"
+                                 backend))
+                     "\nmouse-1: Version Control menu")
+             'local-map vc-mode-line-map))))
     ;; If the user is root, and the file is not owner-writable,
     ;; then pretend that we can't write it
     ;; even though we can (because root can write anything).
@@ -718,7 +720,7 @@ If BACKEND is passed use it as the VC backend when 
computing the result."
         (not buffer-read-only)
         (zerop (user-real-uid))
         (zerop (logand (file-modes buffer-file-name) 128))
-        (setq buffer-read-only t)))
+        (setq buffer-read-only t))))
   (force-mode-line-update)
   backend)
 
diff --git a/lisp/w32-fns.el b/lisp/w32-fns.el
index bdba32c..a8a41c4 100644
--- a/lisp/w32-fns.el
+++ b/lisp/w32-fns.el
@@ -279,7 +279,7 @@ bit output with no translation."
   (w32-add-charset-info "iso8859-9" 'w32-charset-turkish 1254)
   (w32-add-charset-info "iso8859-13" 'w32-charset-baltic 1257)
   (w32-add-charset-info "koi8-r" 'w32-charset-russian 20866)
-  (w32-add-charset-info "iso8859-5" 'w32-charset-russian 28595)
+  (w32-add-charset-info "tis620-2533" 'w32-charset-russian 28595)
   (w32-add-charset-info "iso8859-11" 'w32-charset-thai 874)
   (w32-add-charset-info "windows-1258" 'w32-charset-vietnamese 1258)
   (w32-add-charset-info "ksc5601.1992" 'w32-charset-johab 1361)
diff --git a/src/.gdbinit b/src/.gdbinit
index 3cebdff..ae6f13a 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -649,17 +649,13 @@ define xtype
   xgettype $
   output $type
   echo \n
-  if $type == Lisp_Misc
-    xmisctype
-  else
-    if $type == Lisp_Vectorlike
-      xvectype
-    end
+  if $type == Lisp_Vectorlike
+    xvectype
   end
 end
 document xtype
 Print the type of $, assuming it is an Emacs Lisp value.
-If the first type printed is Lisp_Vector or Lisp_Misc,
+If the first type printed is Lisp_Vectorlike,
 a second line gives the more precise type.
 end
 
@@ -711,15 +707,6 @@ Print the size of $
 This command assumes that $ is a Lisp_Object.
 end
 
-define xmisctype
-  xgetptr $
-  output (enum Lisp_Misc_Type) (((struct Lisp_Free *) $ptr)->type)
-  echo \n
-end
-document xmisctype
-Assume that $ is some misc type and print its specific type.
-end
-
 define xint
   xgetint $
   print $int
@@ -754,15 +741,6 @@ Print $ as a overlay pointer.
 This command assumes that $ is an Emacs Lisp overlay value.
 end
 
-define xmiscfree
-  xgetptr $
-  print (struct Lisp_Free *) $ptr
-end
-document xmiscfree
-Print $ as a misc free-cell pointer.
-This command assumes that $ is an Emacs Lisp Misc value.
-end
-
 define xsymbol
   set $sym = $
   xgetsym $sym
@@ -1015,18 +993,6 @@ define xpr
   if $type == Lisp_Float
     xfloat
   end
-  if $type == Lisp_Misc
-    set $misc = (enum Lisp_Misc_Type) (((struct Lisp_Free *) $ptr)->type)
-    if $misc == Lisp_Misc_Free
-      xmiscfree
-    end
-    if $misc == Lisp_Misc_Marker
-      xmarker
-    end
-    if $misc == Lisp_Misc_Overlay
-      xoverlay
-    end
-  end
   if $type == Lisp_Vectorlike
     set $size = ((struct Lisp_Vector *) $ptr)->header.size
     if ($size & PSEUDOVECTOR_FLAG)
@@ -1034,6 +1000,12 @@ define xpr
       if $vec == PVEC_NORMAL_VECTOR
        xvector
       end
+      if $vec == PVEC_MARKER
+        xmarker
+      end
+      if $vec == PVEC_OVERLAY
+        xoverlay
+      end
       if $vec == PVEC_PROCESS
        xprocess
       end
diff --git a/src/Makefile.in b/src/Makefile.in
index 1aae27b..52ce760 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -322,6 +322,9 @@ INTERVALS_H = dispextern.h intervals.h composite.h
 
 GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
 
+GMP_LIB = @GMP_LIB@
+GMP_OBJ = @GMP_OBJ@
+
 RUN_TEMACS = ./temacs
 
 # Whether builds should contain details. '--no-build-details' or empty.
@@ -403,7 +406,7 @@ base_obj = dispnew.o frame.o scroll.o xdisp.o menu.o 
$(XMENU_OBJ) window.o \
        thread.o systhread.o \
        $(if $(HYBRID_MALLOC),sheap.o) \
        $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) \
-       $(W32_OBJ) $(WINDOW_SYSTEM_OBJ) $(XGSELOBJ) $(JSON_OBJ)
+       $(W32_OBJ) $(WINDOW_SYSTEM_OBJ) $(XGSELOBJ) $(JSON_OBJ) $(GMP_OBJ)
 obj = $(base_obj) $(NS_OBJC_OBJ)
 
 ## Object files used on some machine or other.
@@ -501,7 +504,7 @@ LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(LIBX_BASE) 
$(LIBIMAGE) \
    $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \
    $(LIBGNUTLS_LIBS) $(LIB_PTHREAD) $(GETADDRINFO_A_LIBS) $(LCMS2_LIBS) \
    $(NOTIFY_LIBS) $(LIB_MATH) $(LIBZ) $(LIBMODULES) $(LIBSYSTEMD_LIBS) \
-   $(JSON_LIBS)
+   $(JSON_LIBS) $(GMP_LIB)
 
 ## FORCE it so that admin/unidata can decide whether these files
 ## are up-to-date.  Although since charprop depends on bootstrap-emacs,
diff --git a/src/alloc.c b/src/alloc.c
index ad716f5..0cd3f0c 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -247,8 +247,8 @@ bool gc_in_progress;
 
 /* Number of live and free conses etc.  */
 
-static EMACS_INT total_conses, total_markers, total_symbols, total_buffers;
-static EMACS_INT total_free_conses, total_free_markers, total_free_symbols;
+static EMACS_INT total_conses, total_symbols, total_buffers;
+static EMACS_INT total_free_conses, total_free_symbols;
 static EMACS_INT total_free_floats, total_floats;
 
 /* Points to memory space allocated as "spare", to be freed if we run
@@ -356,6 +356,7 @@ no_sanitize_memcpy (void *dest, void const *src, size_t 
size)
 
 #endif /* MAX_SAVE_STACK > 0 */
 
+static void unchain_finalizer (struct Lisp_Finalizer *);
 static void mark_terminals (void);
 static void gc_sweep (void);
 static Lisp_Object make_pure_vector (ptrdiff_t);
@@ -378,7 +379,6 @@ enum mem_type
   MEM_TYPE_BUFFER,
   MEM_TYPE_CONS,
   MEM_TYPE_STRING,
-  MEM_TYPE_MISC,
   MEM_TYPE_SYMBOL,
   MEM_TYPE_FLOAT,
   /* Since all non-bool pseudovectors are small enough to be
@@ -2321,13 +2321,13 @@ a multibyte string even if INIT is an ASCII character.  
*/)
   int c;
   EMACS_INT nbytes;
 
-  CHECK_NATNUM (length);
+  CHECK_FIXNAT (length);
   CHECK_CHARACTER (init);
 
-  c = XFASTINT (init);
+  c = XFIXNAT (init);
   if (ASCII_CHAR_P (c) && NILP (multibyte))
     {
-      nbytes = XINT (length);
+      nbytes = XFIXNUM (length);
       val = make_uninit_string (nbytes);
       if (nbytes)
        {
@@ -2339,7 +2339,7 @@ a multibyte string even if INIT is an ASCII character.  
*/)
     {
       unsigned char str[MAX_MULTIBYTE_LENGTH];
       ptrdiff_t len = CHAR_STRING (c, str);
-      EMACS_INT string_len = XINT (length);
+      EMACS_INT string_len = XFIXNUM (length);
       unsigned char *p, *beg, *end;
 
       if (INT_MULTIPLY_WRAPV (len, string_len, &nbytes))
@@ -2415,8 +2415,8 @@ LENGTH must be a number.  INIT matters only in whether it 
is t or nil.  */)
 {
   Lisp_Object val;
 
-  CHECK_NATNUM (length);
-  val = make_uninit_bool_vector (XFASTINT (length));
+  CHECK_FIXNAT (length);
+  val = make_uninit_bool_vector (XFIXNAT (length));
   return bool_vector_fill (val, init);
 }
 
@@ -2654,8 +2654,6 @@ make_float (double float_value)
 
   if (float_free_list)
     {
-      /* We use the data field for chaining the free list
-        so that we won't use the same field that has the mark bit.  */
       XSETFLOAT (val, float_free_list);
       float_free_list = float_free_list->u.chain;
     }
@@ -2759,8 +2757,6 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0,
 
   if (cons_free_list)
     {
-      /* We use the cdr for chaining the free list
-        so that we won't use the same field that has the mark bit.  */
       XSETCONS (val, cons_free_list);
       cons_free_list = cons_free_list->u.s.u.chain;
     }
@@ -2894,9 +2890,9 @@ DEFUN ("make-list", Fmake_list, Smake_list, 2, 2, 0,
   (Lisp_Object length, Lisp_Object init)
 {
   Lisp_Object val = Qnil;
-  CHECK_NATNUM (length);
+  CHECK_FIXNAT (length);
 
-  for (EMACS_INT size = XFASTINT (length); 0 < size; size--)
+  for (EMACS_INT size = XFIXNAT (length); 0 < size; size--)
     {
       val = Fcons (init, val);
       rarely_quit (size);
@@ -2932,7 +2928,7 @@ set_next_vector (struct Lisp_Vector *v, struct 
Lisp_Vector *p)
    for the most common cases; it's not required to be a power of two, but
    it's expected to be a mult-of-ROUNDUP_SIZE (see below).  */
 
-#define VECTOR_BLOCK_SIZE 4096
+enum { VECTOR_BLOCK_SIZE = 4096 };
 
 /* Vector size requests are a multiple of this.  */
 enum { roundup_size = COMMON_MULTIPLE (LISP_ALIGNMENT, word_size) };
@@ -2948,22 +2944,21 @@ verify (VECTOR_BLOCK_SIZE <= (1 << 
PSEUDOVECTOR_SIZE_BITS));
 
 /* Rounding helps to maintain alignment constraints if USE_LSB_TAG.  */
 
-#define VECTOR_BLOCK_BYTES (VECTOR_BLOCK_SIZE - vroundup_ct (sizeof (void *)))
+enum {VECTOR_BLOCK_BYTES = VECTOR_BLOCK_SIZE - vroundup_ct (sizeof (void *))};
 
 /* Size of the minimal vector allocated from block.  */
 
-#define VBLOCK_BYTES_MIN vroundup_ct (header_size + sizeof (Lisp_Object))
+enum { VBLOCK_BYTES_MIN = vroundup_ct (header_size + sizeof (Lisp_Object)) };
 
 /* Size of the largest vector allocated from block.  */
 
-#define VBLOCK_BYTES_MAX                                       \
-  vroundup ((VECTOR_BLOCK_BYTES / 2) - word_size)
+enum { VBLOCK_BYTES_MAX = vroundup_ct ((VECTOR_BLOCK_BYTES / 2) - word_size) };
 
 /* We maintain one free list for each possible block-allocated
    vector size, and this is the number of free lists we have.  */
 
-#define VECTOR_MAX_FREE_LIST_INDEX                             \
-  ((VECTOR_BLOCK_BYTES - VBLOCK_BYTES_MIN) / roundup_size + 1)
+enum { VECTOR_MAX_FREE_LIST_INDEX =
+       (VECTOR_BLOCK_BYTES - VBLOCK_BYTES_MIN) / roundup_size + 1 };
 
 /* Common shortcut to advance vector pointer over a block data.  */
 
@@ -3090,14 +3085,14 @@ init_vectors (void)
 /* Allocate vector from a vector block.  */
 
 static struct Lisp_Vector *
-allocate_vector_from_block (size_t nbytes)
+allocate_vector_from_block (ptrdiff_t nbytes)
 {
   struct Lisp_Vector *vector;
   struct vector_block *block;
   size_t index, restbytes;
 
-  eassert (VBLOCK_BYTES_MIN <= nbytes && nbytes <= VBLOCK_BYTES_MAX);
-  eassert (nbytes % roundup_size == 0);
+  eassume (VBLOCK_BYTES_MIN <= nbytes && nbytes <= VBLOCK_BYTES_MAX);
+  eassume (nbytes % roundup_size == 0);
 
   /* First, try to allocate from a free list
      containing vectors of the requested size.  */
@@ -3182,35 +3177,63 @@ vector_nbytes (struct Lisp_Vector *v)
   return vroundup (header_size + word_size * nwords);
 }
 
+/* Convert a pseudovector pointer P to its underlying struct T pointer.
+   Verify that the struct is small, since cleanup_vector is called
+   only on small vector-like objects.  */
+
+#define PSEUDOVEC_STRUCT(p, t) \
+  verify_expr ((header_size + VECSIZE (struct t) * word_size \
+               <= VBLOCK_BYTES_MAX), \
+              (struct t *) (p))
+
 /* Release extra resources still in use by VECTOR, which may be any
-   vector-like object.  */
+   small vector-like object.  */
 
 static void
 cleanup_vector (struct Lisp_Vector *vector)
 {
   detect_suspicious_free (vector);
-  if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_FONT)
-      && ((vector->header.size & PSEUDOVECTOR_SIZE_MASK)
-         == FONT_OBJECT_MAX))
-    {
-      struct font_driver const *drv = ((struct font *) vector)->driver;
 
-      /* The font driver might sometimes be NULL, e.g. if Emacs was
-        interrupted before it had time to set it up.  */
-      if (drv)
+  if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_BIGNUM))
+    mpz_clear (PSEUDOVEC_STRUCT (vector, Lisp_Bignum)->value);
+  else if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_FINALIZER))
+    unchain_finalizer (PSEUDOVEC_STRUCT (vector, Lisp_Finalizer));
+  else if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_FONT))
+    {
+      if ((vector->header.size & PSEUDOVECTOR_SIZE_MASK) == FONT_OBJECT_MAX)
        {
-         /* Attempt to catch subtle bugs like Bug#16140.  */
-         eassert (valid_font_driver (drv));
-         drv->close ((struct font *) vector);
+         struct font *font = PSEUDOVEC_STRUCT (vector, font);
+         struct font_driver const *drv = font->driver;
+
+         /* The font driver might sometimes be NULL, e.g. if Emacs was
+            interrupted before it had time to set it up.  */
+         if (drv)
+           {
+             /* Attempt to catch subtle bugs like Bug#16140.  */
+             eassert (valid_font_driver (drv));
+             drv->close (font);
+           }
        }
     }
-
-  if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_THREAD))
-    finalize_one_thread ((struct thread_state *) vector);
+  else if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_THREAD))
+    finalize_one_thread (PSEUDOVEC_STRUCT (vector, thread_state));
   else if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_MUTEX))
-    finalize_one_mutex ((struct Lisp_Mutex *) vector);
+    finalize_one_mutex (PSEUDOVEC_STRUCT (vector, Lisp_Mutex));
   else if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_CONDVAR))
-    finalize_one_condvar ((struct Lisp_CondVar *) vector);
+    finalize_one_condvar (PSEUDOVEC_STRUCT (vector, Lisp_CondVar));
+  else if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_MARKER))
+    {
+      /* sweep_buffer should already have unchained this from its buffer.  */
+      eassert (! PSEUDOVEC_STRUCT (vector, Lisp_Marker)->buffer);
+    }
+#ifdef HAVE_MODULES
+  else if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_USER_PTR))
+    {
+      struct Lisp_User_Ptr *uptr = PSEUDOVEC_STRUCT (vector, Lisp_User_Ptr);
+      if (uptr->finalizer)
+       uptr->finalizer (uptr->p);
+    }
+#endif
 }
 
 /* Reclaim space used by unmarked vectors.  */
@@ -3439,8 +3462,8 @@ symbol or a type descriptor.  SLOTS is the number of 
non-type slots,
 each initialized to INIT.  */)
   (Lisp_Object type, Lisp_Object slots, Lisp_Object init)
 {
-  CHECK_NATNUM (slots);
-  EMACS_INT size = XFASTINT (slots) + 1;
+  CHECK_FIXNAT (slots);
+  EMACS_INT size = XFIXNAT (slots) + 1;
   struct Lisp_Vector *p = allocate_record (size);
   p->contents[0] = type;
   for (ptrdiff_t i = 1; i < size; i++)
@@ -3468,9 +3491,9 @@ DEFUN ("make-vector", Fmake_vector, Smake_vector, 2, 2, 0,
 See also the function `vector'.  */)
   (Lisp_Object length, Lisp_Object init)
 {
-  CHECK_NATNUM (length);
-  struct Lisp_Vector *p = allocate_vector (XFASTINT (length));
-  for (ptrdiff_t i = 0; i < XFASTINT (length); i++)
+  CHECK_FIXNAT (length);
+  struct Lisp_Vector *p = allocate_vector (XFIXNAT (length));
+  for (ptrdiff_t i = 0; i < XFIXNAT (length); i++)
     p->contents[i] = init;
   return make_lisp_ptr (p, Lisp_Vectorlike);
 }
@@ -3641,96 +3664,27 @@ Its value is void, and its function definition and 
property list are nil.  */)
 
 
 
-/***********************************************************************
-                      Marker (Misc) Allocation
- ***********************************************************************/
-
-/* Like union Lisp_Misc, but padded so that its size is a multiple of
-   the required alignment.  */
-
-union aligned_Lisp_Misc
-{
-  union Lisp_Misc m;
-  unsigned char c[(sizeof (union Lisp_Misc) + LISP_ALIGNMENT - 1)
-                 & -LISP_ALIGNMENT];
-};
-
-/* Allocation of markers and other objects that share that structure.
-   Works like allocation of conses.  */
-
-#define MARKER_BLOCK_SIZE \
-  ((1020 - sizeof (struct marker_block *)) / sizeof (union aligned_Lisp_Misc))
-
-struct marker_block
-{
-  /* Place `markers' first, to preserve alignment.  */
-  union aligned_Lisp_Misc markers[MARKER_BLOCK_SIZE];
-  struct marker_block *next;
-};
-
-static struct marker_block *marker_block;
-static int marker_block_index = MARKER_BLOCK_SIZE;
-
-static union Lisp_Misc *misc_free_list;
-
-/* Return a newly allocated Lisp_Misc object of specified TYPE.  */
-
-static Lisp_Object
-allocate_misc (enum Lisp_Misc_Type type)
-{
-  Lisp_Object val;
-
-  MALLOC_BLOCK_INPUT;
-
-  if (misc_free_list)
-    {
-      XSETMISC (val, misc_free_list);
-      misc_free_list = misc_free_list->u_free.chain;
-    }
-  else
-    {
-      if (marker_block_index == MARKER_BLOCK_SIZE)
-       {
-         struct marker_block *new = lisp_malloc (sizeof *new, MEM_TYPE_MISC);
-         new->next = marker_block;
-         marker_block = new;
-         marker_block_index = 0;
-         total_free_markers += MARKER_BLOCK_SIZE;
-       }
-      XSETMISC (val, &marker_block->markers[marker_block_index].m);
-      marker_block_index++;
-    }
-
-  MALLOC_UNBLOCK_INPUT;
-
-  --total_free_markers;
-  consing_since_gc += sizeof (union Lisp_Misc);
-  misc_objects_consed++;
-  XMISCANY (val)->type = type;
-  XMISCANY (val)->gcmarkbit = 0;
-  return val;
-}
-
 Lisp_Object
 make_misc_ptr (void *a)
 {
-  Lisp_Object val = allocate_misc (Lisp_Misc_Ptr);
-  XUNTAG (val, Lisp_Misc, struct Lisp_Misc_Ptr)->pointer = a;
-  return val;
+  struct Lisp_Misc_Ptr *p = ALLOCATE_PSEUDOVECTOR (struct Lisp_Misc_Ptr, 
pointer,
+                                                  PVEC_MISC_PTR);
+  p->pointer = a;
+  return make_lisp_ptr (p, Lisp_Vectorlike);
 }
 
-/* Return a Lisp_Misc_Overlay object with specified START, END and PLIST.  */
+/* Return a new overlay with specified START, END and PLIST.  */
 
 Lisp_Object
 build_overlay (Lisp_Object start, Lisp_Object end, Lisp_Object plist)
 {
-  register Lisp_Object overlay;
-
-  overlay = allocate_misc (Lisp_Misc_Overlay);
+  struct Lisp_Overlay *p = ALLOCATE_PSEUDOVECTOR (struct Lisp_Overlay, next,
+                                                 PVEC_OVERLAY);
+  Lisp_Object overlay = make_lisp_ptr (p, Lisp_Vectorlike);
   OVERLAY_START (overlay) = start;
   OVERLAY_END (overlay) = end;
   set_overlay_plist (overlay, plist);
-  XOVERLAY (overlay)->next = NULL;
+  p->next = NULL;
   return overlay;
 }
 
@@ -3738,18 +3692,15 @@ DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 
0,
        doc: /* Return a newly allocated marker which does not point at any 
place.  */)
   (void)
 {
-  register Lisp_Object val;
-  register struct Lisp_Marker *p;
-
-  val = allocate_misc (Lisp_Misc_Marker);
-  p = XMARKER (val);
+  struct Lisp_Marker *p = ALLOCATE_PSEUDOVECTOR (struct Lisp_Marker, buffer,
+                                                PVEC_MARKER);
   p->buffer = 0;
   p->bytepos = 0;
   p->charpos = 0;
   p->next = NULL;
   p->insertion_type = 0;
   p->need_adjustment = 0;
-  return val;
+  return make_lisp_ptr (p, Lisp_Vectorlike);
 }
 
 /* Return a newly allocated marker which points into BUF
@@ -3758,17 +3709,14 @@ DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 
0,
 Lisp_Object
 build_marker (struct buffer *buf, ptrdiff_t charpos, ptrdiff_t bytepos)
 {
-  Lisp_Object obj;
-  struct Lisp_Marker *m;
-
   /* No dead buffers here.  */
   eassert (BUFFER_LIVE_P (buf));
 
   /* Every character is at least one byte.  */
   eassert (charpos <= bytepos);
 
-  obj = allocate_misc (Lisp_Misc_Marker);
-  m = XMARKER (obj);
+  struct Lisp_Marker *m = ALLOCATE_PSEUDOVECTOR (struct Lisp_Marker, buffer,
+                                                PVEC_MARKER);
   m->buffer = buf;
   m->charpos = charpos;
   m->bytepos = bytepos;
@@ -3776,7 +3724,86 @@ build_marker (struct buffer *buf, ptrdiff_t charpos, 
ptrdiff_t bytepos)
   m->need_adjustment = 0;
   m->next = BUF_MARKERS (buf);
   BUF_MARKERS (buf) = m;
-  return obj;
+  return make_lisp_ptr (m, Lisp_Vectorlike);
+}
+
+
+
+Lisp_Object
+make_bignum_str (const char *num, int base)
+{
+  struct Lisp_Bignum *b = ALLOCATE_PSEUDOVECTOR (struct Lisp_Bignum, value,
+                                                PVEC_BIGNUM);
+  mpz_init (b->value);
+  int check = mpz_set_str (b->value, num, base);
+  eassert (check == 0);
+  return make_lisp_ptr (b, Lisp_Vectorlike);
+}
+
+/* Given an mpz_t, make a number.  This may return a bignum or a
+   fixnum depending on VALUE.  */
+
+Lisp_Object
+make_number (mpz_t value)
+{
+  if (mpz_fits_slong_p (value))
+    {
+      long l = mpz_get_si (value);
+      if (!FIXNUM_OVERFLOW_P (l))
+       return make_fixnum (l);
+    }
+
+  /* Check if fixnum can be larger than long.  */
+  if (sizeof (EMACS_INT) > sizeof (long))
+    {
+      size_t bits = mpz_sizeinbase (value, 2);
+      int sign = mpz_sgn (value);
+
+      if (bits < FIXNUM_BITS + (sign < 0))
+        {
+          EMACS_INT v = 0;
+          size_t limbs = mpz_size (value);
+          mp_size_t i;
+
+          for (i = 0; i < limbs; i++)
+            {
+              mp_limb_t limb = mpz_getlimbn (value, i);
+              v |= (EMACS_INT) ((EMACS_UINT) limb << (i * mp_bits_per_limb));
+            }
+          if (sign < 0)
+            v = -v;
+
+          if (!FIXNUM_OVERFLOW_P (v))
+           return make_fixnum (v);
+        }
+    }
+
+  struct Lisp_Bignum *b = ALLOCATE_PSEUDOVECTOR (struct Lisp_Bignum, value,
+                                                PVEC_BIGNUM);
+  /* We could mpz_init + mpz_swap here, to avoid a copy, but the
+     resulting API seemed possibly confusing.  */
+  mpz_init_set (b->value, value);
+
+  return make_lisp_ptr (b, Lisp_Vectorlike);
+}
+
+void
+mpz_set_intmax_slow (mpz_t result, intmax_t v)
+{
+  /* If long is larger then a faster path is taken.  */
+  eassert (sizeof (intmax_t) > sizeof (long));
+
+  bool complement = v < 0;
+  if (complement)
+    v = -1 - v;
+
+  /* COUNT = 1 means just a single word of the given size.  ORDER = -1
+     is arbitrary since there's only a single word.  ENDIAN = 0 means
+     use the native endian-ness.  NAILS = 0 means use the whole
+     word.  */
+  mpz_import (result, 1, -1, sizeof v, 0, 0, &v);
+  if (complement)
+    mpz_com (result, result);
 }
 
 
@@ -3795,8 +3822,8 @@ make_event_array (ptrdiff_t nargs, Lisp_Object *args)
     /* The things that fit in a string
        are characters that are in 0...127,
        after discarding the meta bit and all the bits above it.  */
-    if (!INTEGERP (args[i])
-       || (XINT (args[i]) & ~(-CHAR_META)) >= 0200)
+    if (!FIXNUMP (args[i])
+       || (XFIXNUM (args[i]) & ~(-CHAR_META)) >= 0200)
       return Fvector (nargs, args);
 
   /* Since the loop exited, we know that all the things in it are
@@ -3804,12 +3831,12 @@ make_event_array (ptrdiff_t nargs, Lisp_Object *args)
   {
     Lisp_Object result;
 
-    result = Fmake_string (make_number (nargs), make_number (0), Qnil);
+    result = Fmake_string (make_fixnum (nargs), make_fixnum (0), Qnil);
     for (i = 0; i < nargs; i++)
       {
-       SSET (result, i, XINT (args[i]));
+       SSET (result, i, XFIXNUM (args[i]));
        /* Move the meta bit to the right place for a string char.  */
-       if (XINT (args[i]) & CHAR_META)
+       if (XFIXNUM (args[i]) & CHAR_META)
          SSET (result, i, SREF (result, i) | 0x80);
       }
 
@@ -3822,14 +3849,11 @@ make_event_array (ptrdiff_t nargs, Lisp_Object *args)
 Lisp_Object
 make_user_ptr (void (*finalizer) (void *), void *p)
 {
-  Lisp_Object obj;
-  struct Lisp_User_Ptr *uptr;
-
-  obj = allocate_misc (Lisp_Misc_User_Ptr);
-  uptr = XUSER_PTR (obj);
+  struct Lisp_User_Ptr *uptr = ALLOCATE_PSEUDOVECTOR (struct Lisp_User_Ptr,
+                                                     finalizer, PVEC_USER_PTR);
   uptr->finalizer = finalizer;
   uptr->p = p;
-  return obj;
+  return make_lisp_ptr (uptr, Lisp_Vectorlike);
 }
 #endif
 
@@ -3872,7 +3896,7 @@ mark_finalizer_list (struct Lisp_Finalizer *head)
        finalizer != head;
        finalizer = finalizer->next)
     {
-      finalizer->base.gcmarkbit = true;
+      VECTOR_MARK (finalizer);
       mark_object (finalizer->function);
     }
 }
@@ -3889,7 +3913,7 @@ queue_doomed_finalizers (struct Lisp_Finalizer *dest,
   while (finalizer != src)
     {
       struct Lisp_Finalizer *next = finalizer->next;
-      if (!finalizer->base.gcmarkbit && !NILP (finalizer->function))
+      if (!VECTOR_MARKED_P (finalizer) && !NILP (finalizer->function))
         {
           unchain_finalizer (finalizer);
           finalizer_insert (dest, finalizer);
@@ -3925,7 +3949,6 @@ run_finalizers (struct Lisp_Finalizer *finalizers)
   while (finalizers->next != finalizers)
     {
       finalizer = finalizers->next;
-      eassert (finalizer->base.type == Lisp_Misc_Finalizer);
       unchain_finalizer (finalizer);
       function = finalizer->function;
       if (!NILP (function))
@@ -3945,12 +3968,12 @@ count as reachable for the purpose of deciding whether 
to run
 FUNCTION.  FUNCTION will be run once per finalizer object.  */)
   (Lisp_Object function)
 {
-  Lisp_Object val = allocate_misc (Lisp_Misc_Finalizer);
-  struct Lisp_Finalizer *finalizer = XFINALIZER (val);
+  struct Lisp_Finalizer *finalizer
+    = ALLOCATE_PSEUDOVECTOR (struct Lisp_Finalizer, prev, PVEC_FINALIZER);
   finalizer->function = function;
   finalizer->prev = finalizer->next = NULL;
   finalizer_insert (&finalizers, finalizer);
-  return val;
+  return make_lisp_ptr (finalizer, Lisp_Vectorlike);
 }
 
 
@@ -4571,41 +4594,6 @@ live_float_p (struct mem_node *m, void *p)
     return 0;
 }
 
-
-/* If P is a pointer to a live Lisp Misc on the heap, return the object.
-   Otherwise, return nil.  M is a pointer to the mem_block for P.  */
-
-static Lisp_Object
-live_misc_holding (struct mem_node *m, void *p)
-{
-  if (m->type == MEM_TYPE_MISC)
-    {
-      struct marker_block *b = m->start;
-      char *cp = p;
-      ptrdiff_t offset = cp - (char *) &b->markers[0];
-
-      /* P must point into a Lisp_Misc, not be
-        one of the unused cells in the current misc block,
-        and not be on the free-list.  */
-      if (0 <= offset && offset < MARKER_BLOCK_SIZE * sizeof b->markers[0]
-         && (b != marker_block
-             || offset / sizeof b->markers[0] < marker_block_index))
-       {
-         cp = ptr_bounds_copy (cp, b);
-         union Lisp_Misc *s = p = cp -= offset % sizeof b->markers[0];
-         if (s->u_any.type != Lisp_Misc_Free)
-           return make_lisp_ptr (s, Lisp_Misc);
-       }
-    }
-  return Qnil;
-}
-
-static bool
-live_misc_p (struct mem_node *m, void *p)
-{
-  return !NILP (live_misc_holding (m, p));
-}
-
 /* If P is a pointer to a live vector-like object, return the object.
    Otherwise, return nil.
    M is a pointer to the mem_block for P.  */
@@ -4691,7 +4679,7 @@ mark_maybe_object (Lisp_Object obj)
     VALGRIND_MAKE_MEM_DEFINED (&obj, sizeof (obj));
 #endif
 
-  if (INTEGERP (obj))
+  if (FIXNUMP (obj))
     return;
 
   void *po = XPNTR (obj);
@@ -4724,10 +4712,6 @@ mark_maybe_object (Lisp_Object obj)
                    || EQ (obj, live_buffer_holding (m, po)));
          break;
 
-       case Lisp_Misc:
-         mark_p = EQ (obj, live_misc_holding (m, po));
-         break;
-
        default:
          break;
        }
@@ -4809,10 +4793,6 @@ mark_maybe_pointer (void *p)
          obj = live_string_holding (m, p);
          break;
 
-       case MEM_TYPE_MISC:
-         obj = live_misc_holding (m, p);
-         break;
-
        case MEM_TYPE_SYMBOL:
          obj = live_symbol_holding (m, p);
          break;
@@ -5171,7 +5151,7 @@ valid_pointer_p (void *p)
 int
 valid_lisp_object_p (Lisp_Object obj)
 {
-  if (INTEGERP (obj))
+  if (FIXNUMP (obj))
     return 1;
 
   void *p = XPNTR (obj);
@@ -5213,9 +5193,6 @@ valid_lisp_object_p (Lisp_Object obj)
     case MEM_TYPE_STRING:
       return live_string_p (m, p);
 
-    case MEM_TYPE_MISC:
-      return live_misc_p (m, p);
-
     case MEM_TYPE_SYMBOL:
       return live_symbol_p (m, p);
 
@@ -5432,6 +5409,32 @@ make_pure_float (double num)
   return new;
 }
 
+/* Value is a bignum object with value VALUE allocated from pure
+   space.  */
+
+static Lisp_Object
+make_pure_bignum (struct Lisp_Bignum *value)
+{
+  size_t i, nlimbs = mpz_size (value->value);
+  size_t nbytes = nlimbs * sizeof (mp_limb_t);
+  mp_limb_t *pure_limbs;
+  mp_size_t new_size;
+
+  struct Lisp_Bignum *b = pure_alloc (sizeof *b, Lisp_Vectorlike);
+  XSETPVECTYPESIZE (b, PVEC_BIGNUM, 0, VECSIZE (struct Lisp_Bignum));
+
+  pure_limbs = pure_alloc (nbytes, -1);
+  for (i = 0; i < nlimbs; ++i)
+    pure_limbs[i] = mpz_getlimbn (value->value, i);
+
+  new_size = nlimbs;
+  if (mpz_sgn (value->value) < 0)
+    new_size = -new_size;
+
+  mpz_roinit_n (b->value, pure_limbs, new_size);
+
+  return make_lisp_ptr (b, Lisp_Vectorlike);
+}
 
 /* Return a vector with room for LEN Lisp_Objects allocated from
    pure space.  */
@@ -5504,7 +5507,7 @@ static struct pinned_object
 static Lisp_Object
 purecopy (Lisp_Object obj)
 {
-  if (INTEGERP (obj)
+  if (FIXNUMP (obj)
       || (! SYMBOLP (obj) && PURE_P (XPNTR (obj)))
       || SUBRP (obj))
     return obj;    /* Already pure.  */
@@ -5573,6 +5576,8 @@ purecopy (Lisp_Object obj)
       /* Don't hash-cons it.  */
       return obj;
     }
+  else if (BIGNUMP (obj))
+    obj = make_pure_bignum (XBIGNUM (obj));
   else
     {
       AUTO_STRING (fmt, "Don't know how to purify: %S");
@@ -5614,7 +5619,7 @@ inhibit_garbage_collection (void)
 {
   ptrdiff_t count = SPECPDL_INDEX ();
 
-  specbind (Qgc_cons_threshold, make_number (MOST_POSITIVE_FIXNUM));
+  specbind (Qgc_cons_threshold, make_fixnum (MOST_POSITIVE_FIXNUM));
   return count;
 }
 
@@ -5624,7 +5629,7 @@ inhibit_garbage_collection (void)
 static Lisp_Object
 bounded_number (EMACS_INT number)
 {
-  return make_number (min (MOST_POSITIVE_FIXNUM, number));
+  return make_fixnum (min (MOST_POSITIVE_FIXNUM, number));
 }
 
 /* Calculate total bytes of live objects.  */
@@ -5635,7 +5640,6 @@ total_bytes_of_live_objects (void)
   size_t tot = 0;
   tot += total_conses  * sizeof (struct Lisp_Cons);
   tot += total_symbols * sizeof (struct Lisp_Symbol);
-  tot += total_markers * sizeof (union Lisp_Misc);
   tot += total_string_bytes;
   tot += total_vector_slots * word_size;
   tot += total_floats  * sizeof (struct Lisp_Float);
@@ -5756,7 +5760,7 @@ compact_undo_list (Lisp_Object list)
     {
       if (CONSP (XCAR (tail))
          && MARKERP (XCAR (XCAR (tail)))
-         && !XMARKER (XCAR (XCAR (tail)))->gcmarkbit)
+         && !VECTOR_MARKED_P (XMARKER (XCAR (XCAR (tail)))))
        *prev = XCDR (tail);
       else
        prev = xcdr_addr (tail);
@@ -5977,37 +5981,34 @@ garbage_collect_1 (void *end)
   unbind_to (count, Qnil);
 
   Lisp_Object total[] = {
-    list4 (Qconses, make_number (sizeof (struct Lisp_Cons)),
+    list4 (Qconses, make_fixnum (sizeof (struct Lisp_Cons)),
           bounded_number (total_conses),
           bounded_number (total_free_conses)),
-    list4 (Qsymbols, make_number (sizeof (struct Lisp_Symbol)),
+    list4 (Qsymbols, make_fixnum (sizeof (struct Lisp_Symbol)),
           bounded_number (total_symbols),
           bounded_number (total_free_symbols)),
-    list4 (Qmiscs, make_number (sizeof (union Lisp_Misc)),
-          bounded_number (total_markers),
-          bounded_number (total_free_markers)),
-    list4 (Qstrings, make_number (sizeof (struct Lisp_String)),
+    list4 (Qstrings, make_fixnum (sizeof (struct Lisp_String)),
           bounded_number (total_strings),
           bounded_number (total_free_strings)),
-    list3 (Qstring_bytes, make_number (1),
+    list3 (Qstring_bytes, make_fixnum (1),
           bounded_number (total_string_bytes)),
     list3 (Qvectors,
-          make_number (header_size + sizeof (Lisp_Object)),
+          make_fixnum (header_size + sizeof (Lisp_Object)),
           bounded_number (total_vectors)),
-    list4 (Qvector_slots, make_number (word_size),
+    list4 (Qvector_slots, make_fixnum (word_size),
           bounded_number (total_vector_slots),
           bounded_number (total_free_vector_slots)),
-    list4 (Qfloats, make_number (sizeof (struct Lisp_Float)),
+    list4 (Qfloats, make_fixnum (sizeof (struct Lisp_Float)),
           bounded_number (total_floats),
           bounded_number (total_free_floats)),
-    list4 (Qintervals, make_number (sizeof (struct interval)),
+    list4 (Qintervals, make_fixnum (sizeof (struct interval)),
           bounded_number (total_intervals),
           bounded_number (total_free_intervals)),
-    list3 (Qbuffers, make_number (sizeof (struct buffer)),
+    list3 (Qbuffers, make_fixnum (sizeof (struct buffer)),
           bounded_number (total_buffers)),
 
 #ifdef DOUG_LEA_MALLOC
-    list4 (Qheap, make_number (1024),
+    list4 (Qheap, make_fixnum (1024),
           bounded_number ((mallinfo ().uordblks + 1023) >> 10),
           bounded_number ((mallinfo ().fordblks + 1023) >> 10)),
 #endif
@@ -6142,7 +6143,7 @@ mark_char_table (struct Lisp_Vector *ptr, enum pvec_type 
pvectype)
     {
       Lisp_Object val = ptr->contents[i];
 
-      if (INTEGERP (val) || (SYMBOLP (val) && XSYMBOL (val)->u.s.gcmarkbit))
+      if (FIXNUMP (val) || (SYMBOLP (val) && XSYMBOL (val)->u.s.gcmarkbit))
        continue;
       if (SUB_CHAR_TABLE_P (val))
        {
@@ -6172,12 +6173,12 @@ mark_compiled (struct Lisp_Vector *ptr)
 static void
 mark_overlay (struct Lisp_Overlay *ptr)
 {
-  for (; ptr && !ptr->gcmarkbit; ptr = ptr->next)
+  for (; ptr && !VECTOR_MARKED_P (ptr); ptr = ptr->next)
     {
-      ptr->gcmarkbit = 1;
+      VECTOR_MARK (ptr);
       /* These two are always markers and can be marked fast.  */
-      XMARKER (ptr->start)->gcmarkbit = 1;
-      XMARKER (ptr->end)->gcmarkbit = 1;
+      VECTOR_MARK (XMARKER (ptr->start));
+      VECTOR_MARK (XMARKER (ptr->end));
       mark_object (ptr->plist);
     }
 }
@@ -6478,9 +6479,8 @@ mark_object (Lisp_Object arg)
            mark_char_table (ptr, (enum pvec_type) pvectype);
            break;
 
-         case PVEC_BOOL_VECTOR:
-           /* No Lisp_Objects to mark in a bool vector.  */
-           VECTOR_MARK (ptr);
+         case PVEC_OVERLAY:
+           mark_overlay (XOVERLAY (obj));
            break;
 
          case PVEC_SUBR:
@@ -6490,6 +6490,8 @@ mark_object (Lisp_Object arg)
            emacs_abort ();
 
          default:
+           /* A regular vector, or a pseudovector needing no special
+              treatment.  */
            mark_vectorlike (ptr);
          }
       }
@@ -6538,48 +6540,9 @@ mark_object (Lisp_Object arg)
       }
       break;
 
-    case Lisp_Misc:
-      CHECK_ALLOCATED_AND_LIVE (live_misc_p);
-
-      if (XMISCANY (obj)->gcmarkbit)
-       break;
-
-      switch (XMISCTYPE (obj))
-       {
-       case Lisp_Misc_Marker:
-         /* DO NOT mark thru the marker's chain.
-            The buffer's markers chain does not preserve markers from gc;
-            instead, markers are removed from the chain when freed by gc.  */
-         XMISCANY (obj)->gcmarkbit = 1;
-         break;
-
-       case Lisp_Misc_Ptr:
-         XMISCANY (obj)->gcmarkbit = true;
-         break;
-
-       case Lisp_Misc_Overlay:
-         mark_overlay (XOVERLAY (obj));
-          break;
-
-        case Lisp_Misc_Finalizer:
-          XMISCANY (obj)->gcmarkbit = true;
-          mark_object (XFINALIZER (obj)->function);
-          break;
-
-#ifdef HAVE_MODULES
-       case Lisp_Misc_User_Ptr:
-         XMISCANY (obj)->gcmarkbit = true;
-         break;
-#endif
-
-       default:
-         emacs_abort ();
-       }
-      break;
-
     case Lisp_Cons:
       {
-       register struct Lisp_Cons *ptr = XCONS (obj);
+       struct Lisp_Cons *ptr = XCONS (obj);
        if (CONS_MARKED_P (ptr))
          break;
        CHECK_ALLOCATED_AND_LIVE (live_cons_p);
@@ -6656,10 +6619,6 @@ survives_gc_p (Lisp_Object obj)
       survives_p = XSYMBOL (obj)->u.s.gcmarkbit;
       break;
 
-    case Lisp_Misc:
-      survives_p = XMISCANY (obj)->gcmarkbit;
-      break;
-
     case Lisp_String:
       survives_p = STRING_MARKED_P (XSTRING (obj));
       break;
@@ -6936,79 +6895,6 @@ sweep_symbols (void)
   total_free_symbols = num_free;
 }
 
-NO_INLINE /* For better stack traces.  */
-static void
-sweep_misc (void)
-{
-  register struct marker_block *mblk;
-  struct marker_block **mprev = &marker_block;
-  register int lim = marker_block_index;
-  EMACS_INT num_free = 0, num_used = 0;
-
-  /* Put all unmarked misc's on free list.  For a marker, first
-     unchain it from the buffer it points into.  */
-
-  misc_free_list = 0;
-
-  for (mblk = marker_block; mblk; mblk = *mprev)
-    {
-      register int i;
-      int this_free = 0;
-
-      for (i = 0; i < lim; i++)
-        {
-          if (!mblk->markers[i].m.u_any.gcmarkbit)
-            {
-              if (mblk->markers[i].m.u_any.type == Lisp_Misc_Marker)
-                /* Make sure markers have been unchained from their buffer
-                   in sweep_buffer before we collect them.  */
-                eassert (!mblk->markers[i].m.u_marker.buffer);
-              else if (mblk->markers[i].m.u_any.type == Lisp_Misc_Finalizer)
-                unchain_finalizer (&mblk->markers[i].m.u_finalizer);
-#ifdef HAVE_MODULES
-             else if (mblk->markers[i].m.u_any.type == Lisp_Misc_User_Ptr)
-               {
-                 struct Lisp_User_Ptr *uptr = &mblk->markers[i].m.u_user_ptr;
-                 if (uptr->finalizer)
-                   uptr->finalizer (uptr->p);
-               }
-#endif
-              /* Set the type of the freed object to Lisp_Misc_Free.
-                 We could leave the type alone, since nobody checks it,
-                 but this might catch bugs faster.  */
-              mblk->markers[i].m.u_marker.type = Lisp_Misc_Free;
-              mblk->markers[i].m.u_free.chain = misc_free_list;
-              misc_free_list = &mblk->markers[i].m;
-              this_free++;
-            }
-          else
-            {
-              num_used++;
-              mblk->markers[i].m.u_any.gcmarkbit = 0;
-            }
-        }
-      lim = MARKER_BLOCK_SIZE;
-      /* If this block contains only free markers and we have already
-         seen more than two blocks worth of free markers then deallocate
-         this block.  */
-      if (this_free == MARKER_BLOCK_SIZE && num_free > MARKER_BLOCK_SIZE)
-        {
-          *mprev = mblk->next;
-          /* Unhook from the free list.  */
-          misc_free_list = mblk->markers[0].m.u_free.chain;
-          lisp_free (mblk);
-        }
-      else
-        {
-          num_free += this_free;
-          mprev = &mblk->next;
-        }
-    }
-
-  total_markers = num_used;
-  total_free_markers = num_free;
-}
-
 /* Remove BUFFER's markers that are due to be swept.  This is needed since
    we treat BUF_MARKERS and markers's `next' field as weak pointers.  */
 static void
@@ -7017,7 +6903,7 @@ unchain_dead_markers (struct buffer *buffer)
   struct Lisp_Marker *this, **prev = &BUF_MARKERS (buffer);
 
   while ((this = *prev))
-    if (this->gcmarkbit)
+    if (VECTOR_MARKED_P (this))
       prev = &this->next;
     else
       {
@@ -7065,7 +6951,6 @@ gc_sweep (void)
   sweep_intervals ();
   sweep_symbols ();
   sweep_buffers ();
-  sweep_misc ();
   sweep_vectors ();
   check_string_bytes (!noninteractive);
 }
@@ -7126,11 +7011,10 @@ Each of these counters increments for a certain kind of 
object.
 The counters wrap around from the largest positive integer to zero.
 Garbage collection does not decrease them.
 The elements of the value are as follows:
-  (CONSES FLOATS VECTOR-CELLS SYMBOLS STRING-CHARS MISCS INTERVALS STRINGS)
+  (CONSES FLOATS VECTOR-CELLS SYMBOLS STRING-CHARS INTERVALS STRINGS)
 All are in units of 1 = one object consed
 except for VECTOR-CELLS and STRING-CHARS, which count the total length of
 objects consed.
-MISCS include overlays, markers, and some internal types.
 Frames, windows, buffers, and subprocesses count as vectors
   (but the contents of a buffer's text do not count here).  */)
   (void)
@@ -7141,7 +7025,6 @@ Frames, windows, buffers, and subprocesses count as 
vectors
                bounded_number (vector_cells_consed),
                bounded_number (symbols_consed),
                bounded_number (string_chars_consed),
-               bounded_number (misc_objects_consed),
                bounded_number (intervals_consed),
                bounded_number (strings_consed));
 }
@@ -7400,11 +7283,6 @@ If this portion is smaller than `gc-cons-threshold', 
this is ignored.  */);
   DEFVAR_INT ("string-chars-consed", string_chars_consed,
              doc: /* Number of string characters that have been consed so far. 
 */);
 
-  DEFVAR_INT ("misc-objects-consed", misc_objects_consed,
-             doc: /* Number of miscellaneous objects that have been consed so 
far.
-These include markers and overlays, plus certain objects not visible
-to users.  */);
-
   DEFVAR_INT ("intervals-consed", intervals_consed,
              doc: /* Number of intervals that have been consed so far.  */);
 
@@ -7440,7 +7318,6 @@ do hash-consing of the objects allocated to pure space.  
*/);
 
   DEFSYM (Qconses, "conses");
   DEFSYM (Qsymbols, "symbols");
-  DEFSYM (Qmiscs, "miscs");
   DEFSYM (Qstrings, "strings");
   DEFSYM (Qvectors, "vectors");
   DEFSYM (Qfloats, "floats");
diff --git a/src/bidi.c b/src/bidi.c
index 9bc8dbe..a53a229 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -280,7 +280,7 @@ bidi_get_type (int ch, bidi_dir_t override)
   if (ch < 0 || ch > MAX_CHAR)
     emacs_abort ();
 
-  default_type = (bidi_type_t) XINT (CHAR_TABLE_REF (bidi_type_table, ch));
+  default_type = (bidi_type_t) XFIXNUM (CHAR_TABLE_REF (bidi_type_table, ch));
   /* Every valid character code, even those that are unassigned by the
      UCD, have some bidi-class property, according to
      DerivedBidiClass.txt file.  Therefore, if we ever get UNKNOWN_BT
@@ -379,15 +379,15 @@ bidi_mirror_char (int c)
     emacs_abort ();
 
   val = CHAR_TABLE_REF (bidi_mirror_table, c);
-  if (INTEGERP (val))
+  if (FIXNUMP (val))
     {
       int v;
 
       /* When debugging, check before assigning to V, so that the check
         isn't broken by undefined behavior due to int overflow.  */
-      eassert (CHAR_VALID_P (XINT (val)));
+      eassert (CHAR_VALID_P (XFIXNUM (val)));
 
-      v = XINT (val);
+      v = XFIXNUM (val);
 
       /* Minimal test we must do in optimized builds, to prevent weird
         crashes further down the road.  */
@@ -409,7 +409,7 @@ bidi_paired_bracket_type (int c)
   if (c < 0 || c > MAX_CHAR)
     emacs_abort ();
 
-  return (bidi_bracket_type_t) XINT (CHAR_TABLE_REF (bidi_brackets_table, c));
+  return (bidi_bracket_type_t) XFIXNUM (CHAR_TABLE_REF (bidi_brackets_table, 
c));
 }
 
 /* Determine the start-of-sequence (sos) directional type given the two
@@ -1805,7 +1805,7 @@ bidi_explicit_dir_char (int ch)
       eassert (ch == BIDI_EOB);
       return false;
     }
-  ch_type = (bidi_type_t) XINT (CHAR_TABLE_REF (bidi_type_table, ch));
+  ch_type = (bidi_type_t) XFIXNUM (CHAR_TABLE_REF (bidi_type_table, ch));
   return (ch_type == LRE || ch_type == LRO
          || ch_type == RLE || ch_type == RLO
          || ch_type == PDF);
diff --git a/src/buffer.c b/src/buffer.c
index 244c185..878844d 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -849,7 +849,7 @@ CLONE nil means the indirect buffer's state is reset to 
default values.  */)
       clone_per_buffer_values (b->base_buffer, b);
       bset_filename (b, Qnil);
       bset_file_truename (b, Qnil);
-      bset_display_count (b, make_number (0));
+      bset_display_count (b, make_fixnum (0));
       bset_backed_up (b, Qnil);
       bset_auto_save_file_name (b, Qnil);
       set_buffer_internal_1 (b);
@@ -939,7 +939,7 @@ reset_buffer (register struct buffer *b)
   bset_file_format (b, Qnil);
   bset_auto_save_file_format (b, Qt);
   bset_last_selected_window (b, Qnil);
-  bset_display_count (b, make_number (0));
+  bset_display_count (b, make_fixnum (0));
   bset_display_time (b, Qnil);
   bset_enable_multibyte_characters
     (b, BVAR (&buffer_defaults, enable_multibyte_characters));
@@ -1102,8 +1102,8 @@ is first appended to NAME, to speed up finding a 
non-existent buffer.  */)
     {
       char number[sizeof "-999999"];
 
-      /* Use XINT instead of XFASTINT to work around GCC bug 80776.  */
-      int i = XINT (Frandom (make_number (1000000)));
+      /* Use XFIXNUM instead of XFIXNAT to work around GCC bug 80776.  */
+      int i = XFIXNUM (Frandom (make_fixnum (1000000)));
       eassume (0 <= i && i < 1000000);
 
       AUTO_STRING_WITH_LEN (lnumber, number, sprintf (number, "-%d", i));
@@ -1421,7 +1421,7 @@ text in that buffer is changed.  It wraps around 
occasionally.
 No argument or nil as argument means use current buffer as BUFFER.  */)
   (register Lisp_Object buffer)
 {
-  return make_number (BUF_MODIFF (decode_buffer (buffer)));
+  return make_fixnum (BUF_MODIFF (decode_buffer (buffer)));
 }
 
 DEFUN ("buffer-chars-modified-tick", Fbuffer_chars_modified_tick,
@@ -1436,7 +1436,7 @@ between these calls.  No argument or nil as argument 
means use current
 buffer as BUFFER.  */)
   (register Lisp_Object buffer)
 {
-  return make_number (BUF_CHARS_MODIFF (decode_buffer (buffer)));
+  return make_fixnum (BUF_CHARS_MODIFF (decode_buffer (buffer)));
 }
 
 DEFUN ("rename-buffer", Frename_buffer, Srename_buffer, 1, 2,
@@ -2203,7 +2203,7 @@ If the text under POSITION (which defaults to point) has 
the
   if (NILP (position))
     XSETFASTINT (position, PT);
   else
-    CHECK_NUMBER (position);
+    CHECK_FIXNUM (position);
 
   if (!NILP (BVAR (current_buffer, read_only))
       && NILP (Vinhibit_read_only)
@@ -2233,16 +2233,16 @@ so the buffer is truly empty after this.  */)
 void
 validate_region (register Lisp_Object *b, register Lisp_Object *e)
 {
-  CHECK_NUMBER_COERCE_MARKER (*b);
-  CHECK_NUMBER_COERCE_MARKER (*e);
+  CHECK_FIXNUM_COERCE_MARKER (*b);
+  CHECK_FIXNUM_COERCE_MARKER (*e);
 
-  if (XINT (*b) > XINT (*e))
+  if (XFIXNUM (*b) > XFIXNUM (*e))
     {
       Lisp_Object tem;
       tem = *b;  *b = *e;  *e = tem;
     }
 
-  if (! (BEGV <= XINT (*b) && XINT (*e) <= ZV))
+  if (! (BEGV <= XFIXNUM (*b) && XFIXNUM (*e) <= ZV))
     args_out_of_range_3 (Fcurrent_buffer (), *b, *e);
 }
 
@@ -2409,7 +2409,7 @@ results, see Info node `(elisp)Swapping Text'.  */)
            && (EQ (XWINDOW (w)->contents, buf1)
                || EQ (XWINDOW (w)->contents, buf2)))
          Fset_marker (XWINDOW (w)->pointm,
-                      make_number
+                      make_fixnum
                       (BUF_BEGV (XBUFFER (XWINDOW (w)->contents))),
                       XWINDOW (w)->contents);
        /* Blindly copied from pointm part.  */
@@ -2417,14 +2417,14 @@ results, see Info node `(elisp)Swapping Text'.  */)
            && (EQ (XWINDOW (w)->contents, buf1)
                || EQ (XWINDOW (w)->contents, buf2)))
          Fset_marker (XWINDOW (w)->old_pointm,
-                      make_number
+                      make_fixnum
                       (BUF_BEGV (XBUFFER (XWINDOW (w)->contents))),
                       XWINDOW (w)->contents);
        if (MARKERP (XWINDOW (w)->start)
            && (EQ (XWINDOW (w)->contents, buf1)
                || EQ (XWINDOW (w)->contents, buf2)))
          Fset_marker (XWINDOW (w)->start,
-                      make_number
+                      make_fixnum
                       (XBUFFER (XWINDOW (w)->contents)->last_window_start),
                       XWINDOW (w)->contents);
        w = Fnext_window (w, Qt, Qt);
@@ -2547,7 +2547,7 @@ current buffer is cleared.  */)
            }
        }
       if (narrowed)
-       Fnarrow_to_region (make_number (begv), make_number (zv));
+       Fnarrow_to_region (make_fixnum (begv), make_fixnum (zv));
     }
   else
     {
@@ -2628,7 +2628,7 @@ current buffer is cleared.  */)
        TEMP_SET_PT (pt);
 
       if (narrowed)
-       Fnarrow_to_region (make_number (begv), make_number (zv));
+       Fnarrow_to_region (make_fixnum (begv), make_fixnum (zv));
 
       /* Do this first, so that chars_in_text asks the right question.
         set_intervals_multibyte needs it too.  */
@@ -2789,8 +2789,6 @@ overlays_at (EMACS_INT pos, bool extend, Lisp_Object 
**vec_ptr,
             ptrdiff_t *len_ptr,
             ptrdiff_t *next_ptr, ptrdiff_t *prev_ptr, bool change_req)
 {
-  Lisp_Object overlay, start, end;
-  struct Lisp_Overlay *tail;
   ptrdiff_t idx = 0;
   ptrdiff_t len = *len_ptr;
   Lisp_Object *vec = *vec_ptr;
@@ -2798,22 +2796,20 @@ overlays_at (EMACS_INT pos, bool extend, Lisp_Object 
**vec_ptr,
   ptrdiff_t prev = BEGV;
   bool inhibit_storing = 0;
 
-  for (tail = current_buffer->overlays_before; tail; tail = tail->next)
+  for (struct Lisp_Overlay *tail = current_buffer->overlays_before;
+       tail; tail = tail->next)
     {
-      ptrdiff_t startpos, endpos;
-
-      XSETMISC (overlay, tail);
-
-      start = OVERLAY_START (overlay);
-      end = OVERLAY_END (overlay);
-      endpos = OVERLAY_POSITION (end);
+      Lisp_Object overlay = make_lisp_ptr (tail, Lisp_Vectorlike);
+      Lisp_Object start = OVERLAY_START (overlay);
+      Lisp_Object end = OVERLAY_END (overlay);
+      ptrdiff_t endpos = OVERLAY_POSITION (end);
       if (endpos < pos)
        {
          if (prev < endpos)
            prev = endpos;
          break;
        }
-      startpos = OVERLAY_POSITION (start);
+      ptrdiff_t startpos = OVERLAY_POSITION (start);
       /* This one ends at or after POS
         so its start counts for PREV_PTR if it's before POS.  */
       if (prev < startpos && startpos < pos)
@@ -2846,22 +2842,20 @@ overlays_at (EMACS_INT pos, bool extend, Lisp_Object 
**vec_ptr,
        next = startpos;
     }
 
-  for (tail = current_buffer->overlays_after; tail; tail = tail->next)
+  for (struct Lisp_Overlay *tail = current_buffer->overlays_after;
+       tail; tail = tail->next)
     {
-      ptrdiff_t startpos, endpos;
-
-      XSETMISC (overlay, tail);
-
-      start = OVERLAY_START (overlay);
-      end = OVERLAY_END (overlay);
-      startpos = OVERLAY_POSITION (start);
+      Lisp_Object overlay = make_lisp_ptr (tail, Lisp_Vectorlike);
+      Lisp_Object start = OVERLAY_START (overlay);
+      Lisp_Object end = OVERLAY_END (overlay);
+      ptrdiff_t startpos = OVERLAY_POSITION (start);
       if (pos < startpos)
        {
          if (startpos < next)
            next = startpos;
          break;
        }
-      endpos = OVERLAY_POSITION (end);
+      ptrdiff_t endpos = OVERLAY_POSITION (end);
       if (pos < endpos)
        {
          if (idx == len)
@@ -2923,8 +2917,6 @@ overlays_in (EMACS_INT beg, EMACS_INT end, bool extend,
             Lisp_Object **vec_ptr, ptrdiff_t *len_ptr,
             ptrdiff_t *next_ptr, ptrdiff_t *prev_ptr)
 {
-  Lisp_Object overlay, ostart, oend;
-  struct Lisp_Overlay *tail;
   ptrdiff_t idx = 0;
   ptrdiff_t len = *len_ptr;
   Lisp_Object *vec = *vec_ptr;
@@ -2933,22 +2925,20 @@ overlays_in (EMACS_INT beg, EMACS_INT end, bool extend,
   bool inhibit_storing = 0;
   bool end_is_Z = end == Z;
 
-  for (tail = current_buffer->overlays_before; tail; tail = tail->next)
+  for (struct Lisp_Overlay *tail = current_buffer->overlays_before;
+       tail; tail = tail->next)
     {
-      ptrdiff_t startpos, endpos;
-
-      XSETMISC (overlay, tail);
-
-      ostart = OVERLAY_START (overlay);
-      oend = OVERLAY_END (overlay);
-      endpos = OVERLAY_POSITION (oend);
+      Lisp_Object overlay = make_lisp_ptr (tail, Lisp_Vectorlike);
+      Lisp_Object ostart = OVERLAY_START (overlay);
+      Lisp_Object oend = OVERLAY_END (overlay);
+      ptrdiff_t endpos = OVERLAY_POSITION (oend);
       if (endpos < beg)
        {
          if (prev < endpos)
            prev = endpos;
          break;
        }
-      startpos = OVERLAY_POSITION (ostart);
+      ptrdiff_t startpos = OVERLAY_POSITION (ostart);
       /* Count an interval if it overlaps the range, is empty at the
         start of the range, or is empty at END provided END denotes the
         end of the buffer.  */
@@ -2980,22 +2970,20 @@ overlays_in (EMACS_INT beg, EMACS_INT end, bool extend,
        next = startpos;
     }
 
-  for (tail = current_buffer->overlays_after; tail; tail = tail->next)
+  for (struct Lisp_Overlay *tail = current_buffer->overlays_after;
+       tail; tail = tail->next)
     {
-      ptrdiff_t startpos, endpos;
-
-      XSETMISC (overlay, tail);
-
-      ostart = OVERLAY_START (overlay);
-      oend = OVERLAY_END (overlay);
-      startpos = OVERLAY_POSITION (ostart);
+      Lisp_Object overlay = make_lisp_ptr (tail, Lisp_Vectorlike);
+      Lisp_Object ostart = OVERLAY_START (overlay);
+      Lisp_Object oend = OVERLAY_END (overlay);
+      ptrdiff_t startpos = OVERLAY_POSITION (ostart);
       if (end < startpos)
        {
          if (startpos < next)
            next = startpos;
          break;
        }
-      endpos = OVERLAY_POSITION (oend);
+      ptrdiff_t endpos = OVERLAY_POSITION (oend);
       /* Count an interval if it overlaps the range, is empty at the
         start of the range, or is empty at END provided END denotes the
         end of the buffer.  */
@@ -3097,31 +3085,26 @@ disable_line_numbers_overlay_at_eob (void)
 bool
 overlay_touches_p (ptrdiff_t pos)
 {
-  Lisp_Object overlay;
-  struct Lisp_Overlay *tail;
-
-  for (tail = current_buffer->overlays_before; tail; tail = tail->next)
+  for (struct Lisp_Overlay *tail = current_buffer->overlays_before;
+       tail; tail = tail->next)
     {
-      ptrdiff_t endpos;
-
-      XSETMISC (overlay ,tail);
+      Lisp_Object overlay = make_lisp_ptr (tail, Lisp_Vectorlike);
       eassert (OVERLAYP (overlay));
 
-      endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
+      ptrdiff_t endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
       if (endpos < pos)
        break;
       if (endpos == pos || OVERLAY_POSITION (OVERLAY_START (overlay)) == pos)
        return 1;
     }
 
-  for (tail = current_buffer->overlays_after; tail; tail = tail->next)
+  for (struct Lisp_Overlay *tail = current_buffer->overlays_after;
+       tail; tail = tail->next)
     {
-      ptrdiff_t startpos;
-
-      XSETMISC (overlay, tail);
+      Lisp_Object overlay = make_lisp_ptr (tail, Lisp_Vectorlike);
       eassert (OVERLAYP (overlay));
 
-      startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
+      ptrdiff_t startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
       if (pos < startpos)
        break;
       if (startpos == pos || OVERLAY_POSITION (OVERLAY_END (overlay)) == pos)
@@ -3212,17 +3195,17 @@ sort_overlays (Lisp_Object *overlay_vec, ptrdiff_t 
noverlays, struct window *w)
              sortvec[j].priority = 0;
              sortvec[j].spriority = 0;
            }
-         else if (INTEGERP (tem))
+         else if (FIXNUMP (tem))
            {
-             sortvec[j].priority = XINT (tem);
+             sortvec[j].priority = XFIXNUM (tem);
              sortvec[j].spriority = 0;
            }
          else if (CONSP (tem))
            {
              Lisp_Object car = XCAR (tem);
              Lisp_Object cdr = XCDR (tem);
-             sortvec[j].priority  = INTEGERP (car) ? XINT (car) : 0;
-             sortvec[j].spriority = INTEGERP (cdr) ? XINT (cdr) : 0;
+             sortvec[j].priority  = FIXNUMP (car) ? XFIXNUM (car) : 0;
+             sortvec[j].spriority = FIXNUMP (cdr) ? XFIXNUM (cdr) : 0;
            }
          j++;
        }
@@ -3290,7 +3273,7 @@ record_overlay_string (struct sortstrlist *ssl, 
Lisp_Object str,
   ssl->buf[ssl->used].string = str;
   ssl->buf[ssl->used].string2 = str2;
   ssl->buf[ssl->used].size = size;
-  ssl->buf[ssl->used].priority = (INTEGERP (pri) ? XINT (pri) : 0);
+  ssl->buf[ssl->used].priority = (FIXNUMP (pri) ? XFIXNUM (pri) : 0);
   ssl->used++;
 
   if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
@@ -3337,27 +3320,26 @@ record_overlay_string (struct sortstrlist *ssl, 
Lisp_Object str,
 ptrdiff_t
 overlay_strings (ptrdiff_t pos, struct window *w, unsigned char **pstr)
 {
-  Lisp_Object overlay, window, str;
-  struct Lisp_Overlay *ov;
-  ptrdiff_t startpos, endpos;
   bool multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
 
   overlay_heads.used = overlay_heads.bytes = 0;
   overlay_tails.used = overlay_tails.bytes = 0;
-  for (ov = current_buffer->overlays_before; ov; ov = ov->next)
+  for (struct Lisp_Overlay *ov = current_buffer->overlays_before;
+       ov; ov = ov->next)
     {
-      XSETMISC (overlay, ov);
+      Lisp_Object overlay = make_lisp_ptr (ov, Lisp_Vectorlike);
       eassert (OVERLAYP (overlay));
 
-      startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
-      endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
+      ptrdiff_t startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
+      ptrdiff_t endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
       if (endpos < pos)
        break;
       if (endpos != pos && startpos != pos)
        continue;
-      window = Foverlay_get (overlay, Qwindow);
+      Lisp_Object window = Foverlay_get (overlay, Qwindow);
       if (WINDOWP (window) && XWINDOW (window) != w)
        continue;
+      Lisp_Object str;
       if (startpos == pos
          && (str = Foverlay_get (overlay, Qbefore_string), STRINGP (str)))
        record_overlay_string (&overlay_heads, str,
@@ -3372,20 +3354,22 @@ overlay_strings (ptrdiff_t pos, struct window *w, 
unsigned char **pstr)
                               Foverlay_get (overlay, Qpriority),
                               endpos - startpos);
     }
-  for (ov = current_buffer->overlays_after; ov; ov = ov->next)
+  for (struct Lisp_Overlay *ov = current_buffer->overlays_after;
+       ov; ov = ov->next)
     {
-      XSETMISC (overlay, ov);
+      Lisp_Object overlay = make_lisp_ptr (ov, Lisp_Vectorlike);
       eassert (OVERLAYP (overlay));
 
-      startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
-      endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
+      ptrdiff_t startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
+      ptrdiff_t endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
       if (startpos > pos)
        break;
       if (endpos != pos && startpos != pos)
        continue;
-      window = Foverlay_get (overlay, Qwindow);
+      Lisp_Object window = Foverlay_get (overlay, Qwindow);
       if (WINDOWP (window) && XWINDOW (window) != w)
        continue;
+      Lisp_Object str;
       if (startpos == pos
          && (str = Foverlay_get (overlay, Qbefore_string), STRINGP (str)))
        record_overlay_string (&overlay_heads, str,
@@ -3460,8 +3444,7 @@ overlay_strings (ptrdiff_t pos, struct window *w, 
unsigned char **pstr)
 void
 recenter_overlay_lists (struct buffer *buf, ptrdiff_t pos)
 {
-  Lisp_Object overlay, beg, end;
-  struct Lisp_Overlay *prev, *tail, *next;
+  struct Lisp_Overlay *prev, *next;
 
   /* See if anything in overlays_before should move to overlays_after.  */
 
@@ -3469,14 +3452,15 @@ recenter_overlay_lists (struct buffer *buf, ptrdiff_t 
pos)
      But we use it for symmetry and in case that should cease to be true
      with some future change.  */
   prev = NULL;
-  for (tail = buf->overlays_before; tail; prev = tail, tail = next)
+  for (struct Lisp_Overlay *tail = buf->overlays_before;
+       tail; prev = tail, tail = next)
     {
       next = tail->next;
-      XSETMISC (overlay, tail);
+      Lisp_Object overlay = make_lisp_ptr (tail, Lisp_Vectorlike);
       eassert (OVERLAYP (overlay));
 
-      beg = OVERLAY_START (overlay);
-      end = OVERLAY_END (overlay);
+      Lisp_Object beg = OVERLAY_START (overlay);
+      Lisp_Object end = OVERLAY_END (overlay);
 
       if (OVERLAY_POSITION (end) > pos)
        {
@@ -3495,12 +3479,10 @@ recenter_overlay_lists (struct buffer *buf, ptrdiff_t 
pos)
          for (other = buf->overlays_after; other;
               other_prev = other, other = other->next)
            {
-             Lisp_Object otherbeg, otheroverlay;
-
-             XSETMISC (otheroverlay, other);
+             Lisp_Object otheroverlay = make_lisp_ptr (other, Lisp_Vectorlike);
              eassert (OVERLAYP (otheroverlay));
 
-             otherbeg = OVERLAY_START (otheroverlay);
+             Lisp_Object otherbeg = OVERLAY_START (otheroverlay);
              if (OVERLAY_POSITION (otherbeg) >= where)
                break;
            }
@@ -3522,14 +3504,15 @@ recenter_overlay_lists (struct buffer *buf, ptrdiff_t 
pos)
 
   /* See if anything in overlays_after should be in overlays_before.  */
   prev = NULL;
-  for (tail = buf->overlays_after; tail; prev = tail, tail = next)
+  for (struct Lisp_Overlay *tail = buf->overlays_after;
+       tail; prev = tail, tail = next)
     {
       next = tail->next;
-      XSETMISC (overlay, tail);
+      Lisp_Object overlay = make_lisp_ptr (tail, Lisp_Vectorlike);
       eassert (OVERLAYP (overlay));
 
-      beg = OVERLAY_START (overlay);
-      end = OVERLAY_END (overlay);
+      Lisp_Object beg = OVERLAY_START (overlay);
+      Lisp_Object end = OVERLAY_END (overlay);
 
       /* Stop looking, when we know that nothing further
         can possibly end before POS.  */
@@ -3553,12 +3536,10 @@ recenter_overlay_lists (struct buffer *buf, ptrdiff_t 
pos)
          for (other = buf->overlays_before; other;
               other_prev = other, other = other->next)
            {
-             Lisp_Object otherend, otheroverlay;
-
-             XSETMISC (otheroverlay, other);
+             Lisp_Object otheroverlay = make_lisp_ptr (other, Lisp_Vectorlike);
              eassert (OVERLAYP (otheroverlay));
 
-             otherend = OVERLAY_END (otheroverlay);
+             Lisp_Object otherend = OVERLAY_END (otheroverlay);
              if (OVERLAY_POSITION (otherend) <= where)
                break;
            }
@@ -3613,7 +3594,6 @@ adjust_overlays_for_delete (ptrdiff_t pos, ptrdiff_t 
length)
 void
 fix_start_end_in_overlays (register ptrdiff_t start, register ptrdiff_t end)
 {
-  Lisp_Object overlay;
   struct Lisp_Overlay *before_list UNINIT;
   struct Lisp_Overlay *after_list UNINIT;
   /* These are either nil, indicating that before_list or after_list
@@ -3623,8 +3603,7 @@ fix_start_end_in_overlays (register ptrdiff_t start, 
register ptrdiff_t end)
   /* 'Parent', likewise, indicates a cons cell or
      current_buffer->overlays_before or overlays_after, depending
      which loop we're in.  */
-  struct Lisp_Overlay *tail, *parent;
-  ptrdiff_t startpos, endpos;
+  struct Lisp_Overlay *parent;
 
   /* This algorithm shifts links around instead of consing and GCing.
      The loop invariant is that before_list (resp. after_list) is a
@@ -3633,18 +3612,20 @@ fix_start_end_in_overlays (register ptrdiff_t start, 
register ptrdiff_t end)
      (after_list) if it is, is still uninitialized.  So it's not a bug
      that before_list isn't initialized, although it may look
      strange.  */
-  for (parent = NULL, tail = current_buffer->overlays_before; tail;)
+  parent = NULL;
+  for (struct Lisp_Overlay *tail = current_buffer->overlays_before;
+       tail; tail = tail->next)
     {
-      XSETMISC (overlay, tail);
+      Lisp_Object overlay = make_lisp_ptr (tail, Lisp_Vectorlike);
 
-      endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
-      startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
+      ptrdiff_t endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
+      ptrdiff_t startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
 
       /* If the overlay is backwards, make it empty.  */
       if (endpos < startpos)
        {
          startpos = endpos;
-         Fset_marker (OVERLAY_START (overlay), make_number (startpos),
+         Fset_marker (OVERLAY_START (overlay), make_fixnum (startpos),
                       Qnil);
        }
 
@@ -3676,23 +3657,24 @@ fix_start_end_in_overlays (register ptrdiff_t start, 
register ptrdiff_t end)
            set_buffer_overlays_before (current_buffer, tail->next);
          else
            parent->next = tail->next;
-         tail = tail->next;
        }
       else
-       parent = tail, tail = parent->next;
+       parent = tail;
     }
-  for (parent = NULL, tail = current_buffer->overlays_after; tail;)
+  parent = NULL;
+  for (struct Lisp_Overlay *tail = current_buffer->overlays_after;
+       tail; tail = tail->next)
     {
-      XSETMISC (overlay, tail);
+      Lisp_Object overlay = make_lisp_ptr (tail, Lisp_Vectorlike);
 
-      startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
-      endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
+      ptrdiff_t startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
+      ptrdiff_t endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
 
       /* If the overlay is backwards, make it empty.  */
       if (endpos < startpos)
        {
          startpos = endpos;
-         Fset_marker (OVERLAY_START (overlay), make_number (startpos),
+         Fset_marker (OVERLAY_START (overlay), make_fixnum (startpos),
                       Qnil);
        }
 
@@ -3722,10 +3704,9 @@ fix_start_end_in_overlays (register ptrdiff_t start, 
register ptrdiff_t end)
            set_buffer_overlays_after (current_buffer, tail->next);
          else
            parent->next = tail->next;
-         tail = tail->next;
        }
       else
-       parent = tail, tail = parent->next;
+       parent = tail;
     }
 
   /* Splice the constructed (wrong) lists into the buffer's lists,
@@ -3776,7 +3757,7 @@ fix_overlays_before (struct buffer *bp, ptrdiff_t prev, 
ptrdiff_t pos)
      overlay whose ending marker is after-insertion-marker if disorder
      exists).  */
   while (tail
-        && (XSETMISC (tem, tail),
+        && (tem = make_lisp_ptr (tail, Lisp_Vectorlike),
             (end = OVERLAY_POSITION (OVERLAY_END (tem))) >= pos))
     {
       parent = tail;
@@ -3801,7 +3782,7 @@ fix_overlays_before (struct buffer *bp, ptrdiff_t prev, 
ptrdiff_t pos)
      overlays are in correct order.  */
   while (tail)
     {
-      XSETMISC (tem, tail);
+      tem = make_lisp_ptr (tail, Lisp_Vectorlike);
       end = OVERLAY_POSITION (OVERLAY_END (tem));
 
       if (end == pos)
@@ -3867,10 +3848,10 @@ for the rear of the overlay advance when text is 
inserted there
   if (MARKERP (end) && !EQ (Fmarker_buffer (end), buffer))
     signal_error ("Marker points into wrong buffer", end);
 
-  CHECK_NUMBER_COERCE_MARKER (beg);
-  CHECK_NUMBER_COERCE_MARKER (end);
+  CHECK_FIXNUM_COERCE_MARKER (beg);
+  CHECK_FIXNUM_COERCE_MARKER (end);
 
-  if (XINT (beg) > XINT (end))
+  if (XFIXNUM (beg) > XFIXNUM (end))
     {
       Lisp_Object temp;
       temp = beg; beg = end; end = temp;
@@ -3987,10 +3968,10 @@ buffer.  */)
   if (MARKERP (end) && !EQ (Fmarker_buffer (end), buffer))
     signal_error ("Marker points into wrong buffer", end);
 
-  CHECK_NUMBER_COERCE_MARKER (beg);
-  CHECK_NUMBER_COERCE_MARKER (end);
+  CHECK_FIXNUM_COERCE_MARKER (beg);
+  CHECK_FIXNUM_COERCE_MARKER (end);
 
-  if (XINT (beg) > XINT (end))
+  if (XFIXNUM (beg) > XFIXNUM (end))
     {
       Lisp_Object temp;
       temp = beg; beg = end; end = temp;
@@ -4156,7 +4137,7 @@ If SORTED is non-nil, then sort them by decreasing 
priority.  */)
   Lisp_Object *overlay_vec;
   Lisp_Object result;
 
-  CHECK_NUMBER_COERCE_MARKER (pos);
+  CHECK_FIXNUM_COERCE_MARKER (pos);
 
   if (!buffer_has_overlays ())
     return Qnil;
@@ -4167,7 +4148,7 @@ If SORTED is non-nil, then sort them by decreasing 
priority.  */)
 
   /* Put all the overlays we want in a vector in overlay_vec.
      Store the length in len.  */
-  noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len,
+  noverlays = overlays_at (XFIXNUM (pos), 1, &overlay_vec, &len,
                           NULL, NULL, 0);
 
   if (!NILP (sorted))
@@ -4200,8 +4181,8 @@ end of the buffer.  */)
   Lisp_Object *overlay_vec;
   Lisp_Object result;
 
-  CHECK_NUMBER_COERCE_MARKER (beg);
-  CHECK_NUMBER_COERCE_MARKER (end);
+  CHECK_FIXNUM_COERCE_MARKER (beg);
+  CHECK_FIXNUM_COERCE_MARKER (end);
 
   if (!buffer_has_overlays ())
     return Qnil;
@@ -4211,7 +4192,7 @@ end of the buffer.  */)
 
   /* Put all the overlays we want in a vector in overlay_vec.
      Store the length in len.  */
-  noverlays = overlays_in (XINT (beg), XINT (end), 1, &overlay_vec, &len,
+  noverlays = overlays_in (XFIXNUM (beg), XFIXNUM (end), 1, &overlay_vec, &len,
                           NULL, NULL);
 
   /* Make a list of them all.  */
@@ -4232,10 +4213,10 @@ the value is (point-max).  */)
   ptrdiff_t endpos;
   Lisp_Object *overlay_vec;
 
-  CHECK_NUMBER_COERCE_MARKER (pos);
+  CHECK_FIXNUM_COERCE_MARKER (pos);
 
   if (!buffer_has_overlays ())
-    return make_number (ZV);
+    return make_fixnum (ZV);
 
   len = 10;
   overlay_vec = xmalloc (len * sizeof *overlay_vec);
@@ -4243,7 +4224,7 @@ the value is (point-max).  */)
   /* Put all the overlays we want in a vector in overlay_vec.
      Store the length in len.
      endpos gets the position where the next overlay starts.  */
-  noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len,
+  noverlays = overlays_at (XFIXNUM (pos), 1, &overlay_vec, &len,
                           &endpos, 0, 1);
 
   /* If any of these overlays ends before endpos,
@@ -4260,7 +4241,7 @@ the value is (point-max).  */)
     }
 
   xfree (overlay_vec);
-  return make_number (endpos);
+  return make_fixnum (endpos);
 }
 
 DEFUN ("previous-overlay-change", Fprevious_overlay_change,
@@ -4274,14 +4255,14 @@ the value is (point-min).  */)
   Lisp_Object *overlay_vec;
   ptrdiff_t len;
 
-  CHECK_NUMBER_COERCE_MARKER (pos);
+  CHECK_FIXNUM_COERCE_MARKER (pos);
 
   if (!buffer_has_overlays ())
-    return make_number (BEGV);
+    return make_fixnum (BEGV);
 
   /* At beginning of buffer, we know the answer;
      avoid bug subtracting 1 below.  */
-  if (XINT (pos) == BEGV)
+  if (XFIXNUM (pos) == BEGV)
     return pos;
 
   len = 10;
@@ -4290,11 +4271,11 @@ the value is (point-min).  */)
   /* Put all the overlays we want in a vector in overlay_vec.
      Store the length in len.
      prevpos gets the position of the previous change.  */
-  overlays_at (XINT (pos), 1, &overlay_vec, &len,
+  overlays_at (XFIXNUM (pos), 1, &overlay_vec, &len,
               0, &prevpos, 1);
 
   xfree (overlay_vec);
-  return make_number (prevpos);
+  return make_fixnum (prevpos);
 }
 
 /* These functions are for debugging overlays.  */
@@ -4308,19 +4289,14 @@ The lists you get are copies, so that changing them has 
no effect.
 However, the overlays you get are the real objects that the buffer uses.  */)
   (void)
 {
-  struct Lisp_Overlay *ol;
-  Lisp_Object before = Qnil, after = Qnil, tmp;
+  Lisp_Object before = Qnil, after = Qnil;
 
-  for (ol = current_buffer->overlays_before; ol; ol = ol->next)
-    {
-      XSETMISC (tmp, ol);
-      before = Fcons (tmp, before);
-    }
-  for (ol = current_buffer->overlays_after; ol; ol = ol->next)
-    {
-      XSETMISC (tmp, ol);
-      after = Fcons (tmp, after);
-    }
+  for (struct Lisp_Overlay *ol = current_buffer->overlays_before;
+       ol; ol = ol->next)
+    before = Fcons (make_lisp_ptr (ol, Lisp_Vectorlike), before);
+  for (struct Lisp_Overlay *ol = current_buffer->overlays_after;
+       ol; ol = ol->next)
+    after = Fcons (make_lisp_ptr (ol, Lisp_Vectorlike), after);
 
   return Fcons (Fnreverse (before), Fnreverse (after));
 }
@@ -4332,9 +4308,9 @@ for positions far away from POS).  */)
   (Lisp_Object pos)
 {
   ptrdiff_t p;
-  CHECK_NUMBER_COERCE_MARKER (pos);
+  CHECK_FIXNUM_COERCE_MARKER (pos);
 
-  p = clip_to_bounds (PTRDIFF_MIN, XINT (pos), PTRDIFF_MAX);
+  p = clip_to_bounds (PTRDIFF_MIN, XFIXNUM (pos), PTRDIFF_MAX);
   recenter_overlay_lists (current_buffer, p);
   return Qnil;
 }
@@ -4439,13 +4415,8 @@ void
 report_overlay_modification (Lisp_Object start, Lisp_Object end, bool after,
                             Lisp_Object arg1, Lisp_Object arg2, Lisp_Object 
arg3)
 {
-  Lisp_Object prop, overlay;
-  struct Lisp_Overlay *tail;
   /* True if this change is an insertion.  */
-  bool insertion = (after ? XFASTINT (arg3) == 0 : EQ (start, end));
-
-  overlay = Qnil;
-  tail = NULL;
+  bool insertion = (after ? XFIXNAT (arg3) == 0 : EQ (start, end));
 
   /* We used to run the functions as soon as we found them and only register
      them in last_overlay_modification_hooks for the purpose of the `after'
@@ -4460,75 +4431,77 @@ report_overlay_modification (Lisp_Object start, 
Lisp_Object end, bool after,
       /* We are being called before a change.
         Scan the overlays to find the functions to call.  */
       last_overlay_modification_hooks_used = 0;
-      for (tail = current_buffer->overlays_before; tail; tail = tail->next)
+      for (struct Lisp_Overlay *tail = current_buffer->overlays_before;
+          tail; tail = tail->next)
        {
          ptrdiff_t startpos, endpos;
          Lisp_Object ostart, oend;
 
-         XSETMISC (overlay, tail);
+         Lisp_Object overlay = make_lisp_ptr (tail, Lisp_Vectorlike);
 
          ostart = OVERLAY_START (overlay);
          oend = OVERLAY_END (overlay);
          endpos = OVERLAY_POSITION (oend);
-         if (XFASTINT (start) > endpos)
+         if (XFIXNAT (start) > endpos)
            break;
          startpos = OVERLAY_POSITION (ostart);
-         if (insertion && (XFASTINT (start) == startpos
-                           || XFASTINT (end) == startpos))
+         if (insertion && (XFIXNAT (start) == startpos
+                           || XFIXNAT (end) == startpos))
            {
-             prop = Foverlay_get (overlay, Qinsert_in_front_hooks);
+             Lisp_Object prop = Foverlay_get (overlay, Qinsert_in_front_hooks);
              if (!NILP (prop))
                add_overlay_mod_hooklist (prop, overlay);
            }
-         if (insertion && (XFASTINT (start) == endpos
-                           || XFASTINT (end) == endpos))
+         if (insertion && (XFIXNAT (start) == endpos
+                           || XFIXNAT (end) == endpos))
            {
-             prop = Foverlay_get (overlay, Qinsert_behind_hooks);
+             Lisp_Object prop = Foverlay_get (overlay, Qinsert_behind_hooks);
              if (!NILP (prop))
                add_overlay_mod_hooklist (prop, overlay);
            }
          /* Test for intersecting intervals.  This does the right thing
             for both insertion and deletion.  */
-         if (XFASTINT (end) > startpos && XFASTINT (start) < endpos)
+         if (XFIXNAT (end) > startpos && XFIXNAT (start) < endpos)
            {
-             prop = Foverlay_get (overlay, Qmodification_hooks);
+             Lisp_Object prop = Foverlay_get (overlay, Qmodification_hooks);
              if (!NILP (prop))
                add_overlay_mod_hooklist (prop, overlay);
            }
        }
 
-      for (tail = current_buffer->overlays_after; tail; tail = tail->next)
+      for (struct Lisp_Overlay *tail = current_buffer->overlays_after;
+          tail; tail = tail->next)
        {
          ptrdiff_t startpos, endpos;
          Lisp_Object ostart, oend;
 
-         XSETMISC (overlay, tail);
+         Lisp_Object overlay = make_lisp_ptr (tail, Lisp_Vectorlike);
 
          ostart = OVERLAY_START (overlay);
          oend = OVERLAY_END (overlay);
          startpos = OVERLAY_POSITION (ostart);
          endpos = OVERLAY_POSITION (oend);
-         if (XFASTINT (end) < startpos)
+         if (XFIXNAT (end) < startpos)
            break;
-         if (insertion && (XFASTINT (start) == startpos
-                           || XFASTINT (end) == startpos))
+         if (insertion && (XFIXNAT (start) == startpos
+                           || XFIXNAT (end) == startpos))
            {
-             prop = Foverlay_get (overlay, Qinsert_in_front_hooks);
+             Lisp_Object prop = Foverlay_get (overlay, Qinsert_in_front_hooks);
              if (!NILP (prop))
                add_overlay_mod_hooklist (prop, overlay);
            }
-         if (insertion && (XFASTINT (start) == endpos
-                           || XFASTINT (end) == endpos))
+         if (insertion && (XFIXNAT (start) == endpos
+                           || XFIXNAT (end) == endpos))
            {
-             prop = Foverlay_get (overlay, Qinsert_behind_hooks);
+             Lisp_Object prop = Foverlay_get (overlay, Qinsert_behind_hooks);
              if (!NILP (prop))
                add_overlay_mod_hooklist (prop, overlay);
            }
          /* Test for intersecting intervals.  This does the right thing
             for both insertion and deletion.  */
-         if (XFASTINT (end) > startpos && XFASTINT (start) < endpos)
+         if (XFIXNAT (end) > startpos && XFIXNAT (start) < endpos)
            {
-             prop = Foverlay_get (overlay, Qmodification_hooks);
+             Lisp_Object prop = Foverlay_get (overlay, Qmodification_hooks);
              if (!NILP (prop))
                add_overlay_mod_hooklist (prop, overlay);
            }
@@ -4596,16 +4569,13 @@ call_overlay_mod_hooks (Lisp_Object list, Lisp_Object 
overlay, bool after,
 void
 evaporate_overlays (ptrdiff_t pos)
 {
-  Lisp_Object overlay, hit_list;
-  struct Lisp_Overlay *tail;
-
-  hit_list = Qnil;
+  Lisp_Object hit_list = Qnil;
   if (pos <= current_buffer->overlay_center)
-    for (tail = current_buffer->overlays_before; tail; tail = tail->next)
+    for (struct Lisp_Overlay *tail = current_buffer->overlays_before;
+        tail; tail = tail->next)
       {
-       ptrdiff_t endpos;
-       XSETMISC (overlay, tail);
-       endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
+       Lisp_Object overlay = make_lisp_ptr (tail, Lisp_Vectorlike);
+       ptrdiff_t endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
        if (endpos < pos)
          break;
        if (endpos == pos && OVERLAY_POSITION (OVERLAY_START (overlay)) == pos
@@ -4613,11 +4583,11 @@ evaporate_overlays (ptrdiff_t pos)
          hit_list = Fcons (overlay, hit_list);
       }
   else
-    for (tail = current_buffer->overlays_after; tail; tail = tail->next)
+    for (struct Lisp_Overlay *tail = current_buffer->overlays_after;
+        tail; tail = tail->next)
       {
-       ptrdiff_t startpos;
-       XSETMISC (overlay, tail);
-       startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
+       Lisp_Object overlay = make_lisp_ptr (tail, Lisp_Vectorlike);
+       ptrdiff_t startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
        if (startpos > pos)
          break;
        if (startpos == pos && OVERLAY_POSITION (OVERLAY_END (overlay)) == pos
@@ -5082,41 +5052,41 @@ init_buffer_once (void)
 
   /* 0 means not a lisp var, -1 means always local, else mask.  */
   memset (&buffer_local_flags, 0, sizeof buffer_local_flags);
-  bset_filename (&buffer_local_flags, make_number (-1));
-  bset_directory (&buffer_local_flags, make_number (-1));
-  bset_backed_up (&buffer_local_flags, make_number (-1));
-  bset_save_length (&buffer_local_flags, make_number (-1));
-  bset_auto_save_file_name (&buffer_local_flags, make_number (-1));
-  bset_read_only (&buffer_local_flags, make_number (-1));
-  bset_major_mode (&buffer_local_flags, make_number (-1));
-  bset_mode_name (&buffer_local_flags, make_number (-1));
-  bset_undo_list (&buffer_local_flags, make_number (-1));
-  bset_mark_active (&buffer_local_flags, make_number (-1));
-  bset_point_before_scroll (&buffer_local_flags, make_number (-1));
-  bset_file_truename (&buffer_local_flags, make_number (-1));
-  bset_invisibility_spec (&buffer_local_flags, make_number (-1));
-  bset_file_format (&buffer_local_flags, make_number (-1));
-  bset_auto_save_file_format (&buffer_local_flags, make_number (-1));
-  bset_display_count (&buffer_local_flags, make_number (-1));
-  bset_display_time (&buffer_local_flags, make_number (-1));
-  bset_enable_multibyte_characters (&buffer_local_flags, make_number (-1));
+  bset_filename (&buffer_local_flags, make_fixnum (-1));
+  bset_directory (&buffer_local_flags, make_fixnum (-1));
+  bset_backed_up (&buffer_local_flags, make_fixnum (-1));
+  bset_save_length (&buffer_local_flags, make_fixnum (-1));
+  bset_auto_save_file_name (&buffer_local_flags, make_fixnum (-1));
+  bset_read_only (&buffer_local_flags, make_fixnum (-1));
+  bset_major_mode (&buffer_local_flags, make_fixnum (-1));
+  bset_mode_name (&buffer_local_flags, make_fixnum (-1));
+  bset_undo_list (&buffer_local_flags, make_fixnum (-1));
+  bset_mark_active (&buffer_local_flags, make_fixnum (-1));
+  bset_point_before_scroll (&buffer_local_flags, make_fixnum (-1));
+  bset_file_truename (&buffer_local_flags, make_fixnum (-1));
+  bset_invisibility_spec (&buffer_local_flags, make_fixnum (-1));
+  bset_file_format (&buffer_local_flags, make_fixnum (-1));
+  bset_auto_save_file_format (&buffer_local_flags, make_fixnum (-1));
+  bset_display_count (&buffer_local_flags, make_fixnum (-1));
+  bset_display_time (&buffer_local_flags, make_fixnum (-1));
+  bset_enable_multibyte_characters (&buffer_local_flags, make_fixnum (-1));
 
   /* These used to be stuck at 0 by default, but now that the all-zero value
      means Qnil, we have to initialize them explicitly.  */
-  bset_name (&buffer_local_flags, make_number (0));
-  bset_mark (&buffer_local_flags, make_number (0));
-  bset_local_var_alist (&buffer_local_flags, make_number (0));
-  bset_keymap (&buffer_local_flags, make_number (0));
-  bset_downcase_table (&buffer_local_flags, make_number (0));
-  bset_upcase_table (&buffer_local_flags, make_number (0));
-  bset_case_canon_table (&buffer_local_flags, make_number (0));
-  bset_case_eqv_table (&buffer_local_flags, make_number (0));
-  bset_minor_modes (&buffer_local_flags, make_number (0));
-  bset_width_table (&buffer_local_flags, make_number (0));
-  bset_pt_marker (&buffer_local_flags, make_number (0));
-  bset_begv_marker (&buffer_local_flags, make_number (0));
-  bset_zv_marker (&buffer_local_flags, make_number (0));
-  bset_last_selected_window (&buffer_local_flags, make_number (0));
+  bset_name (&buffer_local_flags, make_fixnum (0));
+  bset_mark (&buffer_local_flags, make_fixnum (0));
+  bset_local_var_alist (&buffer_local_flags, make_fixnum (0));
+  bset_keymap (&buffer_local_flags, make_fixnum (0));
+  bset_downcase_table (&buffer_local_flags, make_fixnum (0));
+  bset_upcase_table (&buffer_local_flags, make_fixnum (0));
+  bset_case_canon_table (&buffer_local_flags, make_fixnum (0));
+  bset_case_eqv_table (&buffer_local_flags, make_fixnum (0));
+  bset_minor_modes (&buffer_local_flags, make_fixnum (0));
+  bset_width_table (&buffer_local_flags, make_fixnum (0));
+  bset_pt_marker (&buffer_local_flags, make_fixnum (0));
+  bset_begv_marker (&buffer_local_flags, make_fixnum (0));
+  bset_zv_marker (&buffer_local_flags, make_fixnum (0));
+  bset_last_selected_window (&buffer_local_flags, make_fixnum (0));
 
   idx = 1;
   XSETFASTINT (BVAR (&buffer_local_flags, mode_line_format), idx); ++idx;
@@ -5443,7 +5413,7 @@ syms_of_buffer (void)
 {
   staticpro (&last_overlay_modification_hooks);
   last_overlay_modification_hooks
-    = Fmake_vector (make_number (10), Qnil);
+    = Fmake_vector (make_fixnum (10), Qnil);
 
   staticpro (&QSFundamental);
   staticpro (&Vbuffer_alist);
@@ -5584,17 +5554,17 @@ Use the command `abbrev-mode' to change this variable.  
*/);
                     doc: /* Non-nil if searches and matches should ignore 
case.  */);
 
   DEFVAR_PER_BUFFER ("fill-column", &BVAR (current_buffer, fill_column),
-                    Qintegerp,
+                    Qfixnump,
                     doc: /* Column beyond which automatic line-wrapping should 
happen.
 Interactively, you can set the buffer local value using \\[set-fill-column].  
*/);
 
   DEFVAR_PER_BUFFER ("left-margin", &BVAR (current_buffer, left_margin),
-                    Qintegerp,
+                    Qfixnump,
                     doc: /* Column for the default `indent-line-function' to 
indent to.
 Linefeed indents to this column in Fundamental mode.  */);
 
   DEFVAR_PER_BUFFER ("tab-width", &BVAR (current_buffer, tab_width),
-                    Qintegerp,
+                    Qfixnump,
                     doc: /* Distance between tab stops (for display of tab 
characters), in columns.
 NOTE: This controls the display width of a TAB character, and not
 the size of an indentation step.
@@ -5765,7 +5735,7 @@ If it is nil, that means don't auto-save this buffer.  
*/);
 Backing up is done before the first time the file is saved.  */);
 
   DEFVAR_PER_BUFFER ("buffer-saved-size", &BVAR (current_buffer, save_length),
-                    Qintegerp,
+                    Qfixnump,
                     doc: /* Length of current buffer when last read in, saved 
or auto-saved.
 0 initially.
 -1 means auto-saving turned off until next real save.
@@ -5839,7 +5809,7 @@ In addition, a char-table has six extra slots to control 
the display of:
 See also the functions `display-table-slot' and `set-display-table-slot'.  */);
 
   DEFVAR_PER_BUFFER ("left-margin-width", &BVAR (current_buffer, 
left_margin_cols),
-                    Qintegerp,
+                    Qfixnump,
                     doc: /* Width in columns of left marginal area for display 
of a buffer.
 A value of nil means no marginal area.
 
@@ -5847,7 +5817,7 @@ Setting this variable does not take effect until a new 
buffer is displayed
 in a window.  To make the change take effect, call `set-window-buffer'.  */);
 
   DEFVAR_PER_BUFFER ("right-margin-width", &BVAR (current_buffer, 
right_margin_cols),
-                    Qintegerp,
+                    Qfixnump,
                     doc: /* Width in columns of right marginal area for 
display of a buffer.
 A value of nil means no marginal area.
 
@@ -5855,7 +5825,7 @@ Setting this variable does not take effect until a new 
buffer is displayed
 in a window.  To make the change take effect, call `set-window-buffer'.  */);
 
   DEFVAR_PER_BUFFER ("left-fringe-width", &BVAR (current_buffer, 
left_fringe_width),
-                    Qintegerp,
+                    Qfixnump,
                     doc: /* Width of this buffer's left fringe (in pixels).
 A value of 0 means no left fringe is shown in this buffer's window.
 A value of nil means to use the left fringe width from the window's frame.
@@ -5864,7 +5834,7 @@ Setting this variable does not take effect until a new 
buffer is displayed
 in a window.  To make the change take effect, call `set-window-buffer'.  */);
 
   DEFVAR_PER_BUFFER ("right-fringe-width", &BVAR (current_buffer, 
right_fringe_width),
-                    Qintegerp,
+                    Qfixnump,
                     doc: /* Width of this buffer's right fringe (in pixels).
 A value of 0 means no right fringe is shown in this buffer's window.
 A value of nil means to use the right fringe width from the window's frame.
@@ -5881,12 +5851,12 @@ Setting this variable does not take effect until a new 
buffer is displayed
 in a window.  To make the change take effect, call `set-window-buffer'.  */);
 
   DEFVAR_PER_BUFFER ("scroll-bar-width", &BVAR (current_buffer, 
scroll_bar_width),
-                    Qintegerp,
+                    Qfixnump,
                     doc: /* Width of this buffer's vertical scroll bars in 
pixels.
 A value of nil means to use the scroll bar width from the window's frame.  */);
 
   DEFVAR_PER_BUFFER ("scroll-bar-height", &BVAR (current_buffer, 
scroll_bar_height),
-                    Qintegerp,
+                    Qfixnump,
                     doc: /* Height of this buffer's horizontal scroll bars in 
pixels.
 A value of nil means to use the scroll bar height from the window's frame.  
*/);
 
@@ -6156,7 +6126,7 @@ Setting this variable is very fast, much faster than 
scanning all the text in
 the buffer looking for properties to change.  */);
 
   DEFVAR_PER_BUFFER ("buffer-display-count",
-                    &BVAR (current_buffer, display_count), Qintegerp,
+                    &BVAR (current_buffer, display_count), Qfixnump,
                     doc: /* A number incremented each time this buffer is 
displayed in a window.
 The function `set-window-buffer' increments it.  */);
 
diff --git a/src/buffer.h b/src/buffer.h
index 85b5631..c624750 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -295,7 +295,7 @@ extern void enlarge_buffer_text (struct buffer *, 
ptrdiff_t);
   do                                                                   \
     {                                                                  \
       Lisp_Object __pos = (pos);                                       \
-      if (NUMBERP (__pos))                                             \
+      if (FIXED_OR_FLOATP (__pos))                                             
\
        {                                                               \
          charpos = __pos;                                              \
          bytepos = buf_charpos_to_bytepos (current_buffer, __pos);     \
@@ -1349,7 +1349,7 @@ extern int last_per_buffer_idx;
 
 
 #define PER_BUFFER_IDX(OFFSET) \
-      XINT (*(Lisp_Object *)((OFFSET) + (char *) &buffer_local_flags))
+      XFIXNUM (*(Lisp_Object *)((OFFSET) + (char *) &buffer_local_flags))
 
 /* Functions to get and set default value of the per-buffer
    variable at offset OFFSET in the buffer structure.  */
@@ -1387,7 +1387,7 @@ downcase (int c)
 {
   Lisp_Object downcase_table = BVAR (current_buffer, downcase_table);
   Lisp_Object down = CHAR_TABLE_REF (downcase_table, c);
-  return NATNUMP (down) ? XFASTINT (down) : c;
+  return FIXNATP (down) ? XFIXNAT (down) : c;
 }
 
 /* Upcase a character C, or make no change if that cannot be done. */
@@ -1396,7 +1396,7 @@ upcase (int c)
 {
   Lisp_Object upcase_table = BVAR (current_buffer, upcase_table);
   Lisp_Object up = CHAR_TABLE_REF (upcase_table, c);
-  return NATNUMP (up) ? XFASTINT (up) : c;
+  return FIXNATP (up) ? XFIXNAT (up) : c;
 }
 
 /* True if C is upper case.  */
diff --git a/src/bytecode.c b/src/bytecode.c
index 772cc98..b27fa7c 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -63,14 +63,14 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 {                                                                      \
   if (byte_metering_on)                                                        
\
     {                                                                  \
-      if (XFASTINT (METER_1 (this_code)) < MOST_POSITIVE_FIXNUM)       \
+      if (XFIXNAT (METER_1 (this_code)) < MOST_POSITIVE_FIXNUM)        \
         XSETFASTINT (METER_1 (this_code),                              \
-                    XFASTINT (METER_1 (this_code)) + 1);               \
+                    XFIXNAT (METER_1 (this_code)) + 1);                \
       if (last_code                                                    \
-         && (XFASTINT (METER_2 (last_code, this_code))                 \
+         && (XFIXNAT (METER_2 (last_code, this_code))                  \
              < MOST_POSITIVE_FIXNUM))                                  \
         XSETFASTINT (METER_2 (last_code, this_code),                   \
-                    XFASTINT (METER_2 (last_code, this_code)) + 1);    \
+                    XFIXNAT (METER_2 (last_code, this_code)) + 1);     \
     }                                                                  \
 }
 
@@ -346,7 +346,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, 
Lisp_Object maxdepth,
 
   CHECK_STRING (bytestr);
   CHECK_VECTOR (vector);
-  CHECK_NATNUM (maxdepth);
+  CHECK_FIXNAT (maxdepth);
 
   ptrdiff_t const_length = ASIZE (vector);
 
@@ -362,7 +362,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, 
Lisp_Object maxdepth,
   Lisp_Object *vectorp = XVECTOR (vector)->contents;
 
   unsigned char quitcounter = 1;
-  EMACS_INT stack_items = XFASTINT (maxdepth) + 1;
+  EMACS_INT stack_items = XFIXNAT (maxdepth) + 1;
   USE_SAFE_ALLOCA;
   void *alloc;
   SAFE_ALLOCA_LISP_EXTRA (alloc, stack_items, bytestr_length);
@@ -378,16 +378,16 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, 
Lisp_Object maxdepth,
 
   if (!NILP (args_template))
     {
-      eassert (INTEGERP (args_template));
-      ptrdiff_t at = XINT (args_template);
+      eassert (FIXNUMP (args_template));
+      ptrdiff_t at = XFIXNUM (args_template);
       bool rest = (at & 128) != 0;
       int mandatory = at & 127;
       ptrdiff_t nonrest = at >> 8;
       ptrdiff_t maxargs = rest ? PTRDIFF_MAX : nonrest;
       if (! (mandatory <= nargs && nargs <= maxargs))
        Fsignal (Qwrong_number_of_arguments,
-                list2 (Fcons (make_number (mandatory), make_number (nonrest)),
-                       make_number (nargs)));
+                list2 (Fcons (make_fixnum (mandatory), make_fixnum (nonrest)),
+                       make_fixnum (nargs)));
       ptrdiff_t pushedargs = min (nonrest, nargs);
       for (ptrdiff_t i = 0; i < pushedargs; i++, args++)
        PUSH (*args);
@@ -621,10 +621,10 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, 
Lisp_Object maxdepth,
              {
                Lisp_Object v1 = TOP;
                Lisp_Object v2 = Fget (v1, Qbyte_code_meter);
-               if (INTEGERP (v2)
-                   && XINT (v2) < MOST_POSITIVE_FIXNUM)
+               if (FIXNUMP (v2)
+                   && XFIXNUM (v2) < MOST_POSITIVE_FIXNUM)
                  {
-                   XSETINT (v2, XINT (v2) + 1);
+                   XSETINT (v2, XFIXNUM (v2) + 1);
                    Fput (v1, Qbyte_code_meter, v2);
                  }
              }
@@ -832,8 +832,8 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, 
Lisp_Object maxdepth,
        CASE (Bnth):
          {
            Lisp_Object v2 = POP, v1 = TOP;
-           CHECK_NUMBER (v1);
-           for (EMACS_INT n = XINT (v1); 0 < n && CONSP (v2); n--)
+           CHECK_FIXNUM (v1);
+           for (EMACS_INT n = XFIXNUM (v1); 0 < n && CONSP (v2); n--)
              {
                v2 = XCDR (v2);
                rarely_quit (n);
@@ -972,11 +972,15 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, 
Lisp_Object maxdepth,
          NEXT;
 
        CASE (Bsub1):
-         TOP = INTEGERP (TOP) ? make_number (XINT (TOP) - 1) : Fsub1 (TOP);
+         TOP = (FIXNUMP (TOP) && XFIXNUM (TOP) != MOST_NEGATIVE_FIXNUM
+                ? make_fixnum (XFIXNUM (TOP) - 1)
+                : Fsub1 (TOP));
          NEXT;
 
        CASE (Badd1):
-         TOP = INTEGERP (TOP) ? make_number (XINT (TOP) + 1) : Fadd1 (TOP);
+         TOP = (FIXNUMP (TOP) && XFIXNUM (TOP) != MOST_POSITIVE_FIXNUM
+                ? make_fixnum (XFIXNUM (TOP) + 1)
+                : Fadd1 (TOP));
          NEXT;
 
        CASE (Beqlsign):
@@ -986,8 +990,8 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, 
Lisp_Object maxdepth,
              TOP = arithcompare (v1, v2, ARITH_EQUAL);
            else
              {
-               CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (v1);
-               CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (v2);
+               CHECK_FIXNUM_OR_FLOAT_COERCE_MARKER (v1);
+               CHECK_FIXNUM_OR_FLOAT_COERCE_MARKER (v2);
                TOP = EQ (v1, v2) ? Qt : Qnil;
              }
            NEXT;
@@ -1027,7 +1031,9 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, 
Lisp_Object maxdepth,
          NEXT;
 
        CASE (Bnegate):
-         TOP = INTEGERP (TOP) ? make_number (- XINT (TOP)) : Fminus (1, &TOP);
+         TOP = (FIXNUMP (TOP) && XFIXNUM (TOP) != MOST_NEGATIVE_FIXNUM
+                ? make_fixnum (- XFIXNUM (TOP))
+                : Fminus (1, &TOP));
          NEXT;
 
        CASE (Bplus):
@@ -1063,7 +1069,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, 
Lisp_Object maxdepth,
          }
 
        CASE (Bpoint):
-         PUSH (make_natnum (PT));
+         PUSH (make_fixed_natnum (PT));
          NEXT;
 
        CASE (Bgoto_char):
@@ -1089,7 +1095,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, 
Lisp_Object maxdepth,
          }
 
        CASE (Bpoint_min):
-         PUSH (make_natnum (BEGV));
+         PUSH (make_fixed_natnum (BEGV));
          NEXT;
 
        CASE (Bchar_after):
@@ -1105,7 +1111,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, 
Lisp_Object maxdepth,
          NEXT;
 
        CASE (Bcurrent_column):
-         PUSH (make_natnum (current_column ()));
+         PUSH (make_fixed_natnum (current_column ()));
          NEXT;
 
        CASE (Bindent_to):
@@ -1169,7 +1175,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, 
Lisp_Object maxdepth,
        CASE (Bchar_syntax):
          {
            CHECK_CHARACTER (TOP);
-           int c = XFASTINT (TOP);
+           int c = XFIXNAT (TOP);
            if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
              MAKE_CHAR_MULTIBYTE (c);
            XSETFASTINT (TOP, syntax_code_spec[SYNTAX (c)]);
@@ -1262,8 +1268,8 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, 
Lisp_Object maxdepth,
              {
                /* Exchange args and then do nth.  */
                Lisp_Object v2 = POP, v1 = TOP;
-               CHECK_NUMBER (v2);
-               for (EMACS_INT n = XINT (v2); 0 < n && CONSP (v1); n--)
+               CHECK_FIXNUM (v2);
+               for (EMACS_INT n = XFIXNUM (v2); 0 < n && CONSP (v1); n--)
                  {
                    v1 = XCDR (v1);
                    rarely_quit (n);
@@ -1415,7 +1421,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, 
Lisp_Object maxdepth,
               { /* Do a linear search if there are not many cases
                    FIXME: 5 is arbitrarily chosen.  */
                 Lisp_Object hash_code = h->test.cmpfn
-                  ? make_number (h->test.hashfn (&h->test, v1)) : Qnil;
+                  ? make_fixnum (h->test.hashfn (&h->test, v1)) : Qnil;
 
                 for (i = h->count; 0 <= --i; )
                   if (EQ (v1, HASH_KEY (h, i))
@@ -1431,9 +1437,9 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, 
Lisp_Object maxdepth,
            if (i >= 0)
              {
                Lisp_Object val = HASH_VALUE (h, i);
-               if (BYTE_CODE_SAFE && !INTEGERP (val))
+               if (BYTE_CODE_SAFE && !FIXNUMP (val))
                  emacs_abort ();
-               op = XINT (val);
+               op = XFIXNUM (val);
                goto op_branch;
              }
           }
@@ -1468,14 +1474,14 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object 
vector, Lisp_Object maxdepth,
 Lisp_Object
 get_byte_code_arity (Lisp_Object args_template)
 {
-  eassert (NATNUMP (args_template));
-  EMACS_INT at = XINT (args_template);
+  eassert (FIXNATP (args_template));
+  EMACS_INT at = XFIXNUM (args_template);
   bool rest = (at & 128) != 0;
   int mandatory = at & 127;
   EMACS_INT nonrest = at >> 8;
 
-  return Fcons (make_number (mandatory),
-               rest ? Qmany : make_number (nonrest));
+  return Fcons (make_fixnum (mandatory),
+               rest ? Qmany : make_fixnum (nonrest));
 }
 
 void
@@ -1500,13 +1506,13 @@ If a symbol has a property named `byte-code-meter' 
whose value is an
 integer, it is incremented each time that symbol's function is called.  */);
 
   byte_metering_on = false;
-  Vbyte_code_meter = Fmake_vector (make_number (256), make_number (0));
+  Vbyte_code_meter = Fmake_vector (make_fixnum (256), make_fixnum (0));
   DEFSYM (Qbyte_code_meter, "byte-code-meter");
   {
     int i = 256;
     while (i--)
       ASET (Vbyte_code_meter, i,
-           Fmake_vector (make_number (256), make_number (0)));
+           Fmake_vector (make_fixnum (256), make_fixnum (0)));
   }
 #endif
 }
diff --git a/src/callint.c b/src/callint.c
index 807e1cc..81efb26 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -200,8 +200,8 @@ fix_command (Lisp_Object input, Lisp_Object values)
                  carelt = XCAR (elt);
                  /* If it is (if X Y), look at Y.  */
                  if (EQ (carelt, Qif)
-                     && NILP (Fnthcdr (make_number (3), elt)))
-                   elt = Fnth (make_number (2), elt);
+                     && NILP (Fnthcdr (make_fixnum (3), elt)))
+                   elt = Fnth (make_fixnum (2), elt);
                  /* If it is (when ... Y), look at Y.  */
                  else if (EQ (carelt, Qwhen))
                    {
@@ -479,8 +479,8 @@ invoke it.  If KEYS is omitted or nil, the return value of
 
         case 'c':              /* Character.  */
          /* Prompt in `minibuffer-prompt' face.  */
-         Fput_text_property (make_number (0),
-                             make_number (SCHARS (callint_message)),
+         Fput_text_property (make_fixnum (0),
+                             make_fixnum (SCHARS (callint_message)),
                              Qface, Qminibuffer_prompt, callint_message);
          args[i] = Fread_char (callint_message, Qnil, Qnil);
          message1_nolog (0);
@@ -531,8 +531,8 @@ invoke it.  If KEYS is omitted or nil, the return value of
            ptrdiff_t speccount1 = SPECPDL_INDEX ();
            specbind (Qcursor_in_echo_area, Qt);
            /* Prompt in `minibuffer-prompt' face.  */
-           Fput_text_property (make_number (0),
-                               make_number (SCHARS (callint_message)),
+           Fput_text_property (make_fixnum (0),
+                               make_fixnum (SCHARS (callint_message)),
                                Qface, Qminibuffer_prompt, callint_message);
            args[i] = Fread_key_sequence (callint_message,
                                          Qnil, Qnil, Qnil, Qnil);
@@ -542,7 +542,7 @@ invoke it.  If KEYS is omitted or nil, the return value of
            /* If the key sequence ends with a down-event,
               discard the following up-event.  */
            Lisp_Object teml
-             = Faref (args[i], make_number (XINT (Flength (args[i])) - 1));
+             = Faref (args[i], make_fixnum (XFIXNUM (Flength (args[i])) - 1));
            if (CONSP (teml))
              teml = XCAR (teml);
            if (SYMBOLP (teml))
@@ -561,8 +561,8 @@ invoke it.  If KEYS is omitted or nil, the return value of
            ptrdiff_t speccount1 = SPECPDL_INDEX ();
            specbind (Qcursor_in_echo_area, Qt);
            /* Prompt in `minibuffer-prompt' face.  */
-           Fput_text_property (make_number (0),
-                               make_number (SCHARS (callint_message)),
+           Fput_text_property (make_fixnum (0),
+                               make_fixnum (SCHARS (callint_message)),
                                Qface, Qminibuffer_prompt, callint_message);
            args[i] = Fread_key_sequence_vector (callint_message,
                                                 Qnil, Qt, Qnil, Qnil);
@@ -572,7 +572,7 @@ invoke it.  If KEYS is omitted or nil, the return value of
            /* If the key sequence ends with a down-event,
               discard the following up-event.  */
            Lisp_Object teml
-             = Faref (args[i], make_number (XINT (Flength (args[i])) - 1));
+             = Faref (args[i], make_fixnum (XFIXNUM (Flength (args[i])) - 1));
            if (CONSP (teml))
              teml = XCAR (teml);
            if (SYMBOLP (teml))
@@ -589,7 +589,7 @@ invoke it.  If KEYS is omitted or nil, the return value of
        case 'U':               /* Up event from last k or K.  */
          if (!NILP (up_event))
            {
-             args[i] = Fmake_vector (make_number (1), up_event);
+             args[i] = Fmake_vector (make_fixnum (1), up_event);
              up_event = Qnil;
              visargs[i] = Fkey_description (args[i], Qnil);
            }
@@ -795,9 +795,9 @@ Its numeric meaning is what you would get from 
`(interactive "p")'.  */)
     XSETFASTINT (val, 1);
   else if (EQ (raw, Qminus))
     XSETINT (val, -1);
-  else if (CONSP (raw) && INTEGERP (XCAR (raw)))
-    XSETINT (val, XINT (XCAR (raw)));
-  else if (INTEGERP (raw))
+  else if (CONSP (raw) && FIXNUMP (XCAR (raw)))
+    XSETINT (val, XFIXNUM (XCAR (raw)));
+  else if (FIXNUMP (raw))
     val = raw;
   else
     XSETFASTINT (val, 1);
diff --git a/src/callproc.c b/src/callproc.c
index 17eb813..e6a8180 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -83,7 +83,7 @@ static pid_t synch_process_pid;
 #ifdef MSDOS
 static Lisp_Object synch_process_tempfile;
 #else
-# define synch_process_tempfile make_number (0)
+# define synch_process_tempfile make_fixnum (0)
 #endif
 
 /* Indexes of file descriptors that need closing on call_process_kill.  */
@@ -324,7 +324,7 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int 
filefd,
 #ifndef subprocesses
   /* Without asynchronous processes we cannot have BUFFER == 0.  */
   if (nargs >= 3
-      && (INTEGERP (CONSP (args[2]) ? XCAR (args[2]) : args[2])))
+      && (FIXNUMP (CONSP (args[2]) ? XCAR (args[2]) : args[2])))
     error ("Operating system cannot handle asynchronous subprocesses");
 #endif /* subprocesses */
 
@@ -403,7 +403,7 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int 
filefd,
          buffer = Qnil;
        }
 
-      if (! (NILP (buffer) || EQ (buffer, Qt) || INTEGERP (buffer)))
+      if (! (NILP (buffer) || EQ (buffer, Qt) || FIXNUMP (buffer)))
        {
          Lisp_Object spec_buffer;
          spec_buffer = buffer;
@@ -431,7 +431,7 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int 
filefd,
   for (i = 0; i < CALLPROC_FDS; i++)
     callproc_fd[i] = -1;
 #ifdef MSDOS
-  synch_process_tempfile = make_number (0);
+  synch_process_tempfile = make_fixnum (0);
 #endif
   record_unwind_protect_ptr (call_process_kill, callproc_fd);
 
@@ -440,7 +440,7 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int 
filefd,
     int ok;
 
     ok = openp (Vexec_path, args[0], Vexec_suffixes, &path,
-               make_number (X_OK), false);
+               make_fixnum (X_OK), false);
     if (ok < 0)
       report_file_error ("Searching for program", args[0]);
   }
@@ -471,7 +471,7 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int 
filefd,
   path = ENCODE_FILE (path);
   new_argv[0] = SSDATA (path);
 
-  discard_output = INTEGERP (buffer) || (NILP (buffer) && NILP (output_file));
+  discard_output = FIXNUMP (buffer) || (NILP (buffer) && NILP (output_file));
 
 #ifdef MSDOS
   if (! discard_output && ! STRINGP (output_file))
@@ -670,7 +670,7 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int 
filefd,
     {
       synch_process_pid = pid;
 
-      if (INTEGERP (buffer))
+      if (FIXNUMP (buffer))
        {
          if (tempfile_index < 0)
            record_deleted_pid (pid, Qnil);
@@ -703,7 +703,7 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int 
filefd,
 
 #endif /* not MSDOS */
 
-  if (INTEGERP (buffer))
+  if (FIXNUMP (buffer))
     return unbind_to (count, Qnil);
 
   if (BUFFERP (buffer))
@@ -870,7 +870,7 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int 
filefd,
         coding-system used to decode the process output.  */
       if (inherit_process_coding_system)
        call1 (intern ("after-insert-file-set-buffer-file-coding-system"),
-              make_number (total_read));
+              make_fixnum (total_read));
     }
 
   bool wait_ok = true;
@@ -903,7 +903,7 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int 
filefd,
     }
 
   eassert (WIFEXITED (status));
-  return make_number (WEXITSTATUS (status));
+  return make_fixnum (WEXITSTATUS (status));
 }
 
 /* Create a temporary file suitable for storing the input data of
@@ -1066,7 +1066,7 @@ usage: (call-process-region START END PROGRAM &optional 
DELETE BUFFER DISPLAY &r
       validate_region (&args[0], &args[1]);
       start = args[0];
       end = args[1];
-      empty_input = XINT (start) == XINT (end);
+      empty_input = XFIXNUM (start) == XFIXNUM (end);
     }
 
   if (!empty_input)
@@ -1644,7 +1644,7 @@ syms_of_callproc (void)
   staticpro (&Vtemp_file_name_pattern);
 
 #ifdef MSDOS
-  synch_process_tempfile = make_number (0);
+  synch_process_tempfile = make_fixnum (0);
   staticpro (&synch_process_tempfile);
 #endif
 
diff --git a/src/casefiddle.c b/src/casefiddle.c
index 8befc5a..95857d6 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -152,7 +152,7 @@ case_character_impl (struct casing_str_buf *buf,
          prop = CHAR_TABLE_REF (ctx->titlecase_char_table, ch);
          if (CHARACTERP (prop))
            {
-             cased = XFASTINT (prop);
+             cased = XFIXNAT (prop);
              cased_is_set = true;
            }
        }
@@ -225,7 +225,7 @@ do_casify_natnum (struct casing_context *ctx, Lisp_Object 
obj)
 {
   int flagbits = (CHAR_ALT | CHAR_SUPER | CHAR_HYPER
                  | CHAR_SHIFT | CHAR_CTL | CHAR_META);
-  int ch = XFASTINT (obj);
+  int ch = XFIXNAT (obj);
 
   /* If the character has higher bits set above the flags, return it unchanged.
      It is not a real character.  */
@@ -250,7 +250,7 @@ do_casify_natnum (struct casing_context *ctx, Lisp_Object 
obj)
 
   if (! multibyte)
     MAKE_CHAR_UNIBYTE (cased);
-  return make_natnum (cased | flags);
+  return make_fixed_natnum (cased | flags);
 }
 
 static Lisp_Object
@@ -319,7 +319,7 @@ casify_object (enum case_action flag, Lisp_Object obj)
   struct casing_context ctx;
   prepare_casing_context (&ctx, flag, false);
 
-  if (NATNUMP (obj))
+  if (FIXNATP (obj))
     return do_casify_natnum (&ctx, obj);
   else if (!STRINGP (obj))
     wrong_type_argument (Qchar_or_string_p, obj);
@@ -485,8 +485,8 @@ casify_region (enum case_action flag, Lisp_Object b, 
Lisp_Object e)
   struct casing_context ctx;
 
   validate_region (&b, &e);
-  ptrdiff_t start = XFASTINT (b);
-  ptrdiff_t end = XFASTINT (e);
+  ptrdiff_t start = XFIXNAT (b);
+  ptrdiff_t end = XFIXNAT (e);
   if (start == end)
     /* Not modifying because nothing marked.  */
     return end;
@@ -601,11 +601,11 @@ character positions to operate on.  */)
 static Lisp_Object
 casify_word (enum case_action flag, Lisp_Object arg)
 {
-  CHECK_NUMBER (arg);
-  ptrdiff_t farend = scan_words (PT, XINT (arg));
+  CHECK_FIXNUM (arg);
+  ptrdiff_t farend = scan_words (PT, XFIXNUM (arg));
   if (!farend)
-    farend = XINT (arg) <= 0 ? BEGV : ZV;
-  SET_PT (casify_region (flag, make_number (PT), make_number (farend)));
+    farend = XFIXNUM (arg) <= 0 ? BEGV : ZV;
+  SET_PT (casify_region (flag, make_fixnum (PT), make_fixnum (farend)));
   return Qnil;
 }
 
diff --git a/src/casetab.c b/src/casetab.c
index 36f94f4..0e742de 100644
--- a/src/casetab.c
+++ b/src/casetab.c
@@ -179,7 +179,7 @@ set_canon (Lisp_Object case_table, Lisp_Object range, 
Lisp_Object elt)
   Lisp_Object up = XCHAR_TABLE (case_table)->extras[0];
   Lisp_Object canon = XCHAR_TABLE (case_table)->extras[1];
 
-  if (NATNUMP (elt))
+  if (FIXNATP (elt))
     Fset_char_table_range (canon, range, Faref (case_table, Faref (up, elt)));
 }
 
@@ -191,21 +191,21 @@ set_canon (Lisp_Object case_table, Lisp_Object range, 
Lisp_Object elt)
 static void
 set_identity (Lisp_Object table, Lisp_Object c, Lisp_Object elt)
 {
-  if (NATNUMP (elt))
+  if (FIXNATP (elt))
     {
       int from, to;
 
       if (CONSP (c))
        {
-         from = XINT (XCAR (c));
-         to = XINT (XCDR (c));
+         from = XFIXNUM (XCAR (c));
+         to = XFIXNUM (XCDR (c));
        }
       else
-       from = to = XINT (c);
+       from = to = XFIXNUM (c);
 
       to++;
       for (; from < to; from++)
-       CHAR_TABLE_SET (table, from, make_number (from));
+       CHAR_TABLE_SET (table, from, make_fixnum (from));
     }
 }
 
@@ -217,24 +217,24 @@ set_identity (Lisp_Object table, Lisp_Object c, 
Lisp_Object elt)
 static void
 shuffle (Lisp_Object table, Lisp_Object c, Lisp_Object elt)
 {
-  if (NATNUMP (elt))
+  if (FIXNATP (elt))
     {
       int from, to;
 
       if (CONSP (c))
        {
-         from = XINT (XCAR (c));
-         to = XINT (XCDR (c));
+         from = XFIXNUM (XCAR (c));
+         to = XFIXNUM (XCDR (c));
        }
       else
-       from = to = XINT (c);
+       from = to = XFIXNUM (c);
 
       to++;
       for (; from < to; from++)
        {
          Lisp_Object tem = Faref (table, elt);
-         Faset (table, elt, make_number (from));
-         Faset (table, make_number (from), tem);
+         Faset (table, elt, make_fixnum (from));
+         Faset (table, make_fixnum (from), tem);
        }
     }
 }
@@ -246,7 +246,7 @@ init_casetab_once (void)
   Lisp_Object down, up, eqv;
 
   DEFSYM (Qcase_table, "case-table");
-  Fput (Qcase_table, Qchar_table_extra_slots, make_number (3));
+  Fput (Qcase_table, Qchar_table_extra_slots, make_fixnum (3));
 
   down = Fmake_char_table (Qcase_table, Qnil);
   Vascii_downcase_table = down;
@@ -255,7 +255,7 @@ init_casetab_once (void)
   for (i = 0; i < 128; i++)
     {
       int c = (i >= 'A' && i <= 'Z') ? i + ('a' - 'A') : i;
-      CHAR_TABLE_SET (down, i, make_number (c));
+      CHAR_TABLE_SET (down, i, make_fixnum (c));
     }
 
   set_char_table_extras (down, 1, Fcopy_sequence (down));
@@ -266,7 +266,7 @@ init_casetab_once (void)
   for (i = 0; i < 128; i++)
     {
       int c = (i >= 'a' && i <= 'z') ? i + ('A' - 'a') : i;
-      CHAR_TABLE_SET (up, i, make_number (c));
+      CHAR_TABLE_SET (up, i, make_fixnum (c));
     }
 
   eqv = Fmake_char_table (Qcase_table, Qnil);
@@ -276,7 +276,7 @@ init_casetab_once (void)
       int c = ((i >= 'A' && i <= 'Z') ? i + ('a' - 'A')
               : ((i >= 'a' && i <= 'z') ? i + ('A' - 'a')
                  : i));
-      CHAR_TABLE_SET (eqv, i, make_number (c));
+      CHAR_TABLE_SET (eqv, i, make_fixnum (c));
     }
 
   set_char_table_extras (down, 2, eqv);
diff --git a/src/category.c b/src/category.c
index 62bb7f1..d6ccde5 100644
--- a/src/category.c
+++ b/src/category.c
@@ -103,7 +103,7 @@ those categories.  */)
   while (--len >= 0)
     {
       unsigned char cat = SREF (categories, len);
-      Lisp_Object category = make_number (cat);
+      Lisp_Object category = make_fixnum (cat);
 
       CHECK_CATEGORY (category);
       set_category_set (val, cat, 1);
@@ -130,11 +130,11 @@ the current buffer's category table.  */)
   CHECK_STRING (docstring);
   table = check_category_table (table);
 
-  if (!NILP (CATEGORY_DOCSTRING (table, XFASTINT (category))))
-    error ("Category `%c' is already defined", (int) XFASTINT (category));
+  if (!NILP (CATEGORY_DOCSTRING (table, XFIXNAT (category))))
+    error ("Category `%c' is already defined", (int) XFIXNAT (category));
   if (!NILP (Vpurify_flag))
     docstring = Fpurecopy (docstring);
-  SET_CATEGORY_DOCSTRING (table, XFASTINT (category), docstring);
+  SET_CATEGORY_DOCSTRING (table, XFIXNAT (category), docstring);
 
   return Qnil;
 }
@@ -148,7 +148,7 @@ category table.  */)
   CHECK_CATEGORY (category);
   table = check_category_table (table);
 
-  return CATEGORY_DOCSTRING (table, XFASTINT (category));
+  return CATEGORY_DOCSTRING (table, XFIXNAT (category));
 }
 
 DEFUN ("get-unused-category", Fget_unused_category, Sget_unused_category,
@@ -165,7 +165,7 @@ it defaults to the current buffer's category table.  */)
 
   for (i = ' '; i <= '~'; i++)
     if (NILP (CATEGORY_DOCSTRING (table, i)))
-      return make_number (i);
+      return make_fixnum (i);
 
   return Qnil;
 }
@@ -220,9 +220,9 @@ copy_category_entry (Lisp_Object table, Lisp_Object c, 
Lisp_Object val)
 {
   val = Fcopy_sequence (val);
   if (CONSP (c))
-    char_table_set_range (table, XINT (XCAR (c)), XINT (XCDR (c)), val);
+    char_table_set_range (table, XFIXNUM (XCAR (c)), XFIXNUM (XCDR (c)), val);
   else
-    char_table_set (table, XINT (c), val);
+    char_table_set (table, XFIXNUM (c), val);
 }
 
 /* Return a copy of category table TABLE.  We can't simply use the
@@ -271,8 +271,8 @@ DEFUN ("make-category-table", Fmake_category_table, 
Smake_category_table,
   set_char_table_defalt (val, MAKE_CATEGORY_SET);
   for (i = 0; i < (1 << CHARTAB_SIZE_BITS_0); i++)
     set_char_table_contents (val, i, MAKE_CATEGORY_SET);
-  Fset_char_table_extra_slot (val, make_number (0),
-                             Fmake_vector (make_number (95), Qnil));
+  Fset_char_table_extra_slot (val, make_fixnum (0),
+                             Fmake_vector (make_fixnum (95), Qnil));
   return val;
 }
 
@@ -303,7 +303,7 @@ usage: (char-category-set CHAR)  */)
   (Lisp_Object ch)
 {
   CHECK_CHARACTER (ch);
-  return CATEGORY_SET (XFASTINT (ch));
+  return CATEGORY_SET (XFIXNAT (ch));
 }
 
 DEFUN ("category-set-mnemonics", Fcategory_set_mnemonics,
@@ -346,25 +346,25 @@ then delete CATEGORY from the category set instead of 
adding it.  */)
   int start, end;
   int from, to;
 
-  if (INTEGERP (character))
+  if (FIXNUMP (character))
     {
       CHECK_CHARACTER (character);
-      start = end = XFASTINT (character);
+      start = end = XFIXNAT (character);
     }
   else
     {
       CHECK_CONS (character);
       CHECK_CHARACTER_CAR (character);
       CHECK_CHARACTER_CDR (character);
-      start = XFASTINT (XCAR (character));
-      end = XFASTINT (XCDR (character));
+      start = XFIXNAT (XCAR (character));
+      end = XFIXNAT (XCDR (character));
     }
 
   CHECK_CATEGORY (category);
   table = check_category_table (table);
 
-  if (NILP (CATEGORY_DOCSTRING (table, XFASTINT (category))))
-    error ("Undefined category: %c", (int) XFASTINT (category));
+  if (NILP (CATEGORY_DOCSTRING (table, XFIXNAT (category))))
+    error ("Undefined category: %c", (int) XFIXNAT (category));
 
   set_value = NILP (reset);
 
@@ -372,10 +372,10 @@ then delete CATEGORY from the category set instead of 
adding it.  */)
     {
       from = start, to = end;
       category_set = char_table_ref_and_range (table, start, &from, &to);
-      if (CATEGORY_MEMBER (XFASTINT (category), category_set) != NILP (reset))
+      if (CATEGORY_MEMBER (XFIXNAT (category), category_set) != NILP (reset))
        {
          category_set = Fcopy_sequence (category_set);
-         set_category_set (category_set, XFASTINT (category), set_value);
+         set_category_set (category_set, XFIXNAT (category), set_value);
          category_set = hash_get_category_set (table, category_set);
          char_table_set_range (table, start, to, category_set);
        }
@@ -423,12 +423,12 @@ word_boundary_p (int c1, int c2)
       if (CONSP (elt)
          && (NILP (XCAR (elt))
              || (CATEGORYP (XCAR (elt))
-                 && CATEGORY_MEMBER (XFASTINT (XCAR (elt)), category_set1)
-                 && ! CATEGORY_MEMBER (XFASTINT (XCAR (elt)), category_set2)))
+                 && CATEGORY_MEMBER (XFIXNAT (XCAR (elt)), category_set1)
+                 && ! CATEGORY_MEMBER (XFIXNAT (XCAR (elt)), category_set2)))
          && (NILP (XCDR (elt))
              || (CATEGORYP (XCDR (elt))
-                 && ! CATEGORY_MEMBER (XFASTINT (XCDR (elt)), category_set1)
-                 && CATEGORY_MEMBER (XFASTINT (XCDR (elt)), category_set2))))
+                 && ! CATEGORY_MEMBER (XFIXNAT (XCDR (elt)), category_set1)
+                 && CATEGORY_MEMBER (XFIXNAT (XCDR (elt)), category_set2))))
        return !default_result;
     }
   return default_result;
@@ -440,13 +440,13 @@ init_category_once (void)
 {
   /* This has to be done here, before we call Fmake_char_table.  */
   DEFSYM (Qcategory_table, "category-table");
-  Fput (Qcategory_table, Qchar_table_extra_slots, make_number (2));
+  Fput (Qcategory_table, Qchar_table_extra_slots, make_fixnum (2));
 
   Vstandard_category_table = Fmake_char_table (Qcategory_table, Qnil);
   /* Set a category set which contains nothing to the default.  */
   set_char_table_defalt (Vstandard_category_table, MAKE_CATEGORY_SET);
-  Fset_char_table_extra_slot (Vstandard_category_table, make_number (0),
-                             Fmake_vector (make_number (95), Qnil));
+  Fset_char_table_extra_slot (Vstandard_category_table, make_fixnum (0),
+                             Fmake_vector (make_fixnum (95), Qnil));
 }
 
 void
diff --git a/src/category.h b/src/category.h
index c4feedd..cc32990 100644
--- a/src/category.h
+++ b/src/category.h
@@ -59,7 +59,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 
 INLINE_HEADER_BEGIN
 
-#define CATEGORYP(x) RANGED_INTEGERP (0x20, x, 0x7E)
+#define CATEGORYP(x) RANGED_FIXNUMP (0x20, x, 0x7E)
 
 #define CHECK_CATEGORY(x) \
   CHECK_TYPE (CATEGORYP (x), Qcategoryp, x)
@@ -68,7 +68,7 @@ INLINE_HEADER_BEGIN
   (BOOL_VECTOR_P (x) && bool_vector_size (x) == 128)
 
 /* Return a new empty category set.  */
-#define MAKE_CATEGORY_SET (Fmake_bool_vector (make_number (128), Qnil))
+#define MAKE_CATEGORY_SET (Fmake_bool_vector (make_fixnum (128), Qnil))
 
 #define CHECK_CATEGORY_SET(x) \
   CHECK_TYPE (CATEGORY_SET_P (x), Qcategorysetp, x)
@@ -77,7 +77,7 @@ INLINE_HEADER_BEGIN
 #define CATEGORY_SET(c) char_category_set (c)
 
 /* Return true if CATEGORY_SET contains CATEGORY.
-   Faster than '!NILP (Faref (category_set, make_number (category)))'.  */
+   Faster than '!NILP (Faref (category_set, make_fixnum (category)))'.  */
 INLINE bool
 CATEGORY_MEMBER (EMACS_INT category, Lisp_Object category_set)
 {
@@ -98,16 +98,16 @@ CHAR_HAS_CATEGORY (int ch, int category)
 
 /* Return the doc string of CATEGORY in category table TABLE.  */
 #define CATEGORY_DOCSTRING(table, category)                            \
-  AREF (Fchar_table_extra_slot (table, make_number (0)), ((category) - ' '))
+  AREF (Fchar_table_extra_slot (table, make_fixnum (0)), ((category) - ' '))
 
 /* Set the doc string of CATEGORY to VALUE in category table TABLE.  */
 #define SET_CATEGORY_DOCSTRING(table, category, value)                 \
-  ASET (Fchar_table_extra_slot (table, make_number (0)), ((category) - ' '), 
value)
+  ASET (Fchar_table_extra_slot (table, make_fixnum (0)), ((category) - ' '), 
value)
 
 /* Return the version number of category table TABLE.  Not used for
    the moment.  */
 #define CATEGORY_TABLE_VERSION (table) \
-  Fchar_table_extra_slot (table, make_number (1))
+  Fchar_table_extra_slot (table, make_fixnum (1))
 
 /* Return true if there is a word boundary between two
    word-constituent characters C1 and C2 if they appear in this order.
diff --git a/src/ccl.c b/src/ccl.c
index ed8588d..31d0a28 100644
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -629,7 +629,7 @@ do                                                          
\
     stack_idx++;                                               \
     ccl_prog = called_ccl.prog;                                        \
     ic = CCL_HEADER_MAIN;                                      \
-    eof_ic = XFASTINT (ccl_prog[CCL_HEADER_EOF]);              \
+    eof_ic = XFIXNAT (ccl_prog[CCL_HEADER_EOF]);               \
     goto ccl_repeat;                                           \
   }                                                            \
 while (0)
@@ -736,7 +736,7 @@ while (0)
 #define GET_CCL_RANGE(var, ccl_prog, ic, lo, hi)               \
   do                                                           \
     {                                                          \
-      EMACS_INT prog_word = XINT ((ccl_prog)[ic]);             \
+      EMACS_INT prog_word = XFIXNUM ((ccl_prog)[ic]);          \
       if (! ASCENDING_ORDER (lo, prog_word, hi))               \
        CCL_INVALID_CMD;                                        \
       (var) = prog_word;                                       \
@@ -769,12 +769,12 @@ while (0)
       CCL_INVALID_CMD;                                         \
     else if (dst + len <= dst_end)                             \
       {                                                                \
-       if (XFASTINT (ccl_prog[ic]) & 0x1000000)                \
+       if (XFIXNAT (ccl_prog[ic]) & 0x1000000)         \
          for (ccli = 0; ccli < len; ccli++)                    \
-           *dst++ = XFASTINT (ccl_prog[ic + ccli]) & 0xFFFFFF; \
+           *dst++ = XFIXNAT (ccl_prog[ic + ccli]) & 0xFFFFFF;  \
        else                                                    \
          for (ccli = 0; ccli < len; ccli++)                    \
-           *dst++ = ((XFASTINT (ccl_prog[ic + (ccli / 3)]))    \
+           *dst++ = ((XFIXNAT (ccl_prog[ic + (ccli / 3)]))     \
                      >> ((2 - (ccli % 3)) * 8)) & 0xFF;        \
       }                                                                \
     else                                                       \
@@ -926,14 +926,14 @@ ccl_driver (struct ccl_program *ccl, int *source, int 
*destination, int src_size
          break;
 
        case CCL_SetConst:      /* 00000000000000000000rrrXXXXX */
-         reg[rrr] = XINT (ccl_prog[ic++]);
+         reg[rrr] = XFIXNUM (ccl_prog[ic++]);
          break;
 
        case CCL_SetArray:      /* CCCCCCCCCCCCCCCCCCCCRRRrrrXXXXX */
          i = reg[RRR];
          j = field1 >> 3;
          if (0 <= i && i < j)
-           reg[rrr] = XINT (ccl_prog[ic + i]);
+           reg[rrr] = XFIXNUM (ccl_prog[ic + i]);
          ic += j;
          break;
 
@@ -961,13 +961,13 @@ ccl_driver (struct ccl_program *ccl, int *source, int 
*destination, int src_size
          break;
 
        case CCL_WriteConstJump: /* A--D--D--R--E--S--S-000XXXXX */
-         i = XINT (ccl_prog[ic]);
+         i = XFIXNUM (ccl_prog[ic]);
          CCL_WRITE_CHAR (i);
          ic += ADDR;
          break;
 
        case CCL_WriteConstReadJump: /* A--D--D--R--E--S--S-rrrXXXXX */
-         i = XINT (ccl_prog[ic]);
+         i = XFIXNUM (ccl_prog[ic]);
          CCL_WRITE_CHAR (i);
          ic++;
          CCL_READ_CHAR (reg[rrr]);
@@ -975,17 +975,17 @@ ccl_driver (struct ccl_program *ccl, int *source, int 
*destination, int src_size
          break;
 
        case CCL_WriteStringJump: /* A--D--D--R--E--S--S-000XXXXX */
-         j = XINT (ccl_prog[ic++]);
+         j = XFIXNUM (ccl_prog[ic++]);
          CCL_WRITE_STRING (j);
          ic += ADDR - 1;
          break;
 
        case CCL_WriteArrayReadJump: /* A--D--D--R--E--S--S-rrrXXXXX */
          i = reg[rrr];
-         j = XINT (ccl_prog[ic]);
+         j = XFIXNUM (ccl_prog[ic]);
          if (0 <= i && i < j)
            {
-             i = XINT (ccl_prog[ic + 1 + i]);
+             i = XFIXNUM (ccl_prog[ic + 1 + i]);
              CCL_WRITE_CHAR (i);
            }
          ic += j + 2;
@@ -1004,7 +1004,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int 
*destination, int src_size
        case CCL_Branch:        /* CCCCCCCCCCCCCCCCCCCCrrrXXXXX */
        {
          int ioff = 0 <= reg[rrr] && reg[rrr] < field1 ? reg[rrr] : field1;
-         int incr = XINT (ccl_prog[ic + ioff]);
+         int incr = XFIXNUM (ccl_prog[ic + ioff]);
          ic += incr;
        }
          break;
@@ -1023,7 +1023,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int 
*destination, int src_size
        case CCL_WriteExprConst:  /* 1:00000OPERATION000RRR000XXXXX */
          rrr = 7;
          i = reg[RRR];
-         j = XINT (ccl_prog[ic]);
+         j = XFIXNUM (ccl_prog[ic]);
          op = field1 >> 6;
          jump_address = ic + 1;
          goto ccl_set_expr;
@@ -1056,7 +1056,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int 
*destination, int src_size
            /* If FFF is nonzero, the CCL program ID is in the
                following code.  */
            if (rrr)
-             prog_id = XINT (ccl_prog[ic++]);
+             prog_id = XFIXNUM (ccl_prog[ic++]);
            else
              prog_id = field1;
 
@@ -1081,7 +1081,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int 
*destination, int src_size
            stack_idx++;
            ccl_prog = XVECTOR (AREF (slot, 1))->contents;
            ic = CCL_HEADER_MAIN;
-           eof_ic = XFASTINT (ccl_prog[CCL_HEADER_EOF]);
+           eof_ic = XFIXNAT (ccl_prog[CCL_HEADER_EOF]);
          }
          break;
 
@@ -1099,7 +1099,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int 
*destination, int src_size
          i = reg[rrr];
          if (0 <= i && i < field1)
            {
-             j = XINT (ccl_prog[ic + i]);
+             j = XFIXNUM (ccl_prog[ic + i]);
              CCL_WRITE_CHAR (j);
            }
          ic += field1;
@@ -1124,7 +1124,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int 
*destination, int src_size
          CCL_SUCCESS;
 
        case CCL_ExprSelfConst: /* 00000OPERATION000000rrrXXXXX */
-         i = XINT (ccl_prog[ic++]);
+         i = XFIXNUM (ccl_prog[ic++]);
          op = field1 >> 6;
          goto ccl_expr_self;
 
@@ -1160,7 +1160,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int 
*destination, int src_size
 
        case CCL_SetExprConst:  /* 00000OPERATION000RRRrrrXXXXX */
          i = reg[RRR];
-         j = XINT (ccl_prog[ic++]);
+         j = XFIXNUM (ccl_prog[ic++]);
          op = field1 >> 6;
          jump_address = ic;
          goto ccl_set_expr;
@@ -1178,8 +1178,8 @@ ccl_driver (struct ccl_program *ccl, int *source, int 
*destination, int src_size
        case CCL_JumpCondExprConst: /* A--D--D--R--E--S--S-rrrXXXXX */
          i = reg[rrr];
          jump_address = ic + ADDR;
-         op = XINT (ccl_prog[ic++]);
-         j = XINT (ccl_prog[ic++]);
+         op = XFIXNUM (ccl_prog[ic++]);
+         j = XFIXNUM (ccl_prog[ic++]);
          rrr = 7;
          goto ccl_set_expr;
 
@@ -1189,7 +1189,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int 
*destination, int src_size
        case CCL_JumpCondExprReg:
          i = reg[rrr];
          jump_address = ic + ADDR;
-         op = XINT (ccl_prog[ic++]);
+         op = XFIXNUM (ccl_prog[ic++]);
          GET_CCL_RANGE (j, ccl_prog, ic++, 0, 7);
          j = reg[j];
          rrr = 7;
@@ -1291,7 +1291,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int 
*destination, int src_size
                                : -1));
                h = GET_HASH_TABLE (eop);
 
-               eop = hash_lookup (h, make_number (reg[RRR]), NULL);
+               eop = hash_lookup (h, make_fixnum (reg[RRR]), NULL);
                if (eop >= 0)
                  {
                    Lisp_Object opl;
@@ -1318,14 +1318,14 @@ ccl_driver (struct ccl_program *ccl, int *source, int 
*destination, int src_size
                i = CCL_DECODE_CHAR (reg[RRR], reg[rrr]);
                h = GET_HASH_TABLE (eop);
 
-               eop = hash_lookup (h, make_number (i), NULL);
+               eop = hash_lookup (h, make_fixnum (i), NULL);
                if (eop >= 0)
                  {
                    Lisp_Object opl;
                    opl = HASH_VALUE (h, eop);
-                   if (! (INTEGERP (opl) && IN_INT_RANGE (XINT (opl))))
+                   if (! (FIXNUMP (opl) && IN_INT_RANGE (XFIXNUM (opl))))
                      CCL_INVALID_CMD;
-                   reg[RRR] = XINT (opl);
+                   reg[RRR] = XFIXNUM (opl);
                    reg[7] = 1; /* r7 true for success */
                  }
                else
@@ -1340,7 +1340,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int 
*destination, int src_size
                ptrdiff_t size;
                int fin_ic;
 
-               j = XINT (ccl_prog[ic++]); /* number of maps. */
+               j = XFIXNUM (ccl_prog[ic++]); /* number of maps. */
                fin_ic = ic + j;
                op = reg[rrr];
                if ((j > reg[RRR]) && (j >= 0))
@@ -1359,7 +1359,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int 
*destination, int src_size
                  {
                    if (!VECTORP (Vcode_conversion_map_vector)) continue;
                    size = ASIZE (Vcode_conversion_map_vector);
-                   point = XINT (ccl_prog[ic++]);
+                   point = XFIXNUM (ccl_prog[ic++]);
                    if (! (0 <= point && point < size)) continue;
                    map = AREF (Vcode_conversion_map_vector, point);
 
@@ -1375,19 +1375,19 @@ ccl_driver (struct ccl_program *ccl, int *source, int 
*destination, int src_size
                    /* check map type,
                       [STARTPOINT VAL1 VAL2 ...] or
                       [t ELEMENT STARTPOINT ENDPOINT]  */
-                   if (INTEGERP (content))
+                   if (FIXNUMP (content))
                      {
-                       point = XINT (content);
+                       point = XFIXNUM (content);
                        if (!(point <= op && op - point + 1 < size)) continue;
                        content = AREF (map, op - point + 1);
                      }
                    else if (EQ (content, Qt))
                      {
                        if (size != 4) continue;
-                       if (INTEGERP (AREF (map, 2))
-                           && XINT (AREF (map, 2)) <= op
-                           && INTEGERP (AREF (map, 3))
-                           && op < XINT (AREF (map, 3)))
+                       if (FIXNUMP (AREF (map, 2))
+                           && XFIXNUM (AREF (map, 2)) <= op
+                           && FIXNUMP (AREF (map, 3))
+                           && op < XFIXNUM (AREF (map, 3)))
                          content = AREF (map, 1);
                        else
                          continue;
@@ -1397,10 +1397,10 @@ ccl_driver (struct ccl_program *ccl, int *source, int 
*destination, int src_size
 
                    if (NILP (content))
                      continue;
-                   else if (INTEGERP (content) && IN_INT_RANGE (XINT 
(content)))
+                   else if (FIXNUMP (content) && IN_INT_RANGE (XFIXNUM 
(content)))
                      {
                        reg[RRR] = i;
-                       reg[rrr] = XINT (content);
+                       reg[rrr] = XFIXNUM (content);
                        break;
                      }
                    else if (EQ (content, Qt) || EQ (content, Qlambda))
@@ -1412,11 +1412,11 @@ ccl_driver (struct ccl_program *ccl, int *source, int 
*destination, int src_size
                      {
                        attrib = XCAR (content);
                        value = XCDR (content);
-                       if (! (INTEGERP (attrib) && INTEGERP (value)
-                              && IN_INT_RANGE (XINT (value))))
+                       if (! (FIXNUMP (attrib) && FIXNUMP (value)
+                              && IN_INT_RANGE (XFIXNUM (value))))
                          continue;
                        reg[RRR] = i;
-                       reg[rrr] = XINT (value);
+                       reg[rrr] = XFIXNUM (value);
                        break;
                      }
                    else if (SYMBOLP (content))
@@ -1453,7 +1453,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int 
*destination, int src_size
                stack_idx_of_map_multiple = 0;
 
                /* Get number of maps and separators.  */
-               map_set_rest_length = XINT (ccl_prog[ic++]);
+               map_set_rest_length = XFIXNUM (ccl_prog[ic++]);
 
                fin_ic = ic + map_set_rest_length;
                op = reg[rrr];
@@ -1524,7 +1524,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int 
*destination, int src_size
                do {
                  for (;map_set_rest_length > 0;i++, ic++, 
map_set_rest_length--)
                    {
-                     point = XINT (ccl_prog[ic]);
+                     point = XFIXNUM (ccl_prog[ic]);
                      if (point < 0)
                        {
                          /* +1 is for including separator. */
@@ -1554,19 +1554,19 @@ ccl_driver (struct ccl_program *ccl, int *source, int 
*destination, int src_size
                      /* check map type,
                         [STARTPOINT VAL1 VAL2 ...] or
                         [t ELEMENT STARTPOINT ENDPOINT]  */
-                     if (INTEGERP (content))
+                     if (FIXNUMP (content))
                        {
-                         point = XINT (content);
+                         point = XFIXNUM (content);
                          if (!(point <= op && op - point + 1 < size)) continue;
                          content = AREF (map, op - point + 1);
                        }
                      else if (EQ (content, Qt))
                        {
                          if (size != 4) continue;
-                         if (INTEGERP (AREF (map, 2))
-                             && XINT (AREF (map, 2)) <= op
-                             && INTEGERP (AREF (map, 3))
-                             && op < XINT (AREF (map, 3)))
+                         if (FIXNUMP (AREF (map, 2))
+                             && XFIXNUM (AREF (map, 2)) <= op
+                             && FIXNUMP (AREF (map, 3))
+                             && op < XFIXNUM (AREF (map, 3)))
                            content = AREF (map, 1);
                          else
                            continue;
@@ -1578,9 +1578,9 @@ ccl_driver (struct ccl_program *ccl, int *source, int 
*destination, int src_size
                        continue;
 
                      reg[RRR] = i;
-                     if (INTEGERP (content) && IN_INT_RANGE (XINT (content)))
+                     if (FIXNUMP (content) && IN_INT_RANGE (XFIXNUM (content)))
                        {
-                         op = XINT (content);
+                         op = XFIXNUM (content);
                          i += map_set_rest_length - 1;
                          ic += map_set_rest_length - 1;
                          POP_MAPPING_STACK (map_set_rest_length, reg[rrr]);
@@ -1590,10 +1590,10 @@ ccl_driver (struct ccl_program *ccl, int *source, int 
*destination, int src_size
                        {
                          attrib = XCAR (content);
                          value = XCDR (content);
-                         if (! (INTEGERP (attrib) && INTEGERP (value)
-                                && IN_INT_RANGE (XINT (value))))
+                         if (! (FIXNUMP (attrib) && FIXNUMP (value)
+                                && IN_INT_RANGE (XFIXNUM (value))))
                            continue;
-                         op = XINT (value);
+                         op = XFIXNUM (value);
                          i += map_set_rest_length - 1;
                          ic += map_set_rest_length - 1;
                          POP_MAPPING_STACK (map_set_rest_length, reg[rrr]);
@@ -1639,7 +1639,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int 
*destination, int src_size
              {
                Lisp_Object map, attrib, value, content;
                int point;
-               j = XINT (ccl_prog[ic++]); /* map_id */
+               j = XFIXNUM (ccl_prog[ic++]); /* map_id */
                op = reg[rrr];
                if (! (VECTORP (Vcode_conversion_map_vector)
                       && j < ASIZE (Vcode_conversion_map_vector)))
@@ -1656,29 +1656,29 @@ ccl_driver (struct ccl_program *ccl, int *source, int 
*destination, int src_size
                map = XCDR (map);
                if (! (VECTORP (map)
                       && 0 < ASIZE (map)
-                      && INTEGERP (AREF (map, 0))
-                      && XINT (AREF (map, 0)) <= op
-                      && op - XINT (AREF (map, 0)) + 1 < ASIZE (map)))
+                      && FIXNUMP (AREF (map, 0))
+                      && XFIXNUM (AREF (map, 0)) <= op
+                      && op - XFIXNUM (AREF (map, 0)) + 1 < ASIZE (map)))
                  {
                    reg[RRR] = -1;
                    break;
                  }
-               point = op - XINT (AREF (map, 0)) + 1;
+               point = op - XFIXNUM (AREF (map, 0)) + 1;
                reg[RRR] = 0;
                content = AREF (map, point);
                if (NILP (content))
                  reg[RRR] = -1;
-               else if (TYPE_RANGED_INTEGERP (int, content))
-                 reg[rrr] = XINT (content);
+               else if (TYPE_RANGED_FIXNUMP (int, content))
+                 reg[rrr] = XFIXNUM (content);
                else if (EQ (content, Qt));
                else if (CONSP (content))
                  {
                    attrib = XCAR (content);
                    value = XCDR (content);
-                   if (!INTEGERP (attrib)
-                       || !TYPE_RANGED_INTEGERP (int, value))
+                   if (!FIXNUMP (attrib)
+                       || !TYPE_RANGED_FIXNUMP (int, value))
                      continue;
-                   reg[rrr] = XINT (value);
+                   reg[rrr] = XFIXNUM (value);
                    break;
                  }
                else if (SYMBOLP (content))
@@ -1809,7 +1809,7 @@ resolve_symbol_ccl_program (Lisp_Object ccl)
   for (i = 0; i < veclen; i++)
     {
       contents = AREF (result, i);
-      if (TYPE_RANGED_INTEGERP (int, contents))
+      if (TYPE_RANGED_FIXNUMP (int, contents))
        continue;
       else if (CONSP (contents)
               && SYMBOLP (XCAR (contents))
@@ -1819,7 +1819,7 @@ resolve_symbol_ccl_program (Lisp_Object ccl)
             (SYMBOL . PROPERTY).  (get SYMBOL PROPERTY) should give
             an index number.  */
          val = Fget (XCAR (contents), XCDR (contents));
-         if (RANGED_INTEGERP (0, val, INT_MAX))
+         if (RANGED_FIXNUMP (0, val, INT_MAX))
            ASET (result, i, val);
          else
            unresolved = 1;
@@ -1831,17 +1831,17 @@ resolve_symbol_ccl_program (Lisp_Object ccl)
              may lead to a bug if, for instance, a translation table
              and a code conversion map have the same name.  */
          val = Fget (contents, Qtranslation_table_id);
-         if (RANGED_INTEGERP (0, val, INT_MAX))
+         if (RANGED_FIXNUMP (0, val, INT_MAX))
            ASET (result, i, val);
          else
            {
              val = Fget (contents, Qcode_conversion_map_id);
-             if (RANGED_INTEGERP (0, val, INT_MAX))
+             if (RANGED_FIXNUMP (0, val, INT_MAX))
                ASET (result, i, val);
              else
                {
                  val = Fget (contents, Qccl_program_idx);
-                 if (RANGED_INTEGERP (0, val, INT_MAX))
+                 if (RANGED_FIXNUMP (0, val, INT_MAX))
                    ASET (result, i, val);
                  else
                    unresolved = 1;
@@ -1852,8 +1852,8 @@ resolve_symbol_ccl_program (Lisp_Object ccl)
       return Qnil;
     }
 
-  if (! (0 <= XINT (AREF (result, CCL_HEADER_BUF_MAG))
-        && ASCENDING_ORDER (0, XINT (AREF (result, CCL_HEADER_EOF)),
+  if (! (0 <= XFIXNUM (AREF (result, CCL_HEADER_BUF_MAG))
+        && ASCENDING_ORDER (0, XFIXNUM (AREF (result, CCL_HEADER_EOF)),
                             ASIZE (ccl))))
     return Qnil;
 
@@ -1881,15 +1881,15 @@ ccl_get_compiled_code (Lisp_Object ccl_prog, ptrdiff_t 
*idx)
     return Qnil;
 
   val = Fget (ccl_prog, Qccl_program_idx);
-  if (! NATNUMP (val)
-      || XINT (val) >= ASIZE (Vccl_program_table))
+  if (! FIXNATP (val)
+      || XFIXNUM (val) >= ASIZE (Vccl_program_table))
     return Qnil;
-  slot = AREF (Vccl_program_table, XINT (val));
+  slot = AREF (Vccl_program_table, XFIXNUM (val));
   if (! VECTORP (slot)
       || ASIZE (slot) != 4
       || ! VECTORP (AREF (slot, 1)))
     return Qnil;
-  *idx = XINT (val);
+  *idx = XFIXNUM (val);
   if (NILP (AREF (slot, 2)))
     {
       val = resolve_symbol_ccl_program (AREF (slot, 1));
@@ -1920,8 +1920,8 @@ setup_ccl_program (struct ccl_program *ccl, Lisp_Object 
ccl_prog)
       vp = XVECTOR (ccl_prog);
       ccl->size = vp->header.size;
       ccl->prog = vp->contents;
-      ccl->eof_ic = XINT (vp->contents[CCL_HEADER_EOF]);
-      ccl->buf_magnification = XINT (vp->contents[CCL_HEADER_BUF_MAG]);
+      ccl->eof_ic = XFIXNUM (vp->contents[CCL_HEADER_EOF]);
+      ccl->buf_magnification = XFIXNUM (vp->contents[CCL_HEADER_BUF_MAG]);
       if (ccl->idx >= 0)
        {
          Lisp_Object slot;
@@ -1956,8 +1956,8 @@ See the documentation of `define-ccl-program' for the 
detail of CCL program.  */
     return Qnil;
 
   val = Fget (object, Qccl_program_idx);
-  return ((! NATNUMP (val)
-          || XINT (val) >= ASIZE (Vccl_program_table))
+  return ((! FIXNATP (val)
+          || XFIXNUM (val) >= ASIZE (Vccl_program_table))
          ? Qnil : Qt);
 }
 
@@ -1990,8 +1990,8 @@ programs.  */)
     error ("Length of vector REGISTERS is not 8");
 
   for (i = 0; i < 8; i++)
-    ccl.reg[i] = (TYPE_RANGED_INTEGERP (int, AREF (reg, i))
-                 ? XINT (AREF (reg, i))
+    ccl.reg[i] = (TYPE_RANGED_FIXNUMP (int, AREF (reg, i))
+                 ? XFIXNUM (AREF (reg, i))
                  : 0);
 
   ccl_driver (&ccl, NULL, NULL, 0, 0, Qnil);
@@ -2000,7 +2000,7 @@ programs.  */)
     error ("Error in CCL program at %dth code", ccl.ic);
 
   for (i = 0; i < 8; i++)
-    ASET (reg, i, make_number (ccl.reg[i]));
+    ASET (reg, i, make_fixnum (ccl.reg[i]));
   return Qnil;
 }
 
@@ -2058,13 +2058,13 @@ usage: (ccl-execute-on-string CCL-PROGRAM STATUS STRING 
&optional CONTINUE UNIBY
   for (i = 0; i < 8; i++)
     {
       if (NILP (AREF (status, i)))
-       ASET (status, i, make_number (0));
-      if (TYPE_RANGED_INTEGERP (int, AREF (status, i)))
-       ccl.reg[i] = XINT (AREF (status, i));
+       ASET (status, i, make_fixnum (0));
+      if (TYPE_RANGED_FIXNUMP (int, AREF (status, i)))
+       ccl.reg[i] = XFIXNUM (AREF (status, i));
     }
-  if (INTEGERP (AREF (status, i)))
+  if (FIXNUMP (AREF (status, i)))
     {
-      i = XFASTINT (AREF (status, 8));
+      i = XFIXNAT (AREF (status, 8));
       if (ccl.ic < i && i < ccl.size)
        ccl.ic = i;
     }
@@ -2139,8 +2139,8 @@ usage: (ccl-execute-on-string CCL-PROGRAM STATUS STRING 
&optional CONTINUE UNIBY
     error ("CCL program interrupted at %dth code", ccl.ic);
 
   for (i = 0; i < 8; i++)
-    ASET (status, i, make_number (ccl.reg[i]));
-  ASET (status, 8, make_number (ccl.ic));
+    ASET (status, i, make_fixnum (ccl.reg[i]));
+  ASET (status, 8, make_fixnum (ccl.ic));
 
   val = make_specified_string ((const char *) outbuf, produced_chars,
                               outp - outbuf, NILP (unibyte_p));
@@ -2193,7 +2193,7 @@ Return index number of the registered CCL program.  */)
          ASET (slot, 1, ccl_prog);
          ASET (slot, 2, resolved);
          ASET (slot, 3, Qt);
-         return make_number (idx);
+         return make_fixnum (idx);
        }
     }
 
@@ -2211,8 +2211,8 @@ Return index number of the registered CCL program.  */)
     ASET (Vccl_program_table, idx, elt);
   }
 
-  Fput (name, Qccl_program_idx, make_number (idx));
-  return make_number (idx);
+  Fput (name, Qccl_program_idx, make_fixnum (idx));
+  return make_fixnum (idx);
 }
 
 /* Register code conversion map.
@@ -2251,7 +2251,7 @@ Return index number of the registered map.  */)
 
       if (EQ (symbol, XCAR (slot)))
        {
-         idx = make_number (i);
+         idx = make_fixnum (i);
          XSETCDR (slot, map);
          Fput (symbol, Qcode_conversion_map, map);
          Fput (symbol, Qcode_conversion_map_id, idx);
@@ -2263,7 +2263,7 @@ Return index number of the registered map.  */)
     Vcode_conversion_map_vector = larger_vector (Vcode_conversion_map_vector,
                                                 1, -1);
 
-  idx = make_number (i);
+  idx = make_fixnum (i);
   Fput (symbol, Qcode_conversion_map, map);
   Fput (symbol, Qcode_conversion_map_id, idx);
   ASET (Vcode_conversion_map_vector, i, Fcons (symbol, map));
@@ -2275,7 +2275,7 @@ void
 syms_of_ccl (void)
 {
   staticpro (&Vccl_program_table);
-  Vccl_program_table = Fmake_vector (make_number (32), Qnil);
+  Vccl_program_table = Fmake_vector (make_fixnum (32), Qnil);
 
   DEFSYM (Qccl, "ccl");
   DEFSYM (Qcclp, "cclp");
@@ -2291,7 +2291,7 @@ syms_of_ccl (void)
 
   DEFVAR_LISP ("code-conversion-map-vector", Vcode_conversion_map_vector,
               doc: /* Vector of code conversion maps.  */);
-  Vcode_conversion_map_vector = Fmake_vector (make_number (16), Qnil);
+  Vcode_conversion_map_vector = Fmake_vector (make_fixnum (16), Qnil);
 
   DEFVAR_LISP ("font-ccl-encoder-alist", Vfont_ccl_encoder_alist,
               doc: /* Alist of fontname patterns vs corresponding CCL program.
diff --git a/src/character.c b/src/character.c
index 8920da2..0b14e47 100644
--- a/src/character.c
+++ b/src/character.c
@@ -207,7 +207,7 @@ translate_char (Lisp_Object table, int c)
 
       ch = CHAR_TABLE_REF (table, c);
       if (CHARACTERP (ch))
-       c = XINT (ch);
+       c = XFIXNUM (ch);
     }
   else
     {
@@ -234,7 +234,7 @@ DEFUN ("max-char", Fmax_char, Smax_char, 0, 0, 0,
        attributes: const)
   (void)
 {
-  return make_number (MAX_CHAR);
+  return make_fixnum (MAX_CHAR);
 }
 
 DEFUN ("unibyte-char-to-multibyte", Funibyte_char_to_multibyte,
@@ -245,11 +245,11 @@ DEFUN ("unibyte-char-to-multibyte", 
Funibyte_char_to_multibyte,
   int c;
 
   CHECK_CHARACTER (ch);
-  c = XFASTINT (ch);
+  c = XFIXNAT (ch);
   if (c >= 0x100)
     error ("Not a unibyte character: %d", c);
   MAKE_CHAR_MULTIBYTE (c);
-  return make_number (c);
+  return make_fixnum (c);
 }
 
 DEFUN ("multibyte-char-to-unibyte", Fmultibyte_char_to_unibyte,
@@ -261,7 +261,7 @@ If the multibyte character does not represent a byte, 
return -1.  */)
   int cm;
 
   CHECK_CHARACTER (ch);
-  cm = XFASTINT (ch);
+  cm = XFIXNAT (ch);
   if (cm < 256)
     /* Can't distinguish a byte read from a unibyte buffer from
        a latin1 char, so let's let it slide.  */
@@ -269,7 +269,7 @@ If the multibyte character does not represent a byte, 
return -1.  */)
   else
     {
       int cu = CHAR_TO_BYTE_SAFE (cm);
-      return make_number (cu);
+      return make_fixnum (cu);
     }
 }
 
@@ -294,7 +294,7 @@ char_width (int c, struct Lisp_Char_Table *dp)
            if (GLYPH_CODE_P (ch))
              c = GLYPH_CODE_CHAR (ch);
            else if (CHARACTERP (ch))
-             c = XFASTINT (ch);
+             c = XFIXNUM (ch);
            if (c >= 0)
              {
                int w = CHARACTER_WIDTH (c);
@@ -318,9 +318,9 @@ usage: (char-width CHAR)  */)
   ptrdiff_t width;
 
   CHECK_CHARACTER (ch);
-  c = XINT (ch);
+  c = XFIXNUM (ch);
   width = char_width (c, buffer_display_table ());
-  return make_number (width);
+  return make_fixnum (width);
 }
 
 /* Return width of string STR of length LEN when displayed in the
@@ -861,7 +861,7 @@ usage: (string &rest CHARACTERS)  */)
   for (i = 0; i < n; i++)
     {
       CHECK_CHARACTER (args[i]);
-      c = XINT (args[i]);
+      c = XFIXNUM (args[i]);
       p += CHAR_STRING (c, p);
     }
 
@@ -884,7 +884,7 @@ usage: (unibyte-string &rest BYTES)  */)
   for (i = 0; i < n; i++)
     {
       CHECK_RANGED_INTEGER (args[i], 0, 255);
-      *p++ = XINT (args[i]);
+      *p++ = XFIXNUM (args[i]);
     }
 
   str = make_string_from_bytes ((char *) buf, n, p - buf);
@@ -902,9 +902,9 @@ usage: (char-resolve-modifiers CHAR)  */)
 {
   EMACS_INT c;
 
-  CHECK_NUMBER (character);
-  c = XINT (character);
-  return make_number (char_resolve_modifier_mask (c));
+  CHECK_FIXNUM (character);
+  c = XFIXNUM (character);
+  return make_fixnum (char_resolve_modifier_mask (c));
 }
 
 DEFUN ("get-byte", Fget_byte, Sget_byte, 0, 2, 0,
@@ -931,14 +931,14 @@ character is not ASCII nor 8-bit character, an error is 
signaled.  */)
        }
       else
        {
-         CHECK_NUMBER_COERCE_MARKER (position);
-         if (XINT (position) < BEGV || XINT (position) >= ZV)
-           args_out_of_range_3 (position, make_number (BEGV), make_number 
(ZV));
-         pos = XFASTINT (position);
+         CHECK_FIXNUM_COERCE_MARKER (position);
+         if (XFIXNUM (position) < BEGV || XFIXNUM (position) >= ZV)
+           args_out_of_range_3 (position, make_fixnum (BEGV), make_fixnum 
(ZV));
+         pos = XFIXNAT (position);
          p = CHAR_POS_ADDR (pos);
        }
       if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
-       return make_number (*p);
+       return make_fixnum (*p);
     }
   else
     {
@@ -949,21 +949,21 @@ character is not ASCII nor 8-bit character, an error is 
signaled.  */)
        }
       else
        {
-         CHECK_NATNUM (position);
-         if (XINT (position) >= SCHARS (string))
+         CHECK_FIXNAT (position);
+         if (XFIXNUM (position) >= SCHARS (string))
            args_out_of_range (string, position);
-         pos = XFASTINT (position);
+         pos = XFIXNAT (position);
          p = SDATA (string) + string_char_to_byte (string, pos);
        }
       if (! STRING_MULTIBYTE (string))
-       return make_number (*p);
+       return make_fixnum (*p);
     }
   c = STRING_CHAR (p);
   if (CHAR_BYTE8_P (c))
     c = CHAR_TO_BYTE8 (c);
   else if (! ASCII_CHAR_P (c))
     error ("Not an ASCII nor an 8-bit character: %d", c);
-  return make_number (c);
+  return make_fixnum (c);
 }
 
 /* Return true if C is an alphabetic character.  */
@@ -971,9 +971,9 @@ bool
 alphabeticp (int c)
 {
   Lisp_Object category = CHAR_TABLE_REF (Vunicode_category_table, c);
-  if (! INTEGERP (category))
+  if (! FIXNUMP (category))
     return false;
-  EMACS_INT gen_cat = XINT (category);
+  EMACS_INT gen_cat = XFIXNUM (category);
 
   /* See UTS #18.  There are additional characters that should be
      here, those designated as Other_uppercase, Other_lowercase,
@@ -994,9 +994,9 @@ bool
 alphanumericp (int c)
 {
   Lisp_Object category = CHAR_TABLE_REF (Vunicode_category_table, c);
-  if (! INTEGERP (category))
+  if (! FIXNUMP (category))
     return false;
-  EMACS_INT gen_cat = XINT (category);
+  EMACS_INT gen_cat = XFIXNUM (category);
 
   /* See UTS #18.  Same comment as for alphabeticp applies.  FIXME. */
   return (gen_cat == UNICODE_CATEGORY_Lu
@@ -1016,9 +1016,9 @@ bool
 graphicp (int c)
 {
   Lisp_Object category = CHAR_TABLE_REF (Vunicode_category_table, c);
-  if (! INTEGERP (category))
+  if (! FIXNUMP (category))
     return false;
-  EMACS_INT gen_cat = XINT (category);
+  EMACS_INT gen_cat = XFIXNUM (category);
 
   /* See UTS #18.  */
   return (!(gen_cat == UNICODE_CATEGORY_Zs /* space separator */
@@ -1034,9 +1034,9 @@ bool
 printablep (int c)
 {
   Lisp_Object category = CHAR_TABLE_REF (Vunicode_category_table, c);
-  if (! INTEGERP (category))
+  if (! FIXNUMP (category))
     return false;
-  EMACS_INT gen_cat = XINT (category);
+  EMACS_INT gen_cat = XFIXNUM (category);
 
   /* See UTS #18.  */
   return (!(gen_cat == UNICODE_CATEGORY_Cc /* control */
@@ -1050,10 +1050,10 @@ bool
 blankp (int c)
 {
   Lisp_Object category = CHAR_TABLE_REF (Vunicode_category_table, c);
-  if (! INTEGERP (category))
+  if (! FIXNUMP (category))
     return false;
 
-  return XINT (category) == UNICODE_CATEGORY_Zs; /* separator, space */
+  return XFIXNUM (category) == UNICODE_CATEGORY_Zs; /* separator, space */
 }
 
 
@@ -1124,7 +1124,7 @@ syms_of_character (void)
 Vector recording all translation tables ever defined.
 Each element is a pair (SYMBOL . TABLE) relating the table to the
 symbol naming it.  The ID of a translation table is an index into this vector. 
 */);
-  Vtranslation_table_vector = Fmake_vector (make_number (16), Qnil);
+  Vtranslation_table_vector = Fmake_vector (make_fixnum (16), Qnil);
 
   DEFVAR_LISP ("auto-fill-chars", Vauto_fill_chars,
               doc: /*
@@ -1137,26 +1137,26 @@ Such characters have value t in this table.  */);
   DEFVAR_LISP ("char-width-table", Vchar_width_table,
               doc: /*
 A char-table for width (columns) of each character.  */);
-  Vchar_width_table = Fmake_char_table (Qnil, make_number (1));
-  char_table_set_range (Vchar_width_table, 0x80, 0x9F, make_number (4));
+  Vchar_width_table = Fmake_char_table (Qnil, make_fixnum (1));
+  char_table_set_range (Vchar_width_table, 0x80, 0x9F, make_fixnum (4));
   char_table_set_range (Vchar_width_table, MAX_5_BYTE_CHAR + 1, MAX_CHAR,
-                       make_number (4));
+                       make_fixnum (4));
 
   DEFVAR_LISP ("printable-chars", Vprintable_chars,
               doc: /* A char-table for each printable character.  */);
   Vprintable_chars = Fmake_char_table (Qnil, Qnil);
   Fset_char_table_range (Vprintable_chars,
-                        Fcons (make_number (32), make_number (126)), Qt);
+                        Fcons (make_fixnum (32), make_fixnum (126)), Qt);
   Fset_char_table_range (Vprintable_chars,
-                        Fcons (make_number (160),
-                               make_number (MAX_5_BYTE_CHAR)), Qt);
+                        Fcons (make_fixnum (160),
+                               make_fixnum (MAX_5_BYTE_CHAR)), Qt);
 
   DEFVAR_LISP ("char-script-table", Vchar_script_table,
               doc: /* Char table of script symbols.
 It has one extra slot whose value is a list of script symbols.  */);
 
   DEFSYM (Qchar_script_table, "char-script-table");
-  Fput (Qchar_script_table, Qchar_table_extra_slots, make_number (1));
+  Fput (Qchar_script_table, Qchar_table_extra_slots, make_fixnum (1));
   Vchar_script_table = Fmake_char_table (Qchar_script_table, Qnil);
 
   DEFVAR_LISP ("script-representative-chars", Vscript_representative_chars,
diff --git a/src/character.h b/src/character.h
index 66dfa55..5dff85a 100644
--- a/src/character.h
+++ b/src/character.h
@@ -123,7 +123,7 @@ enum
 #define MAX_MULTIBYTE_LENGTH 5
 
 /* Nonzero iff X is a character.  */
-#define CHARACTERP(x) (NATNUMP (x) && XFASTINT (x) <= MAX_CHAR)
+#define CHARACTERP(x) (FIXNATP (x) && XFIXNAT (x) <= MAX_CHAR)
 
 /* Nonzero iff C is valid as a character code.  */
 #define CHAR_VALID_P(c) UNSIGNED_CMP (c, <=, MAX_CHAR)
@@ -559,7 +559,7 @@ enum
 /* Return a non-outlandish value for the tab width.  */
 
 #define SANE_TAB_WIDTH(buf) \
-  sanitize_tab_width (XFASTINT (BVAR (buf, tab_width)))
+  sanitize_tab_width (XFIXNAT (BVAR (buf, tab_width)))
 INLINE int
 sanitize_tab_width (EMACS_INT width)
 {
@@ -595,7 +595,7 @@ sanitize_char_width (EMACS_INT width)
 #define CHARACTER_WIDTH(c)     \
   (ASCII_CHAR_P (c)            \
    ? ASCII_CHAR_WIDTH (c)      \
-   : sanitize_char_width (XINT (CHAR_TABLE_REF (Vchar_width_table, c))))
+   : sanitize_char_width (XFIXNUM (CHAR_TABLE_REF (Vchar_width_table, c))))
 
 /* If C is a variation selector, return the index of the
    variation selector (1..256).  Otherwise, return 0.  */
@@ -700,7 +700,7 @@ char_table_translate (Lisp_Object obj, int ch)
   eassert (CHAR_VALID_P (ch));
   eassert (CHAR_TABLE_P (obj));
   obj = CHAR_TABLE_REF (obj, ch);
-  return CHARACTERP (obj) ? XINT (obj) : ch;
+  return CHARACTERP (obj) ? XFIXNUM (obj) : ch;
 }
 
 #if defined __GNUC__ && !defined __STRICT_ANSI__
diff --git a/src/charset.c b/src/charset.c
index 05290e8..e77a390 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -261,7 +261,7 @@ load_charset_map (struct charset *charset, struct 
charset_map_entries *entries,
                {
                  int n = CODE_POINT_TO_INDEX (charset, max_code) + 1;
 
-                 vec = Fmake_vector (make_number (n), make_number (-1));
+                 vec = Fmake_vector (make_fixnum (n), make_fixnum (-1));
                  set_charset_attr (charset, charset_decoder, vec);
                }
              else
@@ -340,12 +340,12 @@ load_charset_map (struct charset *charset, struct 
charset_map_entries *entries,
        {
          if (charset->method == CHARSET_METHOD_MAP)
            for (; from_index < lim_index; from_index++, from_c++)
-             ASET (vec, from_index, make_number (from_c));
+             ASET (vec, from_index, make_fixnum (from_c));
          else
            for (; from_index < lim_index; from_index++, from_c++)
              CHAR_TABLE_SET (Vchar_unify_table,
                              CHARSET_CODE_OFFSET (charset) + from_index,
-                             make_number (from_c));
+                             make_fixnum (from_c));
        }
       else if (control_flag == 2)
        {
@@ -357,13 +357,13 @@ load_charset_map (struct charset *charset, struct 
charset_map_entries *entries,
                code = INDEX_TO_CODE_POINT (charset, code);
 
                if (NILP (CHAR_TABLE_REF (table, from_c)))
-                 CHAR_TABLE_SET (table, from_c, make_number (code));
+                 CHAR_TABLE_SET (table, from_c, make_fixnum (code));
              }
          else
            for (; from_index < lim_index; from_index++, from_c++)
              {
                if (NILP (CHAR_TABLE_REF (table, from_c)))
-                 CHAR_TABLE_SET (table, from_c, make_number (from_index));
+                 CHAR_TABLE_SET (table, from_c, make_fixnum (from_index));
              }
        }
       else if (control_flag == 3)
@@ -587,14 +587,14 @@ load_charset_map_from_vector (struct charset *charset, 
Lisp_Object vec, int cont
        {
          val2 = XCDR (val);
          val = XCAR (val);
-         from = XFASTINT (val);
-         to = XFASTINT (val2);
+         from = XFIXNAT (val);
+         to = XFIXNAT (val2);
        }
       else
-       from = to = XFASTINT (val);
+       from = to = XFIXNAT (val);
       val = AREF (vec, i + 1);
-      CHECK_NATNUM (val);
-      c = XFASTINT (val);
+      CHECK_FIXNAT (val);
+      c = XFIXNAT (val);
 
       if (from < min_code || to > max_code || from > to || c > MAX_CHAR)
        continue;
@@ -675,11 +675,11 @@ map_charset_for_dump (void (*c_function) (Lisp_Object, 
Lisp_Object),
       if (idx >= from_idx && idx <= to_idx)
        {
          if (NILP (XCAR (range)))
-           XSETCAR (range, make_number (c));
+           XSETCAR (range, make_fixnum (c));
        }
       else if (! NILP (XCAR (range)))
        {
-         XSETCDR (range, make_number (c - 1));
+         XSETCDR (range, make_fixnum (c - 1));
          if (c_function)
            (*c_function) (arg, range);
          else
@@ -692,7 +692,7 @@ map_charset_for_dump (void (*c_function) (Lisp_Object, 
Lisp_Object),
            {
              if (! NILP (XCAR (range)))
                {
-                 XSETCDR (range, make_number (c));
+                 XSETCDR (range, make_fixnum (c));
                  if (c_function)
                    (*c_function) (arg, range);
                  else
@@ -734,7 +734,7 @@ map_charset_chars (void (*c_function)(Lisp_Object, 
Lisp_Object), Lisp_Object fun
            map_charset_for_dump (c_function, function, arg, from, to);
        }
 
-      range = Fcons (make_number (from_c), make_number (to_c));
+      range = Fcons (make_fixnum (from_c), make_fixnum (to_c));
       if (NILP (function))
        (*c_function) (arg, range);
       else
@@ -757,14 +757,14 @@ map_charset_chars (void (*c_function)(Lisp_Object, 
Lisp_Object), Lisp_Object fun
       int offset;
 
       subset_info = CHARSET_SUBSET (charset);
-      charset = CHARSET_FROM_ID (XFASTINT (AREF (subset_info, 0)));
-      offset = XINT (AREF (subset_info, 3));
+      charset = CHARSET_FROM_ID (XFIXNAT (AREF (subset_info, 0)));
+      offset = XFIXNUM (AREF (subset_info, 3));
       from -= offset;
-      if (from < XFASTINT (AREF (subset_info, 1)))
-       from = XFASTINT (AREF (subset_info, 1));
+      if (from < XFIXNAT (AREF (subset_info, 1)))
+       from = XFIXNAT (AREF (subset_info, 1));
       to -= offset;
-      if (to > XFASTINT (AREF (subset_info, 2)))
-       to = XFASTINT (AREF (subset_info, 2));
+      if (to > XFIXNAT (AREF (subset_info, 2)))
+       to = XFIXNAT (AREF (subset_info, 2));
       map_charset_chars (c_function, function, arg, charset, from, to);
     }
   else                         /* i.e. CHARSET_METHOD_SUPERSET */
@@ -777,8 +777,8 @@ map_charset_chars (void (*c_function)(Lisp_Object, 
Lisp_Object), Lisp_Object fun
          int offset;
          unsigned this_from, this_to;
 
-         charset = CHARSET_FROM_ID (XFASTINT (XCAR (XCAR (parents))));
-         offset = XINT (XCDR (XCAR (parents)));
+         charset = CHARSET_FROM_ID (XFIXNAT (XCAR (XCAR (parents))));
+         offset = XFIXNUM (XCDR (XCAR (parents)));
          this_from = from > offset ? from - offset : 0;
          this_to = to > offset ? to - offset : 0;
          if (this_from < CHARSET_MIN_CODE (charset))
@@ -811,7 +811,7 @@ range of code points (in CHARSET) of target characters.  */)
     from = CHARSET_MIN_CODE (cs);
   else
     {
-      from = XINT (from_code);
+      from = XFIXNUM (from_code);
       if (from < CHARSET_MIN_CODE (cs))
        from = CHARSET_MIN_CODE (cs);
     }
@@ -819,7 +819,7 @@ range of code points (in CHARSET) of target characters.  */)
     to = CHARSET_MAX_CODE (cs);
   else
     {
-      to = XINT (to_code);
+      to = XFIXNUM (to_code);
       if (to > CHARSET_MAX_CODE (cs))
        to = CHARSET_MAX_CODE (cs);
     }
@@ -854,9 +854,9 @@ usage: (define-charset-internal ...)  */)
   if (nargs != charset_arg_max)
     Fsignal (Qwrong_number_of_arguments,
             Fcons (intern ("define-charset-internal"),
-                   make_number (nargs)));
+                   make_fixnum (nargs)));
 
-  attrs = Fmake_vector (make_number (charset_attr_max), Qnil);
+  attrs = Fmake_vector (make_fixnum (charset_attr_max), Qnil);
 
   CHECK_SYMBOL (args[charset_arg_name]);
   ASET (attrs, charset_name, args[charset_arg_name]);
@@ -867,12 +867,12 @@ usage: (define-charset-internal ...)  */)
       Lisp_Object min_byte_obj, max_byte_obj;
       int min_byte, max_byte;
 
-      min_byte_obj = Faref (val, make_number (i * 2));
-      max_byte_obj = Faref (val, make_number (i * 2 + 1));
+      min_byte_obj = Faref (val, make_fixnum (i * 2));
+      max_byte_obj = Faref (val, make_fixnum (i * 2 + 1));
       CHECK_RANGED_INTEGER (min_byte_obj, 0, 255);
-      min_byte = XINT (min_byte_obj);
+      min_byte = XFIXNUM (min_byte_obj);
       CHECK_RANGED_INTEGER (max_byte_obj, min_byte, 255);
-      max_byte = XINT (max_byte_obj);
+      max_byte = XFIXNUM (max_byte_obj);
       charset.code_space[i * 4] = min_byte;
       charset.code_space[i * 4 + 1] = max_byte;
       charset.code_space[i * 4 + 2] = max_byte - min_byte + 1;
@@ -890,7 +890,7 @@ usage: (define-charset-internal ...)  */)
   else
     {
       CHECK_RANGED_INTEGER (val, 1, 4);
-      charset.dimension = XINT (val);
+      charset.dimension = XFIXNUM (val);
     }
 
   charset.code_linear_p
@@ -970,10 +970,10 @@ usage: (define-charset-internal ...)  */)
     charset.iso_final = -1;
   else
     {
-      CHECK_NUMBER (val);
-      if (XINT (val) < '0' || XINT (val) > 127)
-       error ("Invalid iso-final-char: %"pI"d", XINT (val));
-      charset.iso_final = XINT (val);
+      CHECK_FIXNUM (val);
+      if (XFIXNUM (val) < '0' || XFIXNUM (val) > 127)
+       error ("Invalid iso-final-char: %"pI"d", XFIXNUM (val));
+      charset.iso_final = XFIXNUM (val);
     }
 
   val = args[charset_arg_iso_revision];
@@ -982,7 +982,7 @@ usage: (define-charset-internal ...)  */)
   else
     {
       CHECK_RANGED_INTEGER (val, -1, 63);
-      charset.iso_revision = XINT (val);
+      charset.iso_revision = XFIXNUM (val);
     }
 
   val = args[charset_arg_emacs_mule_id];
@@ -990,10 +990,10 @@ usage: (define-charset-internal ...)  */)
     charset.emacs_mule_id = -1;
   else
     {
-      CHECK_NATNUM (val);
-      if ((XINT (val) > 0 && XINT (val) <= 128) || XINT (val) >= 256)
-       error ("Invalid emacs-mule-id: %"pI"d", XINT (val));
-      charset.emacs_mule_id = XINT (val);
+      CHECK_FIXNAT (val);
+      if ((XFIXNUM (val) > 0 && XFIXNUM (val) <= 128) || XFIXNUM (val) >= 256)
+       error ("Invalid emacs-mule-id: %"pI"d", XFIXNUM (val));
+      charset.emacs_mule_id = XFIXNUM (val);
     }
 
   charset.ascii_compatible_p = ! NILP (args[charset_arg_ascii_compatible_p]);
@@ -1010,7 +1010,7 @@ usage: (define-charset-internal ...)  */)
       CHECK_CHARACTER (val);
 
       charset.method = CHARSET_METHOD_OFFSET;
-      charset.code_offset = XINT (val);
+      charset.code_offset = XFIXNUM (val);
 
       i = CODE_POINT_TO_INDEX (&charset, charset.max_code);
       if (MAX_CHAR - charset.code_offset < i)
@@ -1043,14 +1043,14 @@ usage: (define-charset-internal ...)  */)
       val = args[charset_arg_subset];
       parent = Fcar (val);
       CHECK_CHARSET_GET_CHARSET (parent, parent_charset);
-      parent_min_code = Fnth (make_number (1), val);
-      CHECK_NATNUM (parent_min_code);
-      parent_max_code = Fnth (make_number (2), val);
-      CHECK_NATNUM (parent_max_code);
-      parent_code_offset = Fnth (make_number (3), val);
-      CHECK_NUMBER (parent_code_offset);
+      parent_min_code = Fnth (make_fixnum (1), val);
+      CHECK_FIXNAT (parent_min_code);
+      parent_max_code = Fnth (make_fixnum (2), val);
+      CHECK_FIXNAT (parent_max_code);
+      parent_code_offset = Fnth (make_fixnum (3), val);
+      CHECK_FIXNUM (parent_code_offset);
       val = make_uninit_vector (4);
-      ASET (val, 0, make_number (parent_charset->id));
+      ASET (val, 0, make_fixnum (parent_charset->id));
       ASET (val, 1, parent_min_code);
       ASET (val, 2, parent_max_code);
       ASET (val, 3, parent_code_offset);
@@ -1089,14 +1089,14 @@ usage: (define-charset-internal ...)  */)
              cdr_part = XCDR (elt);
              CHECK_CHARSET_GET_ID (car_part, this_id);
              CHECK_TYPE_RANGED_INTEGER (int, cdr_part);
-             offset = XINT (cdr_part);
+             offset = XFIXNUM (cdr_part);
            }
          else
            {
              CHECK_CHARSET_GET_ID (elt, this_id);
              offset = 0;
            }
-         XSETCAR (val, Fcons (make_number (this_id), make_number (offset)));
+         XSETCAR (val, Fcons (make_fixnum (this_id), make_fixnum (offset)));
 
          this_charset = CHARSET_FROM_ID (this_id);
          if (charset.min_char > this_charset->min_char)
@@ -1123,7 +1123,7 @@ usage: (define-charset-internal ...)  */)
   if (charset.hash_index >= 0)
     {
       new_definition_p = 0;
-      id = XFASTINT (CHARSET_SYMBOL_ID (args[charset_arg_name]));
+      id = XFIXNAT (CHARSET_SYMBOL_ID (args[charset_arg_name]));
       set_hash_value_slot (hash_table, charset.hash_index, attrs);
     }
   else
@@ -1158,7 +1158,7 @@ usage: (define-charset-internal ...)  */)
       new_definition_p = 1;
     }
 
-  ASET (attrs, charset_id, make_number (id));
+  ASET (attrs, charset_id, make_fixnum (id));
   charset.id = id;
   charset_table[id] = charset;
 
@@ -1174,7 +1174,7 @@ usage: (define-charset-internal ...)  */)
                         charset.iso_final) = id;
       if (new_definition_p)
        Viso_2022_charset_list = nconc2 (Viso_2022_charset_list,
-                                        list1 (make_number (id)));
+                                        list1 (make_fixnum (id)));
       if (ISO_CHARSET_TABLE (1, 0, 'J') == id)
        charset_jisx0201_roman = id;
       else if (ISO_CHARSET_TABLE (2, 0, '@') == id)
@@ -1194,7 +1194,7 @@ usage: (define-charset-internal ...)  */)
        emacs_mule_bytes[charset.emacs_mule_id] = charset.dimension + 2;
       if (new_definition_p)
        Vemacs_mule_charset_list = nconc2 (Vemacs_mule_charset_list,
-                                          list1 (make_number (id)));
+                                          list1 (make_fixnum (id)));
     }
 
   if (new_definition_p)
@@ -1202,29 +1202,29 @@ usage: (define-charset-internal ...)  */)
       Vcharset_list = Fcons (args[charset_arg_name], Vcharset_list);
       if (charset.supplementary_p)
        Vcharset_ordered_list = nconc2 (Vcharset_ordered_list,
-                                       list1 (make_number (id)));
+                                       list1 (make_fixnum (id)));
       else
        {
          Lisp_Object tail;
 
          for (tail = Vcharset_ordered_list; CONSP (tail); tail = XCDR (tail))
            {
-             struct charset *cs = CHARSET_FROM_ID (XINT (XCAR (tail)));
+             struct charset *cs = CHARSET_FROM_ID (XFIXNUM (XCAR (tail)));
 
              if (cs->supplementary_p)
                break;
            }
          if (EQ (tail, Vcharset_ordered_list))
-           Vcharset_ordered_list = Fcons (make_number (id),
+           Vcharset_ordered_list = Fcons (make_fixnum (id),
                                           Vcharset_ordered_list);
          else if (NILP (tail))
            Vcharset_ordered_list = nconc2 (Vcharset_ordered_list,
-                                           list1 (make_number (id)));
+                                           list1 (make_fixnum (id)));
          else
            {
              val = Fcons (XCAR (tail), XCDR (tail));
              XSETCDR (tail, val);
-             XSETCAR (tail, make_number (id));
+             XSETCAR (tail, make_fixnum (id));
            }
        }
       charset_ordered_list_tick++;
@@ -1254,22 +1254,22 @@ define_charset_internal (Lisp_Object name,
   int i;
 
   args[charset_arg_name] = name;
-  args[charset_arg_dimension] = make_number (dimension);
+  args[charset_arg_dimension] = make_fixnum (dimension);
   val = make_uninit_vector (8);
   for (i = 0; i < 8; i++)
-    ASET (val, i, make_number (code_space[i]));
+    ASET (val, i, make_fixnum (code_space[i]));
   args[charset_arg_code_space] = val;
-  args[charset_arg_min_code] = make_number (min_code);
-  args[charset_arg_max_code] = make_number (max_code);
+  args[charset_arg_min_code] = make_fixnum (min_code);
+  args[charset_arg_max_code] = make_fixnum (max_code);
   args[charset_arg_iso_final]
-    = (iso_final < 0 ? Qnil : make_number (iso_final));
-  args[charset_arg_iso_revision] = make_number (iso_revision);
+    = (iso_final < 0 ? Qnil : make_fixnum (iso_final));
+  args[charset_arg_iso_revision] = make_fixnum (iso_revision);
   args[charset_arg_emacs_mule_id]
-    = (emacs_mule_id < 0 ? Qnil : make_number (emacs_mule_id));
+    = (emacs_mule_id < 0 ? Qnil : make_fixnum (emacs_mule_id));
   args[charset_arg_ascii_compatible_p] = ascii_compatible ? Qt : Qnil;
   args[charset_arg_supplementary_p] = supplementary ? Qt : Qnil;
   args[charset_arg_invalid_code] = Qnil;
-  args[charset_arg_code_offset] = make_number (code_offset);
+  args[charset_arg_code_offset] = make_fixnum (code_offset);
   args[charset_arg_map] = Qnil;
   args[charset_arg_subset] = Qnil;
   args[charset_arg_superset] = Qnil;
@@ -1293,7 +1293,7 @@ define_charset_internal (Lisp_Object name,
           args[charset_arg_code_offset]);
   Fdefine_charset_internal (charset_arg_max, args);
 
-  return XINT (CHARSET_SYMBOL_ID (name));
+  return XFIXNUM (CHARSET_SYMBOL_ID (name));
 }
 
 
@@ -1396,19 +1396,19 @@ static bool
 check_iso_charset_parameter (Lisp_Object dimension, Lisp_Object chars,
                             Lisp_Object final_char)
 {
-  CHECK_NUMBER (dimension);
-  CHECK_NUMBER (chars);
+  CHECK_FIXNUM (dimension);
+  CHECK_FIXNUM (chars);
   CHECK_CHARACTER (final_char);
 
-  if (! (1 <= XINT (dimension) && XINT (dimension) <= 3))
+  if (! (1 <= XFIXNUM (dimension) && XFIXNUM (dimension) <= 3))
     error ("Invalid DIMENSION %"pI"d, it should be 1, 2, or 3",
-          XINT (dimension));
+          XFIXNUM (dimension));
 
-  bool chars_flag = XINT (chars) == 96;
-  if (! (chars_flag || XINT (chars) == 94))
-    error ("Invalid CHARS %"pI"d, it should be 94 or 96", XINT (chars));
+  bool chars_flag = XFIXNUM (chars) == 96;
+  if (! (chars_flag || XFIXNUM (chars) == 94))
+    error ("Invalid CHARS %"pI"d, it should be 94 or 96", XFIXNUM (chars));
 
-  int final_ch = XFASTINT (final_char);
+  int final_ch = XFIXNAT (final_char);
   if (! ('0' <= final_ch && final_ch <= '~'))
     error ("Invalid FINAL-CHAR `%c', it should be `0'..`~'", final_ch);
 
@@ -1428,10 +1428,10 @@ return nil.  */)
   (Lisp_Object dimension, Lisp_Object chars)
 {
   bool chars_flag = check_iso_charset_parameter (dimension, chars,
-                                                make_number ('0'));
+                                                make_fixnum ('0'));
   for (int final_char = '0'; final_char <= '?'; final_char++)
-    if (ISO_CHARSET_TABLE (XINT (dimension), chars_flag, final_char) < 0)
-      return make_number (final_char);
+    if (ISO_CHARSET_TABLE (XFIXNUM (dimension), chars_flag, final_char) < 0)
+      return make_fixnum (final_char);
   return Qnil;
 }
 
@@ -1449,7 +1449,7 @@ if CHARSET is designated instead.  */)
 
   CHECK_CHARSET_GET_ID (charset, id);
   bool chars_flag = check_iso_charset_parameter (dimension, chars, final_char);
-  ISO_CHARSET_TABLE (XINT (dimension), chars_flag, XFASTINT (final_char)) = id;
+  ISO_CHARSET_TABLE (XFIXNUM (dimension), chars_flag, XFIXNAT (final_char)) = 
id;
   return Qnil;
 }
 
@@ -1550,8 +1550,8 @@ only `ascii', `eight-bit-control', and 
`eight-bit-graphic'.  */)
   bool multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
 
   validate_region (&beg, &end);
-  from = XFASTINT (beg);
-  stop = to = XFASTINT (end);
+  from = XFIXNAT (beg);
+  stop = to = XFIXNAT (end);
 
   if (from < GPT && GPT < to)
     {
@@ -1563,7 +1563,7 @@ only `ascii', `eight-bit-control', and 
`eight-bit-graphic'.  */)
 
   from_byte = CHAR_TO_BYTE (from);
 
-  charsets = Fmake_vector (make_number (charset_table_used), Qnil);
+  charsets = Fmake_vector (make_fixnum (charset_table_used), Qnil);
   while (1)
     {
       find_charsets_in_text (BYTE_POS_ADDR (from_byte), stop - from,
@@ -1600,7 +1600,7 @@ only `ascii', `eight-bit-control', and 
`eight-bit-graphic'. */)
 
   CHECK_STRING (str);
 
-  charsets = Fmake_vector (make_number (charset_table_used), Qnil);
+  charsets = Fmake_vector (make_fixnum (charset_table_used), Qnil);
   find_charsets_in_text (SDATA (str), SCHARS (str), SBYTES (str),
                         charsets, table,
                         STRING_MULTIBYTE (str));
@@ -1621,8 +1621,8 @@ maybe_unify_char (int c, Lisp_Object val)
 {
   struct charset *charset;
 
-  if (INTEGERP (val))
-    return XFASTINT (val);
+  if (FIXNUMP (val))
+    return XFIXNAT (val);
   if (NILP (val))
     return c;
 
@@ -1638,7 +1638,7 @@ maybe_unify_char (int c, Lisp_Object val)
     {
       val = CHAR_TABLE_REF (Vchar_unify_table, c);
       if (! NILP (val))
-       c = XFASTINT (val);
+       c = XFIXNAT (val);
     }
   else
     {
@@ -1672,10 +1672,10 @@ decode_char (struct charset *charset, unsigned int code)
       Lisp_Object subset_info;
 
       subset_info = CHARSET_SUBSET (charset);
-      charset = CHARSET_FROM_ID (XFASTINT (AREF (subset_info, 0)));
-      code -= XINT (AREF (subset_info, 3));
-      if (code < XFASTINT (AREF (subset_info, 1))
-         || code > XFASTINT (AREF (subset_info, 2)))
+      charset = CHARSET_FROM_ID (XFIXNAT (AREF (subset_info, 0)));
+      code -= XFIXNUM (AREF (subset_info, 3));
+      if (code < XFIXNAT (AREF (subset_info, 1))
+         || code > XFIXNAT (AREF (subset_info, 2)))
        c = -1;
       else
        c = DECODE_CHAR (charset, code);
@@ -1688,8 +1688,8 @@ decode_char (struct charset *charset, unsigned int code)
       c = -1;
       for (; CONSP (parents); parents = XCDR (parents))
        {
-         int id = XINT (XCAR (XCAR (parents)));
-         int code_offset = XINT (XCDR (XCAR (parents)));
+         int id = XFIXNUM (XCAR (XCAR (parents)));
+         int code_offset = XFIXNUM (XCDR (XCAR (parents)));
          unsigned this_code = code - code_offset;
 
          charset = CHARSET_FROM_ID (id);
@@ -1714,7 +1714,7 @@ decode_char (struct charset *charset, unsigned int code)
              decoder = CHARSET_DECODER (charset);
            }
          if (VECTORP (decoder))
-           c = XINT (AREF (decoder, char_index));
+           c = XFIXNUM (AREF (decoder, char_index));
          else
            c = GET_TEMP_CHARSET_WORK_DECODER (char_index);
        }
@@ -1762,8 +1762,8 @@ encode_char (struct charset *charset, int c)
        {
          Lisp_Object deunified = CHAR_TABLE_REF (deunifier, c);
 
-         if (INTEGERP (deunified))
-           code_index = XINT (deunified);
+         if (FIXNUMP (deunified))
+           code_index = XFIXNUM (deunified);
        }
       else
        {
@@ -1779,13 +1779,13 @@ encode_char (struct charset *charset, int c)
       struct charset *this_charset;
 
       subset_info = CHARSET_SUBSET (charset);
-      this_charset = CHARSET_FROM_ID (XFASTINT (AREF (subset_info, 0)));
+      this_charset = CHARSET_FROM_ID (XFIXNAT (AREF (subset_info, 0)));
       code = ENCODE_CHAR (this_charset, c);
       if (code == CHARSET_INVALID_CODE (this_charset)
-         || code < XFASTINT (AREF (subset_info, 1))
-         || code > XFASTINT (AREF (subset_info, 2)))
+         || code < XFIXNAT (AREF (subset_info, 1))
+         || code > XFIXNAT (AREF (subset_info, 2)))
        return CHARSET_INVALID_CODE (charset);
-      code += XINT (AREF (subset_info, 3));
+      code += XFIXNUM (AREF (subset_info, 3));
       return code;
     }
 
@@ -1796,8 +1796,8 @@ encode_char (struct charset *charset, int c)
       parents = CHARSET_SUPERSET (charset);
       for (; CONSP (parents); parents = XCDR (parents))
        {
-         int id = XINT (XCAR (XCAR (parents)));
-         int code_offset = XINT (XCDR (XCAR (parents)));
+         int id = XFIXNUM (XCAR (XCAR (parents)));
+         int code_offset = XFIXNUM (XCDR (XCAR (parents)));
          struct charset *this_charset = CHARSET_FROM_ID (id);
 
          code = ENCODE_CHAR (this_charset, c);
@@ -1827,7 +1827,7 @@ encode_char (struct charset *charset, int c)
          val = CHAR_TABLE_REF (encoder, c);
          if (NILP (val))
            return CHARSET_INVALID_CODE (charset);
-         code = XINT (val);
+         code = XFIXNUM (val);
          if (! CHARSET_COMPACT_CODES_P (charset))
            code = INDEX_TO_CODE_POINT (charset, code);
        }
@@ -1863,7 +1863,7 @@ CODE-POINT may be a cons (HIGHER-16-BIT-VALUE . 
LOWER-16-BIT-VALUE).  */)
   code = cons_to_unsigned (code_point, UINT_MAX);
   charsetp = CHARSET_FROM_ID (id);
   c = DECODE_CHAR (charsetp, code);
-  return (c >= 0 ? make_number (c) : Qnil);
+  return (c >= 0 ? make_fixnum (c) : Qnil);
 }
 
 
@@ -1878,7 +1878,7 @@ Return nil if CHARSET doesn't include CH.  */)
 
   CHECK_CHARSET_GET_ID (charset, id);
   CHECK_CHARACTER (ch);
-  c = XFASTINT (ch);
+  c = XFIXNAT (ch);
   charsetp = CHARSET_FROM_ID (id);
   code = ENCODE_CHAR (charsetp, c);
   if (code == CHARSET_INVALID_CODE (charsetp))
@@ -1910,10 +1910,10 @@ is specified.  */)
            ? 0 : CHARSET_MIN_CODE (charsetp));
   else
     {
-      CHECK_NATNUM (code1);
-      if (XFASTINT (code1) >= 0x100)
-       args_out_of_range (make_number (0xFF), code1);
-      code = XFASTINT (code1);
+      CHECK_FIXNAT (code1);
+      if (XFIXNAT (code1) >= 0x100)
+       args_out_of_range (make_fixnum (0xFF), code1);
+      code = XFIXNAT (code1);
 
       if (dimension > 1)
        {
@@ -1922,10 +1922,10 @@ is specified.  */)
            code |= charsetp->code_space[(dimension - 2) * 4];
          else
            {
-             CHECK_NATNUM (code2);
-             if (XFASTINT (code2) >= 0x100)
-               args_out_of_range (make_number (0xFF), code2);
-             code |= XFASTINT (code2);
+             CHECK_FIXNAT (code2);
+             if (XFIXNAT (code2) >= 0x100)
+               args_out_of_range (make_fixnum (0xFF), code2);
+             code |= XFIXNAT (code2);
            }
 
          if (dimension > 2)
@@ -1935,10 +1935,10 @@ is specified.  */)
                code |= charsetp->code_space[(dimension - 3) * 4];
              else
                {
-                 CHECK_NATNUM (code3);
-                 if (XFASTINT (code3) >= 0x100)
-                   args_out_of_range (make_number (0xFF), code3);
-                 code |= XFASTINT (code3);
+                 CHECK_FIXNAT (code3);
+                 if (XFIXNAT (code3) >= 0x100)
+                   args_out_of_range (make_fixnum (0xFF), code3);
+                 code |= XFIXNAT (code3);
                }
 
              if (dimension > 3)
@@ -1948,10 +1948,10 @@ is specified.  */)
                    code |= charsetp->code_space[0];
                  else
                    {
-                     CHECK_NATNUM (code4);
-                     if (XFASTINT (code4) >= 0x100)
-                       args_out_of_range (make_number (0xFF), code4);
-                     code |= XFASTINT (code4);
+                     CHECK_FIXNAT (code4);
+                     if (XFIXNAT (code4) >= 0x100)
+                       args_out_of_range (make_fixnum (0xFF), code4);
+                     code |= XFIXNAT (code4);
                    }
                }
            }
@@ -1963,7 +1963,7 @@ is specified.  */)
   c = DECODE_CHAR (charsetp, code);
   if (c < 0)
     error ("Invalid code(s)");
-  return make_number (c);
+  return make_fixnum (c);
 }
 
 
@@ -1983,7 +1983,7 @@ char_charset (int c, Lisp_Object charset_list, unsigned 
int *code_return)
 
   while (CONSP (charset_list))
     {
-      struct charset *charset = CHARSET_FROM_ID (XINT (XCAR (charset_list)));
+      struct charset *charset = CHARSET_FROM_ID (XFIXNUM (XCAR 
(charset_list)));
       unsigned code = ENCODE_CHAR (charset, c);
 
       if (code != CHARSET_INVALID_CODE (charset))
@@ -2018,7 +2018,7 @@ CH in the charset.  */)
   Lisp_Object val;
 
   CHECK_CHARACTER (ch);
-  c = XFASTINT (ch);
+  c = XFIXNAT (ch);
   charset = CHAR_CHARSET (c);
   if (! charset)
     emacs_abort ();
@@ -2028,7 +2028,7 @@ CH in the charset.  */)
   dimension = CHARSET_DIMENSION (charset);
   for (val = Qnil; dimension > 0; dimension--)
     {
-      val = Fcons (make_number (code & 0xFF), val);
+      val = Fcons (make_fixnum (code & 0xFF), val);
       code >>= 8;
     }
   return Fcons (CHARSET_NAME (charset), val);
@@ -2048,12 +2048,12 @@ that case, find the charset from what supported by that 
coding system.  */)
 
   CHECK_CHARACTER (ch);
   if (NILP (restriction))
-    charset = CHAR_CHARSET (XINT (ch));
+    charset = CHAR_CHARSET (XFIXNUM (ch));
   else
     {
       if (CONSP (restriction))
        {
-         int c = XFASTINT (ch);
+         int c = XFIXNAT (ch);
 
          for (; CONSP (restriction); restriction = XCDR (restriction))
            {
@@ -2066,7 +2066,7 @@ that case, find the charset from what supported by that 
coding system.  */)
          return Qnil;
        }
       restriction = coding_system_charset_list (restriction);
-      charset = char_charset (XINT (ch), restriction, NULL);
+      charset = char_charset (XFIXNUM (ch), restriction, NULL);
       if (! charset)
        return Qnil;
     }
@@ -2085,9 +2085,9 @@ If POS is out of range, the value is nil.  */)
   struct charset *charset;
 
   ch = Fchar_after (pos);
-  if (! INTEGERP (ch))
+  if (! FIXNUMP (ch))
     return ch;
-  charset = CHAR_CHARSET (XINT (ch));
+  charset = CHAR_CHARSET (XFIXNUM (ch));
   return (CHARSET_NAME (charset));
 }
 
@@ -2104,8 +2104,8 @@ DIMENSION, CHARS, and FINAL-CHAR.  */)
   (Lisp_Object dimension, Lisp_Object chars, Lisp_Object final_char)
 {
   bool chars_flag = check_iso_charset_parameter (dimension, chars, final_char);
-  int id = ISO_CHARSET_TABLE (XINT (dimension), chars_flag,
-                             XFASTINT (final_char));
+  int id = ISO_CHARSET_TABLE (XFIXNUM (dimension), chars_flag,
+                             XFIXNAT (final_char));
   return (id >= 0 ? CHARSET_NAME (CHARSET_FROM_ID (id)) : Qnil);
 }
 
@@ -2139,11 +2139,11 @@ HIGHESTP non-nil means just return the highest priority 
one.  */)
   Lisp_Object val = Qnil, list = Vcharset_ordered_list;
 
   if (!NILP (highestp))
-    return CHARSET_NAME (CHARSET_FROM_ID (XINT (Fcar (list))));
+    return CHARSET_NAME (CHARSET_FROM_ID (XFIXNUM (Fcar (list))));
 
   while (!NILP (list))
     {
-      val = Fcons (CHARSET_NAME (CHARSET_FROM_ID (XINT (XCAR (list)))), val);
+      val = Fcons (CHARSET_NAME (CHARSET_FROM_ID (XFIXNUM (XCAR (list)))), 
val);
       list = XCDR (list);
     }
   return Fnreverse (val);
@@ -2165,10 +2165,10 @@ usage: (set-charset-priority &rest charsets)  */)
   for (i = 0; i < nargs; i++)
     {
       CHECK_CHARSET_GET_ID (args[i], id);
-      if (! NILP (Fmemq (make_number (id), old_list)))
+      if (! NILP (Fmemq (make_fixnum (id), old_list)))
        {
-         old_list = Fdelq (make_number (id), old_list);
-         new_head = Fcons (make_number (id), new_head);
+         old_list = Fdelq (make_fixnum (id), old_list);
+         new_head = Fcons (make_fixnum (id), new_head);
        }
     }
   Vcharset_non_preferred_head = old_list;
@@ -2186,7 +2186,7 @@ usage: (set-charset-priority &rest charsets)  */)
        list_emacs_mule = Fcons (XCAR (old_list), list_emacs_mule);
       if (charset_unibyte < 0)
        {
-         struct charset *charset = CHARSET_FROM_ID (XINT (XCAR (old_list)));
+         struct charset *charset = CHARSET_FROM_ID (XFIXNUM (XCAR (old_list)));
 
          if (CHARSET_DIMENSION (charset) == 1
              && CHARSET_ASCII_COMPATIBLE_P (charset)
@@ -2211,7 +2211,7 @@ Return charset identification number of CHARSET.  */)
   int id;
 
   CHECK_CHARSET_GET_ID (charset, id);
-  return make_number (id);
+  return make_fixnum (id);
 }
 
 struct charset_sort_data
@@ -2237,7 +2237,7 @@ See also `charset-priority-list' and 
`set-charset-priority'.  */)
      (Lisp_Object charsets)
 {
   Lisp_Object len = Flength (charsets);
-  ptrdiff_t n = XFASTINT (len), i, j;
+  ptrdiff_t n = XFIXNAT (len), i, j;
   int done;
   Lisp_Object tail, elt, attrs;
   struct charset_sort_data *sort_data;
@@ -2252,7 +2252,7 @@ See also `charset-priority-list' and 
`set-charset-priority'.  */)
       elt = XCAR (tail);
       CHECK_CHARSET_GET_ATTR (elt, attrs);
       sort_data[i].charset = elt;
-      sort_data[i].id = id = XINT (CHARSET_ATTR_ID (attrs));
+      sort_data[i].id = id = XFIXNUM (CHARSET_ATTR_ID (attrs));
       if (id < min_id)
        min_id = id;
       if (id > max_id)
@@ -2262,7 +2262,7 @@ See also `charset-priority-list' and 
`set-charset-priority'.  */)
        done < n && CONSP (tail); tail = XCDR (tail), i++)
     {
       elt = XCAR (tail);
-      id = XFASTINT (elt);
+      id = XFIXNAT (elt);
       if (id >= min_id && id <= max_id)
        for (j = 0; j < n; j++)
          if (sort_data[j].id == id)
diff --git a/src/charset.h b/src/charset.h
index 8832af4..7b85a1a 100644
--- a/src/charset.h
+++ b/src/charset.h
@@ -355,7 +355,7 @@ set_charset_attr (struct charset *charset, enum 
charset_attr_index idx,
                                                                        \
     if (! SYMBOLP (x) || (idx = CHARSET_SYMBOL_HASH_INDEX (x)) < 0)    \
       wrong_type_argument (Qcharsetp, (x));                            \
-    id = XINT (AREF (HASH_VALUE (XHASH_TABLE (Vcharset_hash_table), idx), \
+    id = XFIXNUM (AREF (HASH_VALUE (XHASH_TABLE (Vcharset_hash_table), idx), \
                     charset_id));                                      \
   } while (false)
 
@@ -416,7 +416,7 @@ extern Lisp_Object Vchar_charset_set;
    : (charset)->method == CHARSET_METHOD_MAP                           \
    ? (((charset)->code_linear_p                                                
\
        && VECTORP (CHARSET_DECODER (charset)))                         \
-      ? XINT (AREF (CHARSET_DECODER (charset),                         \
+      ? XFIXNUM (AREF (CHARSET_DECODER (charset),                              
\
                    (code) - (charset)->min_code))                      \
       : decode_char ((charset), (code)))                               \
    : decode_char ((charset), (code)))
@@ -447,7 +447,7 @@ extern Lisp_Object charset_work;
        ? (charset_work = CHAR_TABLE_REF (CHARSET_ENCODER (charset), c), \
           (NILP (charset_work)                                         \
            ? (charset)->invalid_code                                   \
-           : (unsigned) XFASTINT (charset_work)))                      \
+           : (unsigned) XFIXNAT (charset_work)))                       \
        : encode_char (charset, c))                                     \
      : encode_char (charset, c))))
 
diff --git a/src/chartab.c b/src/chartab.c
index 8998350..3d38b3c 100644
--- a/src/chartab.c
+++ b/src/chartab.c
@@ -118,14 +118,14 @@ the char-table has no extra slot.  */)
     n_extras = 0;
   else
     {
-      CHECK_NATNUM (n);
-      if (XINT (n) > 10)
+      CHECK_FIXNAT (n);
+      if (XFIXNUM (n) > 10)
        args_out_of_range (n, Qnil);
-      n_extras = XINT (n);
+      n_extras = XFIXNUM (n);
     }
 
   size = CHAR_TABLE_STANDARD_SLOTS + n_extras;
-  vector = Fmake_vector (make_number (size), init);
+  vector = Fmake_vector (make_fixnum (size), init);
   XSETPVECTYPE (XVECTOR (vector), PVEC_CHAR_TABLE);
   set_char_table_parent (vector, Qnil);
   set_char_table_purpose (vector, purpose);
@@ -188,7 +188,7 @@ copy_char_table (Lisp_Object table)
   int size = PVSIZE (table);
   int i;
 
-  copy = Fmake_vector (make_number (size), Qnil);
+  copy = Fmake_vector (make_fixnum (size), Qnil);
   XSETPVECTYPE (XVECTOR (copy), PVEC_CHAR_TABLE);
   set_char_table_defalt (copy, XCHAR_TABLE (table)->defalt);
   set_char_table_parent (copy, XCHAR_TABLE (table)->parent);
@@ -571,12 +571,12 @@ DEFUN ("char-table-extra-slot", Fchar_table_extra_slot, 
Schar_table_extra_slot,
   (Lisp_Object char_table, Lisp_Object n)
 {
   CHECK_CHAR_TABLE (char_table);
-  CHECK_NUMBER (n);
-  if (XINT (n) < 0
-      || XINT (n) >= CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (char_table)))
+  CHECK_FIXNUM (n);
+  if (XFIXNUM (n) < 0
+      || XFIXNUM (n) >= CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (char_table)))
     args_out_of_range (char_table, n);
 
-  return XCHAR_TABLE (char_table)->extras[XINT (n)];
+  return XCHAR_TABLE (char_table)->extras[XFIXNUM (n)];
 }
 
 DEFUN ("set-char-table-extra-slot", Fset_char_table_extra_slot,
@@ -586,12 +586,12 @@ DEFUN ("set-char-table-extra-slot", 
Fset_char_table_extra_slot,
   (Lisp_Object char_table, Lisp_Object n, Lisp_Object value)
 {
   CHECK_CHAR_TABLE (char_table);
-  CHECK_NUMBER (n);
-  if (XINT (n) < 0
-      || XINT (n) >= CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (char_table)))
+  CHECK_FIXNUM (n);
+  if (XFIXNUM (n) < 0
+      || XFIXNUM (n) >= CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (char_table)))
     args_out_of_range (char_table, n);
 
-  set_char_table_extras (char_table, XINT (n), value);
+  set_char_table_extras (char_table, XFIXNUM (n), value);
   return value;
 }
 
@@ -608,15 +608,15 @@ a cons of character codes (for characters in the range), 
or a character code.  *
   if (NILP (range))
     val = XCHAR_TABLE (char_table)->defalt;
   else if (CHARACTERP (range))
-    val = CHAR_TABLE_REF (char_table, XFASTINT (range));
+    val = CHAR_TABLE_REF (char_table, XFIXNAT (range));
   else if (CONSP (range))
     {
       int from, to;
 
       CHECK_CHARACTER_CAR (range);
       CHECK_CHARACTER_CDR (range);
-      from = XFASTINT (XCAR (range));
-      to = XFASTINT (XCDR (range));
+      from = XFIXNAT (XCAR (range));
+      to = XFIXNAT (XCDR (range));
       val = char_table_ref_and_range (char_table, from, &from, &to);
       /* Not yet implemented. */
     }
@@ -645,13 +645,13 @@ or a character code.  Return VALUE.  */)
   else if (NILP (range))
     set_char_table_defalt (char_table, value);
   else if (CHARACTERP (range))
-    char_table_set (char_table, XINT (range), value);
+    char_table_set (char_table, XFIXNUM (range), value);
   else if (CONSP (range))
     {
       CHECK_CHARACTER_CAR (range);
       CHECK_CHARACTER_CDR (range);
       char_table_set_range (char_table,
-                           XINT (XCAR (range)), XINT (XCDR (range)), value);
+                           XFIXNUM (XCAR (range)), XFIXNUM (XCDR (range)), 
value);
     }
   else
     error ("Invalid RANGE argument to `set-char-table-range'");
@@ -742,7 +742,7 @@ map_sub_char_table (void (*c_function) (Lisp_Object, 
Lisp_Object, Lisp_Object),
   int min_char, max_char;
   /* Number of characters covered by one element of TABLE.  */
   int chars_in_block;
-  int from = XINT (XCAR (range)), to = XINT (XCDR (range));
+  int from = XFIXNUM (XCAR (range)), to = XFIXNUM (XCDR (range));
   int i, c;
   bool is_uniprop = UNIPROP_TABLE_P (top);
   uniprop_decoder_t decoder = UNIPROP_GET_DECODER (top);
@@ -783,7 +783,7 @@ map_sub_char_table (void (*c_function) (Lisp_Object, 
Lisp_Object, Lisp_Object),
       if (SUB_CHAR_TABLE_P (this))
        {
          if (to >= nextc)
-           XSETCDR (range, make_number (nextc - 1));
+           XSETCDR (range, make_fixnum (nextc - 1));
          val = map_sub_char_table (c_function, function, this, arg,
                                    val, range, top);
        }
@@ -807,7 +807,7 @@ map_sub_char_table (void (*c_function) (Lisp_Object, 
Lisp_Object, Lisp_Object),
                      set_char_table_parent (parent, Qnil);
                      val = CHAR_TABLE_REF (parent, from);
                      set_char_table_parent (parent, temp);
-                     XSETCDR (range, make_number (c - 1));
+                     XSETCDR (range, make_fixnum (c - 1));
                      val = map_sub_char_table (c_function, function,
                                                parent, arg, val, range,
                                                parent);
@@ -817,7 +817,7 @@ map_sub_char_table (void (*c_function) (Lisp_Object, 
Lisp_Object, Lisp_Object),
                }
              if (! NILP (val) && different_value)
                {
-                 XSETCDR (range, make_number (c - 1));
+                 XSETCDR (range, make_fixnum (c - 1));
                  if (EQ (XCAR (range), XCDR (range)))
                    {
                      if (c_function)
@@ -843,10 +843,10 @@ map_sub_char_table (void (*c_function) (Lisp_Object, 
Lisp_Object, Lisp_Object),
                }
              val = this;
              from = c;
-             XSETCAR (range, make_number (c));
+             XSETCAR (range, make_fixnum (c));
            }
        }
-      XSETCDR (range, make_number (to));
+      XSETCDR (range, make_fixnum (to));
     }
   return val;
 }
@@ -864,7 +864,7 @@ map_char_table (void (*c_function) (Lisp_Object, 
Lisp_Object, Lisp_Object),
   Lisp_Object range, val, parent;
   uniprop_decoder_t decoder = UNIPROP_GET_DECODER (table);
 
-  range = Fcons (make_number (0), make_number (MAX_CHAR));
+  range = Fcons (make_fixnum (0), make_fixnum (MAX_CHAR));
   parent = XCHAR_TABLE (table)->parent;
 
   val = XCHAR_TABLE (table)->ascii;
@@ -878,7 +878,7 @@ map_char_table (void (*c_function) (Lisp_Object, 
Lisp_Object, Lisp_Object),
   while (NILP (val) && ! NILP (XCHAR_TABLE (table)->parent))
     {
       Lisp_Object temp;
-      int from = XINT (XCAR (range));
+      int from = XFIXNUM (XCAR (range));
 
       parent = XCHAR_TABLE (table)->parent;
       temp = XCHAR_TABLE (parent)->parent;
@@ -957,7 +957,7 @@ map_sub_char_table_for_charset (void (*c_function) 
(Lisp_Object, Lisp_Object),
          {
            if (! NILP (XCAR (range)))
              {
-               XSETCDR (range, make_number (c - 1));
+               XSETCDR (range, make_fixnum (c - 1));
                if (c_function)
                  (*c_function) (arg, range);
                else
@@ -980,7 +980,7 @@ map_sub_char_table_for_charset (void (*c_function) 
(Lisp_Object, Lisp_Object),
          {
            if (! NILP (XCAR (range)))
              {
-               XSETCDR (range, make_number (c - 1));
+               XSETCDR (range, make_fixnum (c - 1));
                if (c_function)
                  (*c_function) (arg, range);
                else
@@ -991,7 +991,7 @@ map_sub_char_table_for_charset (void (*c_function) 
(Lisp_Object, Lisp_Object),
        else
          {
            if (NILP (XCAR (range)))
-             XSETCAR (range, make_number (c));
+             XSETCAR (range, make_fixnum (c));
          }
       }
 }
@@ -1041,7 +1041,7 @@ map_char_table_for_charset (void (*c_function) 
(Lisp_Object, Lisp_Object),
        {
          if (! NILP (XCAR (range)))
            {
-             XSETCDR (range, make_number (c - 1));
+             XSETCDR (range, make_fixnum (c - 1));
              if (c_function)
                (*c_function) (arg, range);
              else
@@ -1052,7 +1052,7 @@ map_char_table_for_charset (void (*c_function) 
(Lisp_Object, Lisp_Object),
     }
   if (! NILP (XCAR (range)))
     {
-      XSETCDR (range, make_number (c - 1));
+      XSETCDR (range, make_fixnum (c - 1));
       if (c_function)
        (*c_function) (arg, range);
       else
@@ -1125,7 +1125,7 @@ uniprop_table_uncompress (Lisp_Object table, int idx)
        {
          int v = STRING_CHAR_ADVANCE (p);
          set_sub_char_table_contents
-           (sub, idx++, v > 0 ? make_number (v) : Qnil);
+           (sub, idx++, v > 0 ? make_fixnum (v) : Qnil);
        }
     }
   else if (*p == 2)
@@ -1150,7 +1150,7 @@ uniprop_table_uncompress (Lisp_Object table, int idx)
                }
            }
          while (count-- > 0)
-           set_sub_char_table_contents (sub, idx++, make_number (v));
+           set_sub_char_table_contents (sub, idx++, make_fixnum (v));
        }
     }
 /* It seems that we don't need this function because C code won't need
@@ -1174,8 +1174,8 @@ uniprop_decode_value_run_length (Lisp_Object table, 
Lisp_Object value)
     {
       Lisp_Object valvec = XCHAR_TABLE (table)->extras[4];
 
-      if (XINT (value) >= 0 && XINT (value) < ASIZE (valvec))
-       value = AREF (valvec, XINT (value));
+      if (XFIXNUM (value) >= 0 && XFIXNUM (value) < ASIZE (valvec))
+       value = AREF (valvec, XFIXNUM (value));
     }
   return value;
 }
@@ -1192,9 +1192,9 @@ uniprop_get_decoder (Lisp_Object table)
 {
   EMACS_INT i;
 
-  if (! INTEGERP (XCHAR_TABLE (table)->extras[1]))
+  if (! FIXNUMP (XCHAR_TABLE (table)->extras[1]))
     return NULL;
-  i = XINT (XCHAR_TABLE (table)->extras[1]);
+  i = XFIXNUM (XCHAR_TABLE (table)->extras[1]);
   if (i < 0 || i >= uniprop_decoder_count)
     return NULL;
   return uniprop_decoder[i];
@@ -1227,7 +1227,7 @@ uniprop_encode_value_run_length (Lisp_Object table, 
Lisp_Object value)
       break;
   if (i == size)
     wrong_type_argument (build_string ("Unicode property value"), value);
-  return make_number (i);
+  return make_fixnum (i);
 }
 
 
@@ -1240,17 +1240,17 @@ uniprop_encode_value_numeric (Lisp_Object table, 
Lisp_Object value)
   Lisp_Object *value_table = XVECTOR (XCHAR_TABLE 
(table)->extras[4])->contents;
   int i, size = ASIZE (XCHAR_TABLE (table)->extras[4]);
 
-  CHECK_NUMBER (value);
+  CHECK_FIXNUM (value);
   for (i = 0; i < size; i++)
     if (EQ (value, value_table[i]))
       break;
-  value = make_number (i);
+  value = make_fixnum (i);
   if (i == size)
     set_char_table_extras (table, 4,
                           CALLN (Fvconcat,
                                  XCHAR_TABLE (table)->extras[4],
-                                 Fmake_vector (make_number (1), value)));
-  return make_number (i);
+                                 Fmake_vector (make_fixnum (1), value)));
+  return make_fixnum (i);
 }
 
 static uniprop_encoder_t uniprop_encoder[] =
@@ -1267,9 +1267,9 @@ uniprop_get_encoder (Lisp_Object table)
 {
   EMACS_INT i;
 
-  if (! INTEGERP (XCHAR_TABLE (table)->extras[2]))
+  if (! FIXNUMP (XCHAR_TABLE (table)->extras[2]))
     return NULL;
-  i = XINT (XCHAR_TABLE (table)->extras[2]);
+  i = XFIXNUM (XCHAR_TABLE (table)->extras[2]);
   if (i < 0 || i >= uniprop_encoder_count)
     return NULL;
   return uniprop_encoder[i];
@@ -1300,8 +1300,8 @@ uniprop_table (Lisp_Object prop)
       || ! UNIPROP_TABLE_P (table))
     return Qnil;
   val = XCHAR_TABLE (table)->extras[1];
-  if (INTEGERP (val)
-      ? (XINT (val) < 0 || XINT (val) >= uniprop_decoder_count)
+  if (FIXNUMP (val)
+      ? (XFIXNUM (val) < 0 || XFIXNUM (val) >= uniprop_decoder_count)
       : ! NILP (val))
     return Qnil;
   /* Prepare ASCII values in advance for CHAR_TABLE_REF.  */
@@ -1337,7 +1337,7 @@ CHAR-TABLE must be what returned by 
`unicode-property-table-internal'. */)
   CHECK_CHARACTER (ch);
   if (! UNIPROP_TABLE_P (char_table))
     error ("Invalid Unicode property table");
-  val = CHAR_TABLE_REF (char_table, XINT (ch));
+  val = CHAR_TABLE_REF (char_table, XFIXNUM (ch));
   decoder = uniprop_get_decoder (char_table);
   return (decoder ? decoder (char_table, val) : val);
 }
@@ -1357,7 +1357,7 @@ CHAR-TABLE must be what returned by 
`unicode-property-table-internal'. */)
   encoder = uniprop_get_encoder (char_table);
   if (encoder)
     value = encoder (char_table, value);
-  CHAR_TABLE_SET (char_table, XINT (ch), value);
+  CHAR_TABLE_SET (char_table, XFIXNUM (ch), value);
   return Qnil;
 }
 
diff --git a/src/cmds.c b/src/cmds.c
index 96b712e..1616efb 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -35,9 +35,9 @@ DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 
0,
        doc: /* Return buffer position N characters after (before if N 
negative) point.  */)
   (Lisp_Object n)
 {
-  CHECK_NUMBER (n);
+  CHECK_FIXNUM (n);
 
-  return make_number (PT + XINT (n));
+  return make_fixnum (PT + XFIXNUM (n));
 }
 
 /* Add N to point; or subtract N if FORWARD is false.  N defaults to 1.
@@ -45,7 +45,7 @@ DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 
0,
 static Lisp_Object
 move_point (Lisp_Object n, bool forward)
 {
-  /* This used to just set point to point + XINT (n), and then check
+  /* This used to just set point to point + XFIXNUM (n), and then check
      to see if it was within boundaries.  But now that SET_PT can
      potentially do a lot of stuff (calling entering and exiting
      hooks, etcetera), that's not a good approach.  So we validate the
@@ -56,9 +56,9 @@ move_point (Lisp_Object n, bool forward)
   if (NILP (n))
     XSETFASTINT (n, 1);
   else
-    CHECK_NUMBER (n);
+    CHECK_FIXNUM (n);
 
-  new_point = PT + (forward ? XINT (n) : - XINT (n));
+  new_point = PT + (forward ? XFIXNUM (n) : - XFIXNUM (n));
 
   if (new_point < BEGV)
     {
@@ -127,8 +127,8 @@ go to its beginning.  */)
     count = 1;
   else
     {
-      CHECK_NUMBER (n);
-      count = XINT (n);
+      CHECK_FIXNUM (n);
+      count = XFIXNUM (n);
     }
 
   shortage = scan_newline_from_point (count, &pos, &pos_byte);
@@ -142,7 +142,7 @@ go to its beginning.  */)
              && (FETCH_BYTE (PT_BYTE - 1) != '\n'))))
     shortage--;
 
-  return make_number (count <= 0 ? - shortage : shortage);
+  return make_fixnum (count <= 0 ? - shortage : shortage);
 }
 
 DEFUN ("beginning-of-line", Fbeginning_of_line, Sbeginning_of_line, 0, 1, "^p",
@@ -162,9 +162,9 @@ instead.  For instance, `(forward-line 0)' does the same 
thing as
   if (NILP (n))
     XSETFASTINT (n, 1);
   else
-    CHECK_NUMBER (n);
+    CHECK_FIXNUM (n);
 
-  SET_PT (XINT (Fline_beginning_position (n)));
+  SET_PT (XFIXNUM (Fline_beginning_position (n)));
 
   return Qnil;
 }
@@ -187,11 +187,11 @@ to t.  */)
   if (NILP (n))
     XSETFASTINT (n, 1);
   else
-    CHECK_NUMBER (n);
+    CHECK_FIXNUM (n);
 
   while (1)
     {
-      newpos = XINT (Fline_end_position (n));
+      newpos = XFIXNUM (Fline_end_position (n));
       SET_PT (newpos);
 
       if (PT > newpos
@@ -210,7 +210,7 @@ to t.  */)
        /* If we skipped something intangible
           and now we're not really at eol,
           keep going.  */
-       n = make_number (1);
+       n = make_fixnum (1);
       else
        break;
     }
@@ -230,15 +230,15 @@ because it respects values of `delete-active-region' and 
`overwrite-mode'.  */)
 {
   EMACS_INT pos;
 
-  CHECK_NUMBER (n);
+  CHECK_FIXNUM (n);
 
-  if (eabs (XINT (n)) < 2)
+  if (eabs (XFIXNUM (n)) < 2)
     call0 (Qundo_auto_amalgamate);
 
-  pos = PT + XINT (n);
+  pos = PT + XFIXNUM (n);
   if (NILP (killflag))
     {
-      if (XINT (n) < 0)
+      if (XFIXNUM (n) < 0)
        {
          if (pos < BEGV)
            xsignal0 (Qbeginning_of_buffer);
@@ -274,12 +274,12 @@ a non-nil value for the inserted character.  At the end, 
it runs
 `post-self-insert-hook'.  */)
   (Lisp_Object n)
 {
-  CHECK_NUMBER (n);
+  CHECK_FIXNUM (n);
 
-  if (XINT (n) < 0)
-    error ("Negative repetition argument %"pI"d", XINT (n));
+  if (XFIXNUM (n) < 0)
+    error ("Negative repetition argument %"pI"d", XFIXNUM (n));
 
-  if (XFASTINT (n) < 2)
+  if (XFIXNAT (n) < 2)
     call0 (Qundo_auto_amalgamate);
 
   /* Barf if the key that invoked this was not a character.  */
@@ -287,8 +287,8 @@ a non-nil value for the inserted character.  At the end, it 
runs
     bitch_at_user ();
   else {
     int character = translate_char (Vtranslation_table_for_input,
-                                   XINT (last_command_event));
-    int val = internal_self_insert (character, XFASTINT (n));
+                                   XFIXNUM (last_command_event));
+    int val = internal_self_insert (character, XFIXNAT (n));
     if (val == 2)
       Fset (Qundo_auto__this_command_amalgamating, Qnil);
     frame_make_pointer_invisible (SELECTED_FRAME ());
@@ -360,7 +360,7 @@ internal_self_insert (int c, EMACS_INT n)
       if (EQ (overwrite, Qoverwrite_mode_binary))
        chars_to_delete = min (n, PTRDIFF_MAX);
       else if (c != '\n' && c2 != '\n'
-              && (cwidth = XFASTINT (Fchar_width (make_number (c)))) != 0)
+              && (cwidth = XFIXNAT (Fchar_width (make_fixnum (c)))) != 0)
        {
          ptrdiff_t pos = PT;
          ptrdiff_t pos_byte = PT_BYTE;
@@ -378,7 +378,7 @@ internal_self_insert (int c, EMACS_INT n)
                 character.  In that case, the new point is set after
                 that character.  */
              ptrdiff_t actual_clm
-               = XFASTINT (Fmove_to_column (make_number (target_clm), Qnil));
+               = XFIXNAT (Fmove_to_column (make_fixnum (target_clm), Qnil));
 
              chars_to_delete = PT - pos;
 
@@ -408,8 +408,8 @@ internal_self_insert (int c, EMACS_INT n)
       && NILP (BVAR (current_buffer, read_only))
       && PT > BEGV
       && (SYNTAX (!NILP (BVAR (current_buffer, enable_multibyte_characters))
-                 ? XFASTINT (Fprevious_char ())
-                 : UNIBYTE_TO_CHAR (XFASTINT (Fprevious_char ())))
+                 ? XFIXNAT (Fprevious_char ())
+                 : UNIBYTE_TO_CHAR (XFIXNAT (Fprevious_char ())))
          == Sword))
     {
       EMACS_INT modiff = MODIFF;
@@ -439,18 +439,18 @@ internal_self_insert (int c, EMACS_INT n)
       int mc = ((NILP (BVAR (current_buffer, enable_multibyte_characters))
                 && SINGLE_BYTE_CHAR_P (c))
                ? UNIBYTE_TO_CHAR (c) : c);
-      Lisp_Object string = Fmake_string (make_number (n), make_number (mc),
+      Lisp_Object string = Fmake_string (make_fixnum (n), make_fixnum (mc),
                                         Qnil);
 
       if (spaces_to_insert)
        {
-         tem = Fmake_string (make_number (spaces_to_insert),
-                             make_number (' '), Qnil);
+         tem = Fmake_string (make_fixnum (spaces_to_insert),
+                             make_fixnum (' '), Qnil);
          string = concat2 (string, tem);
        }
 
       replace_range (PT, PT + chars_to_delete, string, 1, 1, 1, 0);
-      Fforward_char (make_number (n));
+      Fforward_char (make_fixnum (n));
     }
   else if (n > 1)
     {
diff --git a/src/coding.c b/src/coding.c
index 8ce902b..53e98f8 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -324,7 +324,7 @@ static Lisp_Object Vbig5_coding_system;
 /* ISO2022 section */
 
 #define CODING_ISO_INITIAL(coding, reg)                        \
-  (XINT (AREF (AREF (CODING_ID_ATTRS ((coding)->id),   \
+  (XFIXNUM (AREF (AREF (CODING_ID_ATTRS ((coding)->id),        \
                     coding_attr_iso_initial),          \
               reg)))
 
@@ -620,18 +620,18 @@ inhibit_flag (int encoded_flag, bool var)
   } while (0)
 
 static void
-CHECK_NATNUM_CAR (Lisp_Object x)
+CHECK_FIXNAT_CAR (Lisp_Object x)
 {
   Lisp_Object tmp = XCAR (x);
-  CHECK_NATNUM (tmp);
+  CHECK_FIXNAT (tmp);
   XSETCAR (x, tmp);
 }
 
 static void
-CHECK_NATNUM_CDR (Lisp_Object x)
+CHECK_FIXNAT_CDR (Lisp_Object x)
 {
   Lisp_Object tmp = XCDR (x);
-  CHECK_NATNUM (tmp);
+  CHECK_FIXNAT (tmp);
   XSETCDR (x, tmp);
 }
 
@@ -2622,7 +2622,7 @@ encode_coding_emacs_mule (struct coding_system *coding)
            case CODING_ANNOTATE_CHARSET_MASK:
              preferred_charset_id = charbuf[3];
              if (preferred_charset_id >= 0
-                 && NILP (Fmemq (make_number (preferred_charset_id),
+                 && NILP (Fmemq (make_fixnum (preferred_charset_id),
                                  charset_list)))
                preferred_charset_id = -1;
              break;
@@ -2888,7 +2888,7 @@ setup_iso_safe_charsets (Lisp_Object attrs)
   Lisp_Object reg_usage;
   Lisp_Object tail;
   EMACS_INT reg94, reg96;
-  int flags = XINT (AREF (attrs, coding_attr_iso_flags));
+  int flags = XFIXNUM (AREF (attrs, coding_attr_iso_flags));
   int max_charset_id;
 
   charset_list = CODING_ATTR_CHARSET_LIST (attrs);
@@ -2906,7 +2906,7 @@ setup_iso_safe_charsets (Lisp_Object attrs)
   max_charset_id = 0;
   for (tail = charset_list; CONSP (tail); tail = XCDR (tail))
     {
-      int id = XINT (XCAR (tail));
+      int id = XFIXNUM (XCAR (tail));
       if (max_charset_id < id)
        max_charset_id = id;
     }
@@ -2915,8 +2915,8 @@ setup_iso_safe_charsets (Lisp_Object attrs)
   memset (SDATA (safe_charsets), 255, max_charset_id + 1);
   request = AREF (attrs, coding_attr_iso_request);
   reg_usage = AREF (attrs, coding_attr_iso_usage);
-  reg94 = XINT (XCAR (reg_usage));
-  reg96 = XINT (XCDR (reg_usage));
+  reg94 = XFIXNUM (XCAR (reg_usage));
+  reg96 = XFIXNUM (XCDR (reg_usage));
 
   for (tail = charset_list; CONSP (tail); tail = XCDR (tail))
     {
@@ -2925,19 +2925,19 @@ setup_iso_safe_charsets (Lisp_Object attrs)
       struct charset *charset;
 
       id = XCAR (tail);
-      charset = CHARSET_FROM_ID (XINT (id));
+      charset = CHARSET_FROM_ID (XFIXNUM (id));
       reg = Fcdr (Fassq (id, request));
       if (! NILP (reg))
-       SSET (safe_charsets, XINT (id), XINT (reg));
+       SSET (safe_charsets, XFIXNUM (id), XFIXNUM (reg));
       else if (charset->iso_chars_96)
        {
          if (reg96 < 4)
-           SSET (safe_charsets, XINT (id), reg96);
+           SSET (safe_charsets, XFIXNUM (id), reg96);
        }
       else
        {
          if (reg94 < 4)
-           SSET (safe_charsets, XINT (id), reg94);
+           SSET (safe_charsets, XFIXNUM (id), reg94);
        }
     }
   ASET (attrs, coding_attr_safe_charsets, safe_charsets);
@@ -4459,7 +4459,7 @@ encode_coding_iso_2022 (struct coding_system *coding)
            case CODING_ANNOTATE_CHARSET_MASK:
              preferred_charset_id = charbuf[2];
              if (preferred_charset_id >= 0
-                 && NILP (Fmemq (make_number (preferred_charset_id),
+                 && NILP (Fmemq (make_fixnum (preferred_charset_id),
                                  charset_list)))
                preferred_charset_id = -1;
              break;
@@ -4612,7 +4612,7 @@ detect_coding_sjis (struct coding_system *coding,
 
   CODING_GET_INFO (coding, attrs, charset_list);
   max_first_byte_of_2_byte_code
-    = (XINT (Flength (charset_list)) > 3 ? 0xFC : 0xEF);
+    = (XFIXNUM (Flength (charset_list)) > 3 ? 0xFC : 0xEF);
 
   detect_info->checked |= CATEGORY_MASK_SJIS;
   /* A coding system of this category is always ASCII compatible.  */
@@ -4725,10 +4725,10 @@ decode_coding_sjis (struct coding_system *coding)
   CODING_GET_INFO (coding, attrs, charset_list);
 
   val = charset_list;
-  charset_roman = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val);
-  charset_kana = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val);
-  charset_kanji = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val);
-  charset_kanji2 = NILP (val) ? NULL : CHARSET_FROM_ID (XINT (XCAR (val)));
+  charset_roman = CHARSET_FROM_ID (XFIXNUM (XCAR (val))), val = XCDR (val);
+  charset_kana = CHARSET_FROM_ID (XFIXNUM (XCAR (val))), val = XCDR (val);
+  charset_kanji = CHARSET_FROM_ID (XFIXNUM (XCAR (val))), val = XCDR (val);
+  charset_kanji2 = NILP (val) ? NULL : CHARSET_FROM_ID (XFIXNUM (XCAR (val)));
 
   while (1)
     {
@@ -4840,8 +4840,8 @@ decode_coding_big5 (struct coding_system *coding)
 
   CODING_GET_INFO (coding, attrs, charset_list);
   val = charset_list;
-  charset_roman = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val);
-  charset_big5 = CHARSET_FROM_ID (XINT (XCAR (val)));
+  charset_roman = CHARSET_FROM_ID (XFIXNUM (XCAR (val))), val = XCDR (val);
+  charset_big5 = CHARSET_FROM_ID (XFIXNUM (XCAR (val)));
 
   while (1)
     {
@@ -4936,9 +4936,9 @@ encode_coding_sjis (struct coding_system *coding)
 
   CODING_GET_INFO (coding, attrs, charset_list);
   val = XCDR (charset_list);
-  charset_kana = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val);
-  charset_kanji = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val);
-  charset_kanji2 = NILP (val) ? NULL : CHARSET_FROM_ID (XINT (XCAR (val)));
+  charset_kana = CHARSET_FROM_ID (XFIXNUM (XCAR (val))), val = XCDR (val);
+  charset_kanji = CHARSET_FROM_ID (XFIXNUM (XCAR (val))), val = XCDR (val);
+  charset_kanji2 = NILP (val) ? NULL : CHARSET_FROM_ID (XFIXNUM (XCAR (val)));
 
   ascii_compatible = ! NILP (CODING_ATTR_ASCII_COMPAT (attrs));
 
@@ -5029,7 +5029,7 @@ encode_coding_big5 (struct coding_system *coding)
 
   CODING_GET_INFO (coding, attrs, charset_list);
   val = XCDR (charset_list);
-  charset_big5 = CHARSET_FROM_ID (XINT (XCAR (val)));
+  charset_big5 = CHARSET_FROM_ID (XFIXNUM (XCAR (val)));
   ascii_compatible = ! NILP (CODING_ATTR_ASCII_COMPAT (attrs));
 
   while (charbuf < charbuf_end)
@@ -5440,9 +5440,9 @@ detect_coding_charset (struct coding_system *coding,
            break;
          found = CATEGORY_MASK_CHARSET;
        }
-      if (INTEGERP (val))
+      if (FIXNUMP (val))
        {
-         charset = CHARSET_FROM_ID (XFASTINT (val));
+         charset = CHARSET_FROM_ID (XFIXNAT (val));
          dim = CHARSET_DIMENSION (charset);
          for (idx = 1; idx < dim; idx++)
            {
@@ -5461,7 +5461,7 @@ detect_coding_charset (struct coding_system *coding,
          idx = 1;
          for (; CONSP (val); val = XCDR (val))
            {
-             charset = CHARSET_FROM_ID (XFASTINT (XCAR (val)));
+             charset = CHARSET_FROM_ID (XFIXNAT (XCAR (val)));
              dim = CHARSET_DIMENSION (charset);
              while (idx < dim)
                {
@@ -5551,11 +5551,11 @@ decode_coding_charset (struct coding_system *coding)
       code = c;
 
       val = AREF (valids, c);
-      if (! INTEGERP (val) && ! CONSP (val))
+      if (! FIXNUMP (val) && ! CONSP (val))
        goto invalid_code;
-      if (INTEGERP (val))
+      if (FIXNUMP (val))
        {
-         charset = CHARSET_FROM_ID (XFASTINT (val));
+         charset = CHARSET_FROM_ID (XFIXNAT (val));
          dim = CHARSET_DIMENSION (charset);
          while (len < dim)
            {
@@ -5573,7 +5573,7 @@ decode_coding_charset (struct coding_system *coding)
             comes first).  */
          while (CONSP (val))
            {
-             charset = CHARSET_FROM_ID (XFASTINT (XCAR (val)));
+             charset = CHARSET_FROM_ID (XFIXNAT (XCAR (val)));
              dim = CHARSET_DIMENSION (charset);
              while (len < dim)
                {
@@ -5726,7 +5726,7 @@ setup_coding_system (Lisp_Object coding_system, struct 
coding_system *coding)
   val = CODING_ATTR_SAFE_CHARSETS (attrs);
   coding->max_charset_id = SCHARS (val) - 1;
   coding->safe_charsets = SDATA (val);
-  coding->default_char = XINT (CODING_ATTR_DEFAULT_CHAR (attrs));
+  coding->default_char = XFIXNUM (CODING_ATTR_DEFAULT_CHAR (attrs));
   coding->carryover_bytes = 0;
   coding->raw_destination = 0;
 
@@ -5749,7 +5749,7 @@ setup_coding_system (Lisp_Object coding_system, struct 
coding_system *coding)
   else if (EQ (coding_type, Qiso_2022))
     {
       int i;
-      int flags = XINT (AREF (attrs, coding_attr_iso_flags));
+      int flags = XFIXNUM (AREF (attrs, coding_attr_iso_flags));
 
       /* Invoke graphic register 0 to plane 0.  */
       CODING_ISO_INVOCATION (coding, 0) = 0;
@@ -5852,13 +5852,13 @@ setup_coding_system (Lisp_Object coding_system, struct 
coding_system *coding)
 
          for (tail = Vemacs_mule_charset_list; CONSP (tail);
               tail = XCDR (tail))
-           if (max_charset_id < XFASTINT (XCAR (tail)))
-             max_charset_id = XFASTINT (XCAR (tail));
+           if (max_charset_id < XFIXNAT (XCAR (tail)))
+             max_charset_id = XFIXNAT (XCAR (tail));
          safe_charsets = make_uninit_string (max_charset_id + 1);
          memset (SDATA (safe_charsets), 255, max_charset_id + 1);
          for (tail = Vemacs_mule_charset_list; CONSP (tail);
               tail = XCDR (tail))
-           SSET (safe_charsets, XFASTINT (XCAR (tail)), 0);
+           SSET (safe_charsets, XFIXNAT (XCAR (tail)), 0);
          coding->max_charset_id = max_charset_id;
          coding->safe_charsets = SDATA (safe_charsets);
        }
@@ -5908,7 +5908,7 @@ coding_charset_list (struct coding_system *coding)
   CODING_GET_INFO (coding, attrs, charset_list);
   if (EQ (CODING_ATTR_TYPE (attrs), Qiso_2022))
     {
-      int flags = XINT (AREF (attrs, coding_attr_iso_flags));
+      int flags = XFIXNUM (AREF (attrs, coding_attr_iso_flags));
 
       if (flags & CODING_ISO_FLAG_FULL_SUPPORT)
        charset_list = Viso_2022_charset_list;
@@ -5934,7 +5934,7 @@ coding_system_charset_list (Lisp_Object coding_system)
 
   if (EQ (CODING_ATTR_TYPE (attrs), Qiso_2022))
     {
-      int flags = XINT (AREF (attrs, coding_attr_iso_flags));
+      int flags = XFIXNUM (AREF (attrs, coding_attr_iso_flags));
 
       if (flags & CODING_ISO_FLAG_FULL_SUPPORT)
        charset_list = Viso_2022_charset_list;
@@ -6714,7 +6714,7 @@ detect_coding (struct coding_system *coding)
                }
        }
     }
-  else if (XINT (CODING_ATTR_CATEGORY (CODING_ID_ATTRS (coding->id)))
+  else if (XFIXNUM (CODING_ATTR_CATEGORY (CODING_ID_ATTRS (coding->id)))
           == coding_category_utf_8_auto)
     {
       Lisp_Object coding_systems;
@@ -6740,7 +6740,7 @@ detect_coding (struct coding_system *coding)
            }
        }
     }
-  else if (XINT (CODING_ATTR_CATEGORY (CODING_ID_ATTRS (coding->id)))
+  else if (XFIXNUM (CODING_ATTR_CATEGORY (CODING_ID_ATTRS (coding->id)))
           == coding_category_utf_16_auto)
     {
       Lisp_Object coding_systems;
@@ -6924,8 +6924,8 @@ get_translation_table (Lisp_Object attrs, bool encodep, 
int *max_lookup)
          && CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (translation_table)) > 1)
        {
          val = XCHAR_TABLE (translation_table)->extras[1];
-         if (NATNUMP (val) && *max_lookup < XFASTINT (val))
-           *max_lookup = min (XFASTINT (val), MAX_LOOKUP_MAX);
+         if (FIXNATP (val) && *max_lookup < XFIXNAT (val))
+           *max_lookup = min (XFIXNAT (val), MAX_LOOKUP_MAX);
        }
       else if (CONSP (translation_table))
        {
@@ -6936,8 +6936,8 @@ get_translation_table (Lisp_Object attrs, bool encodep, 
int *max_lookup)
                && CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (XCAR (tail))) > 1)
              {
                Lisp_Object tailval = XCHAR_TABLE (XCAR (tail))->extras[1];
-               if (NATNUMP (tailval) && *max_lookup < XFASTINT (tailval))
-                 *max_lookup = min (XFASTINT (tailval), MAX_LOOKUP_MAX);
+               if (FIXNATP (tailval) && *max_lookup < XFIXNAT (tailval))
+                 *max_lookup = min (XFIXNAT (tailval), MAX_LOOKUP_MAX);
              }
        }
     }
@@ -6951,7 +6951,7 @@ get_translation_table (Lisp_Object attrs, bool encodep, 
int *max_lookup)
       {                                                                \
        trans = CHAR_TABLE_REF (table, c);                      \
        if (CHARACTERP (trans))                                 \
-         c = XFASTINT (trans), trans = Qnil;                   \
+         c = XFIXNAT (trans), trans = Qnil;                    \
       }                                                                \
     else if (CONSP (table))                                    \
       {                                                                \
@@ -6962,7 +6962,7 @@ get_translation_table (Lisp_Object attrs, bool encodep, 
int *max_lookup)
            {                                                   \
              trans = CHAR_TABLE_REF (XCAR (tail), c);          \
              if (CHARACTERP (trans))                           \
-               c = XFASTINT (trans), trans = Qnil;             \
+               c = XFIXNAT (trans), trans = Qnil;              \
              else if (! NILP (trans))                          \
                break;                                          \
            }                                                   \
@@ -6981,7 +6981,7 @@ get_translation_table (Lisp_Object attrs, bool encodep, 
int *max_lookup)
 static Lisp_Object
 get_translation (Lisp_Object trans, int *buf, int *buf_end, ptrdiff_t *nchars)
 {
-  if (INTEGERP (trans) || VECTORP (trans))
+  if (FIXNUMP (trans) || VECTORP (trans))
     {
       *nchars = 1;
       return trans;
@@ -6997,7 +6997,7 @@ get_translation (Lisp_Object trans, int *buf, int 
*buf_end, ptrdiff_t *nchars)
        {
          if (buf + i == buf_end)
            return Qt;
-         if (XINT (AREF (from, i)) != buf[i])
+         if (XFIXNUM (AREF (from, i)) != buf[i])
            break;
        }
       if (i == len)
@@ -7048,12 +7048,12 @@ produce_chars (struct coding_system *coding, 
Lisp_Object translation_table,
              if (! NILP (trans))
                {
                  trans = get_translation (trans, buf, buf_end, &from_nchars);
-                 if (INTEGERP (trans))
-                   c = XINT (trans);
+                 if (FIXNUMP (trans))
+                   c = XFIXNUM (trans);
                  else if (VECTORP (trans))
                    {
                      to_nchars = ASIZE (trans);
-                     c = XINT (AREF (trans, 0));
+                     c = XFIXNUM (AREF (trans, 0));
                    }
                  else if (EQ (trans, Qt) && ! last_block)
                    break;
@@ -7081,7 +7081,7 @@ produce_chars (struct coding_system *coding, Lisp_Object 
translation_table,
              for (i = 0; i < to_nchars; i++)
                {
                  if (i > 0)
-                   c = XINT (AREF (trans, i));
+                   c = XFIXNUM (AREF (trans, i));
                  if (coding->dst_multibyte
                      || ! CHAR_BYTE8_P (c))
                    CHAR_STRING_ADVANCE_NO_UNIFY (c, dst);
@@ -7239,11 +7239,11 @@ produce_composition (struct coding_system *coding, int 
*charbuf, ptrdiff_t pos)
       for (i = j = 0; i < len && charbuf[i] != -1; i++, j++)
        {
          if (charbuf[i] >= 0)
-           args[j] = make_number (charbuf[i]);
+           args[j] = make_fixnum (charbuf[i]);
          else
            {
              i++;
-             args[j] = make_number (charbuf[i] % 0x100);
+             args[j] = make_fixnum (charbuf[i] % 0x100);
            }
        }
       components = (i == j ? Fstring (j, args) : Fvector (j, args));
@@ -7263,7 +7263,7 @@ produce_charset (struct coding_system *coding, int 
*charbuf, ptrdiff_t pos)
   ptrdiff_t from = pos - charbuf[2];
   struct charset *charset = CHARSET_FROM_ID (charbuf[3]);
 
-  Fput_text_property (make_number (from), make_number (pos),
+  Fput_text_property (make_fixnum (from), make_fixnum (pos),
                      Qcharset, CHARSET_NAME (charset),
                      coding->dst_object);
 }
@@ -7534,7 +7534,7 @@ handle_composition_annotation (ptrdiff_t pos, ptrdiff_t 
limit,
                {
                  len = ASIZE (components);
                  for (i = 0; i < len; i++)
-                   *buf++ = XINT (AREF (components, i));
+                   *buf++ = XFIXNUM (AREF (components, i));
                }
              else if (STRINGP (components))
                {
@@ -7546,16 +7546,16 @@ handle_composition_annotation (ptrdiff_t pos, ptrdiff_t 
limit,
                      buf++;
                    }
                }
-             else if (INTEGERP (components))
+             else if (FIXNUMP (components))
                {
                  len = 1;
-                 *buf++ = XINT (components);
+                 *buf++ = XFIXNUM (components);
                }
              else if (CONSP (components))
                {
                  for (len = 0; CONSP (components);
                       len++, components = XCDR (components))
-                   *buf++ = XINT (XCAR (components));
+                   *buf++ = XFIXNUM (XCAR (components));
                }
              else
                emacs_abort ();
@@ -7591,16 +7591,16 @@ handle_charset_annotation (ptrdiff_t pos, ptrdiff_t 
limit,
   Lisp_Object val, next;
   int id;
 
-  val = Fget_text_property (make_number (pos), Qcharset, coding->src_object);
+  val = Fget_text_property (make_fixnum (pos), Qcharset, coding->src_object);
   if (! NILP (val) && CHARSETP (val))
-    id = XINT (CHARSET_SYMBOL_ID (val));
+    id = XFIXNUM (CHARSET_SYMBOL_ID (val));
   else
     id = -1;
   ADD_CHARSET_DATA (buf, 0, id);
-  next = Fnext_single_property_change (make_number (pos), Qcharset,
+  next = Fnext_single_property_change (make_fixnum (pos), Qcharset,
                                       coding->src_object,
-                                      make_number (limit));
-  *stop = XINT (next);
+                                      make_fixnum (limit));
+  *stop = XFIXNUM (next);
   return buf;
 }
 
@@ -7709,20 +7709,20 @@ consume_chars (struct coding_system *coding, 
Lisp_Object translation_table,
          lookup_buf_end = lookup_buf + i;
          trans = get_translation (trans, lookup_buf, lookup_buf_end,
                                   &from_nchars);
-         if (INTEGERP (trans))
-           c = XINT (trans);
+         if (FIXNUMP (trans))
+           c = XFIXNUM (trans);
          else if (VECTORP (trans))
            {
              to_nchars = ASIZE (trans);
              if (buf_end - buf < to_nchars)
                break;
-             c = XINT (AREF (trans, 0));
+             c = XFIXNUM (AREF (trans, 0));
            }
          else
            break;
          *buf++ = c;
          for (i = 1; i < to_nchars; i++)
-           *buf++ = XINT (AREF (trans, i));
+           *buf++ = XFIXNUM (AREF (trans, i));
          for (i = 1; i < from_nchars; i++, pos++)
            src += MULTIBYTE_LENGTH_NO_CHECK (src);
        }
@@ -8011,8 +8011,8 @@ decode_coding_gap (struct coding_system *coding,
       bset_undo_list (current_buffer, Qt);
       TEMP_SET_PT_BOTH (coding->dst_pos, coding->dst_pos_byte);
       val = call1 (CODING_ATTR_POST_READ (attrs),
-                  make_number (coding->produced_char));
-      CHECK_NATNUM (val);
+                  make_fixnum (coding->produced_char));
+      CHECK_FIXNAT (val);
       coding->produced_char += Z - prev_Z;
       coding->produced += Z_BYTE - prev_Z_BYTE;
     }
@@ -8163,8 +8163,8 @@ decode_coding_object (struct coding_system *coding,
       bset_undo_list (current_buffer, Qt);
       TEMP_SET_PT_BOTH (coding->dst_pos, coding->dst_pos_byte);
       val = safe_call1 (CODING_ATTR_POST_READ (attrs),
-                       make_number (coding->produced_char));
-      CHECK_NATNUM (val);
+                       make_fixnum (coding->produced_char));
+      CHECK_FIXNAT (val);
       coding->produced_char += Z - prev_Z;
       coding->produced += Z_BYTE - prev_Z_BYTE;
       unbind_to (count1, Qnil);
@@ -8293,7 +8293,7 @@ encode_coding_object (struct coding_system *coding,
        }
 
       safe_call2 (CODING_ATTR_PRE_WRITE (attrs),
-                 make_number (BEG), make_number (Z));
+                 make_fixnum (BEG), make_fixnum (Z));
       if (XBUFFER (coding->src_object) != current_buffer)
        kill_src_buffer = 1;
       coding->src_object = Fcurrent_buffer ();
@@ -8459,7 +8459,7 @@ from_unicode (Lisp_Object str)
   if (!STRING_MULTIBYTE (str) &&
       SBYTES (str) & 1)
     {
-      str = Fsubstring (str, make_number (0), make_number (-1));
+      str = Fsubstring (str, make_fixnum (0), make_fixnum (-1));
     }
 
   return code_convert_string_norecord (str, Qutf_16le, 0);
@@ -8618,7 +8618,7 @@ detect_coding_system (const unsigned char *src,
   detect_info.checked = detect_info.found = detect_info.rejected = 0;
 
   /* At first, detect text-format if necessary.  */
-  base_category = XINT (CODING_ATTR_CATEGORY (attrs));
+  base_category = XFIXNUM (CODING_ATTR_CATEGORY (attrs));
   if (base_category == coding_category_undecided)
     {
       enum coding_category category UNINIT;
@@ -8741,20 +8741,20 @@ detect_coding_system (const unsigned char *src,
        {
          detect_info.found = CATEGORY_MASK_RAW_TEXT;
          id = CODING_SYSTEM_ID (Qno_conversion);
-         val = list1 (make_number (id));
+         val = list1 (make_fixnum (id));
        }
       else if (! detect_info.rejected && ! detect_info.found)
        {
          detect_info.found = CATEGORY_MASK_ANY;
          id = coding_categories[coding_category_undecided].id;
-         val = list1 (make_number (id));
+         val = list1 (make_fixnum (id));
        }
       else if (highest)
        {
          if (detect_info.found)
            {
              detect_info.found = 1 << category;
-             val = list1 (make_number (this->id));
+             val = list1 (make_fixnum (this->id));
            }
          else
            for (i = 0; i < coding_category_raw_text; i++)
@@ -8762,7 +8762,7 @@ detect_coding_system (const unsigned char *src,
                {
                  detect_info.found = 1 << coding_priorities[i];
                  id = coding_categories[coding_priorities[i]].id;
-                 val = list1 (make_number (id));
+                 val = list1 (make_fixnum (id));
                  break;
                }
        }
@@ -8779,7 +8779,7 @@ detect_coding_system (const unsigned char *src,
                  found |= 1 << category;
                  id = coding_categories[category].id;
                  if (id >= 0)
-                   val = list1 (make_number (id));
+                   val = list1 (make_fixnum (id));
                }
            }
          for (i = coding_category_raw_text - 1; i >= 0; i--)
@@ -8788,7 +8788,7 @@ detect_coding_system (const unsigned char *src,
              if (detect_info.found & (1 << category))
                {
                  id = coding_categories[category].id;
-                 val = Fcons (make_number (id), val);
+                 val = Fcons (make_fixnum (id), val);
                }
            }
          detect_info.found |= found;
@@ -8804,7 +8804,7 @@ detect_coding_system (const unsigned char *src,
            this = coding_categories + coding_category_utf_8_sig;
          else
            this = coding_categories + coding_category_utf_8_nosig;
-         val = list1 (make_number (this->id));
+         val = list1 (make_fixnum (this->id));
        }
     }
   else if (base_category == coding_category_utf_16_auto)
@@ -8821,13 +8821,13 @@ detect_coding_system (const unsigned char *src,
            this = coding_categories + coding_category_utf_16_be_nosig;
          else
            this = coding_categories + coding_category_utf_16_le_nosig;
-         val = list1 (make_number (this->id));
+         val = list1 (make_fixnum (this->id));
        }
     }
   else
     {
-      detect_info.found = 1 << XINT (CODING_ATTR_CATEGORY (attrs));
-      val = list1 (make_number (coding.id));
+      detect_info.found = 1 << XFIXNUM (CODING_ATTR_CATEGORY (attrs));
+      val = list1 (make_fixnum (coding.id));
     }
 
   /* Then, detect eol-format if necessary.  */
@@ -8869,9 +8869,9 @@ detect_coding_system (const unsigned char *src,
        enum coding_category category;
        int this_eol;
 
-       id = XINT (XCAR (tail));
+       id = XFIXNUM (XCAR (tail));
        attrs = CODING_ID_ATTRS (id);
-       category = XINT (CODING_ATTR_CATEGORY (attrs));
+       category = XFIXNUM (CODING_ATTR_CATEGORY (attrs));
        eol_type = CODING_ID_EOL_TYPE (id);
        if (VECTORP (eol_type))
          {
@@ -8922,7 +8922,7 @@ highest priority.  */)
   ptrdiff_t from_byte, to_byte;
 
   validate_region (&start, &end);
-  from = XINT (start), to = XINT (end);
+  from = XFIXNUM (start), to = XFIXNUM (end);
   from_byte = CHAR_TO_BYTE (from);
   to_byte = CHAR_TO_BYTE (to);
 
@@ -8975,7 +8975,7 @@ char_encodable_p (int c, Lisp_Object attrs)
   for (tail = CODING_ATTR_CHARSET_LIST (attrs);
        CONSP (tail); tail = XCDR (tail))
     {
-      charset = CHARSET_FROM_ID (XINT (XCAR (tail)));
+      charset = CHARSET_FROM_ID (XFIXNUM (XCAR (tail)));
       if (CHAR_CHARSET_P (c, charset))
        break;
     }
@@ -9011,23 +9011,23 @@ DEFUN ("find-coding-systems-region-internal",
     }
   else
     {
-      CHECK_NUMBER_COERCE_MARKER (start);
-      CHECK_NUMBER_COERCE_MARKER (end);
-      if (XINT (start) < BEG || XINT (end) > Z || XINT (start) > XINT (end))
+      CHECK_FIXNUM_COERCE_MARKER (start);
+      CHECK_FIXNUM_COERCE_MARKER (end);
+      if (XFIXNUM (start) < BEG || XFIXNUM (end) > Z || XFIXNUM (start) > 
XFIXNUM (end))
        args_out_of_range (start, end);
       if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
        return Qt;
-      start_byte = CHAR_TO_BYTE (XINT (start));
-      end_byte = CHAR_TO_BYTE (XINT (end));
-      if (XINT (end) - XINT (start) == end_byte - start_byte)
+      start_byte = CHAR_TO_BYTE (XFIXNUM (start));
+      end_byte = CHAR_TO_BYTE (XFIXNUM (end));
+      if (XFIXNUM (end) - XFIXNUM (start) == end_byte - start_byte)
        return Qt;
 
-      if (XINT (start) < GPT && XINT (end) > GPT)
+      if (XFIXNUM (start) < GPT && XFIXNUM (end) > GPT)
        {
-         if ((GPT - XINT (start)) < (XINT (end) - GPT))
-           move_gap_both (XINT (start), start_byte);
+         if ((GPT - XFIXNUM (start)) < (XFIXNUM (end) - GPT))
+           move_gap_both (XFIXNUM (start), start_byte);
          else
-           move_gap_both (XINT (end), end_byte);
+           move_gap_both (XFIXNUM (end), end_byte);
        }
     }
 
@@ -9146,8 +9146,8 @@ to the string and treated as in `substring'.  */)
   if (NILP (string))
     {
       validate_region (&start, &end);
-      from = XINT (start);
-      to = XINT (end);
+      from = XFIXNUM (start);
+      to = XFIXNUM (end);
       if (NILP (BVAR (current_buffer, enable_multibyte_characters))
          || (ascii_compatible
              && (to - from) == (CHAR_TO_BYTE (to) - (CHAR_TO_BYTE (from)))))
@@ -9175,8 +9175,8 @@ to the string and treated as in `substring'.  */)
     n = 1;
   else
     {
-      CHECK_NATNUM (count);
-      n = XINT (count);
+      CHECK_FIXNAT (count);
+      n = XFIXNUM (count);
     }
 
   positions = Qnil;
@@ -9201,7 +9201,7 @@ to the string and treated as in `substring'.  */)
          && ! char_charset (translate_char (translation_table, c),
                             charset_list, NULL))
        {
-         positions = Fcons (make_number (from), positions);
+         positions = Fcons (make_fixnum (from), positions);
          n--;
          if (n == 0)
            break;
@@ -9265,25 +9265,25 @@ is nil.  */)
     }
   else
     {
-      CHECK_NUMBER_COERCE_MARKER (start);
-      CHECK_NUMBER_COERCE_MARKER (end);
-      if (XINT (start) < BEG || XINT (end) > Z || XINT (start) > XINT (end))
+      CHECK_FIXNUM_COERCE_MARKER (start);
+      CHECK_FIXNUM_COERCE_MARKER (end);
+      if (XFIXNUM (start) < BEG || XFIXNUM (end) > Z || XFIXNUM (start) > 
XFIXNUM (end))
        args_out_of_range (start, end);
       if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
        return Qnil;
-      start_byte = CHAR_TO_BYTE (XINT (start));
-      end_byte = CHAR_TO_BYTE (XINT (end));
-      if (XINT (end) - XINT (start) == end_byte - start_byte)
+      start_byte = CHAR_TO_BYTE (XFIXNUM (start));
+      end_byte = CHAR_TO_BYTE (XFIXNUM (end));
+      if (XFIXNUM (end) - XFIXNUM (start) == end_byte - start_byte)
        return Qnil;
 
-      if (XINT (start) < GPT && XINT (end) > GPT)
+      if (XFIXNUM (start) < GPT && XFIXNUM (end) > GPT)
        {
-         if ((GPT - XINT (start)) < (XINT (end) - GPT))
-           move_gap_both (XINT (start), start_byte);
+         if ((GPT - XFIXNUM (start)) < (XFIXNUM (end) - GPT))
+           move_gap_both (XFIXNUM (start), start_byte);
          else
-           move_gap_both (XINT (end), end_byte);
+           move_gap_both (XFIXNUM (end), end_byte);
        }
-      pos = XINT (start);
+      pos = XFIXNUM (start);
     }
 
   list = Qnil;
@@ -9318,7 +9318,7 @@ is nil.  */)
            {
              elt = XCDR (XCAR (tail));
              if (! char_encodable_p (c, XCAR (elt)))
-               XSETCDR (elt, Fcons (make_number (pos), XCDR (elt)));
+               XSETCDR (elt, Fcons (make_fixnum (pos), XCDR (elt)));
            }
          if (charset_map_loaded)
            {
@@ -9369,9 +9369,9 @@ code_convert_region (Lisp_Object start, Lisp_Object end,
     CHECK_BUFFER (dst_object);
 
   validate_region (&start, &end);
-  from = XFASTINT (start);
+  from = XFIXNAT (start);
   from_byte = CHAR_TO_BYTE (from);
-  to = XFASTINT (end);
+  to = XFIXNAT (end);
   to_byte = CHAR_TO_BYTE (to);
 
   setup_coding_system (coding_system, &coding);
@@ -9395,7 +9395,7 @@ code_convert_region (Lisp_Object start, Lisp_Object end,
     Vlast_coding_system_used = CODING_ID_NAME (coding.id);
 
   return (BUFFERP (dst_object)
-         ? make_number (coding.produced_char)
+         ? make_fixnum (coding.produced_char)
          : coding.dst_object);
 }
 
@@ -9491,7 +9491,7 @@ code_convert_string (Lisp_Object string, Lisp_Object 
coding_system,
     Vlast_coding_system_used = CODING_ID_NAME (coding.id);
 
   return (BUFFERP (dst_object)
-         ? make_number (coding.produced_char)
+         ? make_fixnum (coding.produced_char)
          : coding.dst_object);
 }
 
@@ -9610,8 +9610,8 @@ Return the corresponding character.  */)
   EMACS_INT ch;
   int c;
 
-  CHECK_NATNUM (code);
-  ch = XFASTINT (code);
+  CHECK_FIXNAT (code);
+  ch = XFIXNAT (code);
   CHECK_CODING_SYSTEM_GET_SPEC (Vsjis_coding_system, spec);
   attrs = AREF (spec, 0);
 
@@ -9620,9 +9620,9 @@ Return the corresponding character.  */)
     return code;
 
   val = CODING_ATTR_CHARSET_LIST (attrs);
-  charset_roman = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val);
-  charset_kana = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val);
-  charset_kanji = CHARSET_FROM_ID (XINT (XCAR (val)));
+  charset_roman = CHARSET_FROM_ID (XFIXNUM (XCAR (val))), val = XCDR (val);
+  charset_kana = CHARSET_FROM_ID (XFIXNUM (XCAR (val))), val = XCDR (val);
+  charset_kanji = CHARSET_FROM_ID (XFIXNUM (XCAR (val)));
 
   if (ch <= 0x7F)
     {
@@ -9649,7 +9649,7 @@ Return the corresponding character.  */)
   c = DECODE_CHAR (charset, c);
   if (c < 0)
     error ("Invalid code: %"pI"d", ch);
-  return make_number (c);
+  return make_fixnum (c);
 }
 
 
@@ -9664,7 +9664,7 @@ Return the corresponding code in SJIS.  */)
   unsigned code;
 
   CHECK_CHARACTER (ch);
-  c = XFASTINT (ch);
+  c = XFIXNAT (ch);
   CHECK_CODING_SYSTEM_GET_SPEC (Vsjis_coding_system, spec);
   attrs = AREF (spec, 0);
 
@@ -9678,7 +9678,7 @@ Return the corresponding code in SJIS.  */)
     error ("Can't encode by shift_jis encoding: %c", c);
   JIS_TO_SJIS (code);
 
-  return make_number (code);
+  return make_fixnum (code);
 }
 
 DEFUN ("decode-big5-char", Fdecode_big5_char, Sdecode_big5_char, 1, 1, 0,
@@ -9691,8 +9691,8 @@ Return the corresponding character.  */)
   EMACS_INT ch;
   int c;
 
-  CHECK_NATNUM (code);
-  ch = XFASTINT (code);
+  CHECK_FIXNAT (code);
+  ch = XFIXNAT (code);
   CHECK_CODING_SYSTEM_GET_SPEC (Vbig5_coding_system, spec);
   attrs = AREF (spec, 0);
 
@@ -9701,8 +9701,8 @@ Return the corresponding character.  */)
     return code;
 
   val = CODING_ATTR_CHARSET_LIST (attrs);
-  charset_roman = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val);
-  charset_big5 = CHARSET_FROM_ID (XINT (XCAR (val)));
+  charset_roman = CHARSET_FROM_ID (XFIXNUM (XCAR (val))), val = XCDR (val);
+  charset_big5 = CHARSET_FROM_ID (XFIXNUM (XCAR (val)));
 
   if (ch <= 0x7F)
     {
@@ -9722,7 +9722,7 @@ Return the corresponding character.  */)
   c = DECODE_CHAR (charset, c);
   if (c < 0)
     error ("Invalid code: %"pI"d", ch);
-  return make_number (c);
+  return make_fixnum (c);
 }
 
 DEFUN ("encode-big5-char", Fencode_big5_char, Sencode_big5_char, 1, 1, 0,
@@ -9736,7 +9736,7 @@ Return the corresponding character code in Big5.  */)
   unsigned code;
 
   CHECK_CHARACTER (ch);
-  c = XFASTINT (ch);
+  c = XFIXNAT (ch);
   CHECK_CODING_SYSTEM_GET_SPEC (Vbig5_coding_system, spec);
   attrs = AREF (spec, 0);
   if (ASCII_CHAR_P (c)
@@ -9748,7 +9748,7 @@ Return the corresponding character code in Big5.  */)
   if (code == CHARSET_INVALID_CODE (charset))
     error ("Can't encode by Big5 encoding: %c", c);
 
-  return make_number (code);
+  return make_fixnum (code);
 }
 
 
@@ -9770,7 +9770,7 @@ DEFUN ("set-terminal-coding-system-internal", 
Fset_terminal_coding_system_intern
   tset_charset_list
     (term, (terminal_coding->common_flags & CODING_REQUIRE_ENCODING_MASK
            ? coding_charset_list (terminal_coding)
-           : list1 (make_number (charset_ascii))));
+           : list1 (make_fixnum (charset_ascii))));
   return Qnil;
 }
 
@@ -9883,19 +9883,19 @@ usage: (find-operation-coding-system OPERATION 
ARGUMENTS...)  */)
     error ("Too few arguments");
   operation = args[0];
   if (!SYMBOLP (operation)
-      || (target_idx = Fget (operation, Qtarget_idx), !NATNUMP (target_idx)))
+      || (target_idx = Fget (operation, Qtarget_idx), !FIXNATP (target_idx)))
     error ("Invalid first argument");
-  if (nargs <= 1 + XFASTINT (target_idx))
+  if (nargs <= 1 + XFIXNAT (target_idx))
     error ("Too few arguments for operation `%s'",
           SDATA (SYMBOL_NAME (operation)));
-  target = args[XFASTINT (target_idx) + 1];
+  target = args[XFIXNAT (target_idx) + 1];
   if (!(STRINGP (target)
        || (EQ (operation, Qinsert_file_contents) && CONSP (target)
            && STRINGP (XCAR (target)) && BUFFERP (XCDR (target)))
        || (EQ (operation, Qopen_network_stream)
-           && (INTEGERP (target) || EQ (target, Qt)))))
+           && (FIXNUMP (target) || EQ (target, Qt)))))
     error ("Invalid argument %"pI"d of operation `%s'",
-          XFASTINT (target_idx) + 1, SDATA (SYMBOL_NAME (operation)));
+          XFIXNAT (target_idx) + 1, SDATA (SYMBOL_NAME (operation)));
   if (CONSP (target))
     target = XCAR (target);
 
@@ -9917,7 +9917,7 @@ usage: (find-operation-coding-system OPERATION 
ARGUMENTS...)  */)
          && ((STRINGP (target)
               && STRINGP (XCAR (elt))
               && fast_string_match (XCAR (elt), target) >= 0)
-             || (INTEGERP (target) && EQ (target, XCAR (elt)))))
+             || (FIXNUMP (target) && EQ (target, XCAR (elt)))))
        {
          val = XCDR (elt);
          /* Here, if VAL is both a valid coding system and a valid
@@ -9967,7 +9967,7 @@ usage: (set-coding-system-priority &rest coding-systems)  
*/)
 
       CHECK_CODING_SYSTEM_GET_SPEC (args[i], spec);
       attrs = AREF (spec, 0);
-      category = XINT (CODING_ATTR_CATEGORY (attrs));
+      category = XFIXNUM (CODING_ATTR_CATEGORY (attrs));
       if (changed[category])
        /* Ignore this coding system because a coding system of the
           same category already had a higher priority.  */
@@ -10076,7 +10076,7 @@ usage: (define-coding-system-internal ...)  */)
   if (nargs < coding_arg_max)
     goto short_args;
 
-  attrs = Fmake_vector (make_number (coding_attr_last_index), Qnil);
+  attrs = Fmake_vector (make_fixnum (coding_attr_last_index), Qnil);
 
   name = args[coding_arg_name];
   CHECK_SYMBOL (name);
@@ -10108,10 +10108,10 @@ usage: (define-coding-system-internal ...)  */)
        }
       for (tail = charset_list; CONSP (tail); tail = XCDR (tail))
        {
-         if (! RANGED_INTEGERP (0, XCAR (tail), INT_MAX - 1))
+         if (! RANGED_FIXNUMP (0, XCAR (tail), INT_MAX - 1))
            error ("Invalid charset-list");
-         if (max_charset_id < XFASTINT (XCAR (tail)))
-           max_charset_id = XFASTINT (XCAR (tail));
+         if (max_charset_id < XFIXNAT (XCAR (tail)))
+           max_charset_id = XFIXNAT (XCAR (tail));
        }
     }
   else
@@ -10131,7 +10131,7 @@ usage: (define-coding-system-internal ...)  */)
            error ("Can't handle charset `%s'",
                   SDATA (SYMBOL_NAME (CHARSET_NAME (charset))));
 
-         XSETCAR (tail, make_number (charset->id));
+         XSETCAR (tail, make_fixnum (charset->id));
          if (max_charset_id < charset->id)
            max_charset_id = charset->id;
        }
@@ -10141,7 +10141,7 @@ usage: (define-coding-system-internal ...)  */)
   safe_charsets = make_uninit_string (max_charset_id + 1);
   memset (SDATA (safe_charsets), 255, max_charset_id + 1);
   for (tail = charset_list; CONSP (tail); tail = XCDR (tail))
-    SSET (safe_charsets, XFASTINT (XCAR (tail)), 0);
+    SSET (safe_charsets, XFIXNAT (XCAR (tail)), 0);
   ASET (attrs, coding_attr_safe_charsets, safe_charsets);
 
   ASET (attrs, coding_attr_ascii_compat, args[coding_arg_ascii_compatible_p]);
@@ -10166,7 +10166,7 @@ usage: (define-coding-system-internal ...)  */)
 
   val = args[coding_arg_default_char];
   if (NILP (val))
-    ASET (attrs, coding_attr_default_char, make_number (' '));
+    ASET (attrs, coding_attr_default_char, make_fixnum (' '));
   else
     {
       CHECK_CHARACTER (val);
@@ -10194,11 +10194,11 @@ usage: (define-coding-system-internal ...)  */)
         If Nth element is a list of charset IDs, N is the first byte
         of one of them.  The list is sorted by dimensions of the
         charsets.  A charset of smaller dimension comes first. */
-      val = Fmake_vector (make_number (256), Qnil);
+      val = Fmake_vector (make_fixnum (256), Qnil);
 
       for (tail = charset_list; CONSP (tail); tail = XCDR (tail))
        {
-         struct charset *charset = CHARSET_FROM_ID (XFASTINT (XCAR (tail)));
+         struct charset *charset = CHARSET_FROM_ID (XFIXNAT (XCAR (tail)));
          int dim = CHARSET_DIMENSION (charset);
          int idx = (dim - 1) * 4;
 
@@ -10214,9 +10214,9 @@ usage: (define-coding-system-internal ...)  */)
              tmp = AREF (val, i);
              if (NILP (tmp))
                tmp = XCAR (tail);
-             else if (NUMBERP (tmp))
+             else if (FIXED_OR_FLOATP (tmp))
                {
-                 dim2 = CHARSET_DIMENSION (CHARSET_FROM_ID (XFASTINT (tmp)));
+                 dim2 = CHARSET_DIMENSION (CHARSET_FROM_ID (XFIXNAT (tmp)));
                  if (dim < dim2)
                    tmp = list2 (XCAR (tail), tmp);
                  else
@@ -10226,7 +10226,7 @@ usage: (define-coding-system-internal ...)  */)
                {
                  for (tmp2 = tmp; CONSP (tmp2); tmp2 = XCDR (tmp2))
                    {
-                     dim2 = CHARSET_DIMENSION (CHARSET_FROM_ID (XFASTINT (XCAR 
(tmp2))));
+                     dim2 = CHARSET_DIMENSION (CHARSET_FROM_ID (XFIXNAT (XCAR 
(tmp2))));
                      if (dim < dim2)
                        break;
                    }
@@ -10264,31 +10264,31 @@ usage: (define-coding-system-internal ...)  */)
       ASET (attrs, coding_attr_ccl_encoder, val);
 
       val = args[coding_arg_ccl_valids];
-      valids = Fmake_string (make_number (256), make_number (0), Qnil);
+      valids = Fmake_string (make_fixnum (256), make_fixnum (0), Qnil);
       for (tail = val; CONSP (tail); tail = XCDR (tail))
        {
          int from, to;
 
          val = XCAR (tail);
-         if (INTEGERP (val))
+         if (FIXNUMP (val))
            {
-             if (! (0 <= XINT (val) && XINT (val) <= 255))
-               args_out_of_range_3 (val, make_number (0), make_number (255));
-             from = to = XINT (val);
+             if (! (0 <= XFIXNUM (val) && XFIXNUM (val) <= 255))
+               args_out_of_range_3 (val, make_fixnum (0), make_fixnum (255));
+             from = to = XFIXNUM (val);
            }
          else
            {
              CHECK_CONS (val);
-             CHECK_NATNUM_CAR (val);
-             CHECK_NUMBER_CDR (val);
-             if (XINT (XCAR (val)) > 255)
+             CHECK_FIXNAT_CAR (val);
+             CHECK_FIXNUM_CDR (val);
+             if (XFIXNUM (XCAR (val)) > 255)
                args_out_of_range_3 (XCAR (val),
-                                    make_number (0), make_number (255));
-             from = XINT (XCAR (val));
-             if (! (from <= XINT (XCDR (val)) && XINT (XCDR (val)) <= 255))
+                                    make_fixnum (0), make_fixnum (255));
+             from = XFIXNUM (XCAR (val));
+             if (! (from <= XFIXNUM (XCDR (val)) && XFIXNUM (XCDR (val)) <= 
255))
                args_out_of_range_3 (XCDR (val),
-                                    XCAR (val), make_number (255));
-             to = XINT (XCDR (val));
+                                    XCAR (val), make_fixnum (255));
+             to = XFIXNUM (XCDR (val));
            }
          for (i = from; i <= to; i++)
            SSET (valids, i, 1);
@@ -10352,18 +10352,18 @@ usage: (define-coding-system-internal ...)  */)
              struct charset *charset;
 
              CHECK_CHARSET_GET_CHARSET (val, charset);
-             ASET (initial, i, make_number (CHARSET_ID (charset)));
+             ASET (initial, i, make_fixnum (CHARSET_ID (charset)));
              if (i == 0 && CHARSET_ASCII_COMPATIBLE_P (charset))
                ASET (attrs, coding_attr_ascii_compat, Qt);
            }
          else
-           ASET (initial, i, make_number (-1));
+           ASET (initial, i, make_fixnum (-1));
        }
 
       reg_usage = args[coding_arg_iso2022_reg_usage];
       CHECK_CONS (reg_usage);
-      CHECK_NUMBER_CAR (reg_usage);
-      CHECK_NUMBER_CDR (reg_usage);
+      CHECK_FIXNUM_CAR (reg_usage);
+      CHECK_FIXNUM_CDR (reg_usage);
 
       request = Fcopy_sequence (args[coding_arg_iso2022_request]);
       for (tail = request; CONSP (tail); tail = XCDR (tail))
@@ -10375,18 +10375,18 @@ usage: (define-coding-system-internal ...)  */)
          CHECK_CONS (val);
          tmp1 = XCAR (val);
          CHECK_CHARSET_GET_ID (tmp1, id);
-         CHECK_NATNUM_CDR (val);
-         if (XINT (XCDR (val)) >= 4)
-           error ("Invalid graphic register number: %"pI"d", XINT (XCDR 
(val)));
-         XSETCAR (val, make_number (id));
+         CHECK_FIXNAT_CDR (val);
+         if (XFIXNUM (XCDR (val)) >= 4)
+           error ("Invalid graphic register number: %"pI"d", XFIXNUM (XCDR 
(val)));
+         XSETCAR (val, make_fixnum (id));
        }
 
       flags = args[coding_arg_iso2022_flags];
-      CHECK_NATNUM (flags);
-      i = XINT (flags) & INT_MAX;
+      CHECK_FIXNAT (flags);
+      i = XFIXNUM (flags) & INT_MAX;
       if (EQ (args[coding_arg_charset_list], Qiso_2022))
        i |= CODING_ISO_FLAG_FULL_SUPPORT;
-      flags = make_number (i);
+      flags = make_fixnum (i);
 
       ASET (attrs, coding_attr_iso_initial, initial);
       ASET (attrs, coding_attr_iso_usage, reg_usage);
@@ -10403,7 +10403,7 @@ usage: (define-coding-system-internal ...)  */)
                    : coding_category_iso_7_tight);
       else
        {
-         int id = XINT (AREF (initial, 1));
+         int id = XFIXNUM (AREF (initial, 1));
 
          category = (((i & CODING_ISO_FLAG_LOCKING_SHIFT)
                       || EQ (args[coding_arg_charset_list], Qiso_2022)
@@ -10429,11 +10429,11 @@ usage: (define-coding-system-internal ...)  */)
 
       struct charset *charset;
 
-      if (XINT (Flength (charset_list)) != 3
-         && XINT (Flength (charset_list)) != 4)
+      if (XFIXNUM (Flength (charset_list)) != 3
+         && XFIXNUM (Flength (charset_list)) != 4)
        error ("There should be three or four charsets");
 
-      charset = CHARSET_FROM_ID (XINT (XCAR (charset_list)));
+      charset = CHARSET_FROM_ID (XFIXNUM (XCAR (charset_list)));
       if (CHARSET_DIMENSION (charset) != 1)
        error ("Dimension of charset %s is not one",
               SDATA (SYMBOL_NAME (CHARSET_NAME (charset))));
@@ -10441,13 +10441,13 @@ usage: (define-coding-system-internal ...)  */)
        ASET (attrs, coding_attr_ascii_compat, Qt);
 
       charset_list = XCDR (charset_list);
-      charset = CHARSET_FROM_ID (XINT (XCAR (charset_list)));
+      charset = CHARSET_FROM_ID (XFIXNUM (XCAR (charset_list)));
       if (CHARSET_DIMENSION (charset) != 1)
        error ("Dimension of charset %s is not one",
               SDATA (SYMBOL_NAME (CHARSET_NAME (charset))));
 
       charset_list = XCDR (charset_list);
-      charset = CHARSET_FROM_ID (XINT (XCAR (charset_list)));
+      charset = CHARSET_FROM_ID (XFIXNUM (XCAR (charset_list)));
       if (CHARSET_DIMENSION (charset) != 2)
        error ("Dimension of charset %s is not two",
               SDATA (SYMBOL_NAME (CHARSET_NAME (charset))));
@@ -10455,7 +10455,7 @@ usage: (define-coding-system-internal ...)  */)
       charset_list = XCDR (charset_list);
       if (! NILP (charset_list))
        {
-         charset = CHARSET_FROM_ID (XINT (XCAR (charset_list)));
+         charset = CHARSET_FROM_ID (XFIXNUM (XCAR (charset_list)));
          if (CHARSET_DIMENSION (charset) != 2)
            error ("Dimension of charset %s is not two",
                   SDATA (SYMBOL_NAME (CHARSET_NAME (charset))));
@@ -10468,10 +10468,10 @@ usage: (define-coding-system-internal ...)  */)
     {
       struct charset *charset;
 
-      if (XINT (Flength (charset_list)) != 2)
+      if (XFIXNUM (Flength (charset_list)) != 2)
        error ("There should be just two charsets");
 
-      charset = CHARSET_FROM_ID (XINT (XCAR (charset_list)));
+      charset = CHARSET_FROM_ID (XFIXNUM (XCAR (charset_list)));
       if (CHARSET_DIMENSION (charset) != 1)
        error ("Dimension of charset %s is not one",
               SDATA (SYMBOL_NAME (CHARSET_NAME (charset))));
@@ -10479,7 +10479,7 @@ usage: (define-coding-system-internal ...)  */)
        ASET (attrs, coding_attr_ascii_compat, Qt);
 
       charset_list = XCDR (charset_list);
-      charset = CHARSET_FROM_ID (XINT (XCAR (charset_list)));
+      charset = CHARSET_FROM_ID (XFIXNUM (XCAR (charset_list)));
       if (CHARSET_DIMENSION (charset) != 2)
        error ("Dimension of charset %s is not two",
               SDATA (SYMBOL_NAME (CHARSET_NAME (charset))));
@@ -10532,7 +10532,7 @@ usage: (define-coding-system-internal ...)  */)
     error ("Invalid coding system type: %s",
           SDATA (SYMBOL_NAME (coding_type)));
 
-  ASET (attrs, coding_attr_category, make_number (category));
+  ASET (attrs, coding_attr_category, make_fixnum (category));
   ASET (attrs, coding_attr_plist,
        Fcons (QCcategory,
               Fcons (AREF (Vcoding_category_table, category),
@@ -10599,7 +10599,7 @@ usage: (define-coding-system-internal ...)  */)
  short_args:
   Fsignal (Qwrong_number_of_arguments,
           Fcons (intern ("define-coding-system-internal"),
-                 make_number (nargs)));
+                 make_fixnum (nargs)));
 }
 
 
@@ -10621,7 +10621,7 @@ DEFUN ("coding-system-put", Fcoding_system_put, 
Scoding_system_put,
   else if (EQ (prop, QCdefault_char))
     {
       if (NILP (val))
-       val = make_number (' ');
+       val = make_fixnum (' ');
       else
        CHECK_CHARACTER (val);
       ASET (attrs, coding_attr_default_char, val);
@@ -10766,7 +10766,7 @@ coding system whose eol-type is N.  */)
   if (VECTORP (eol_type))
     return Fcopy_sequence (eol_type);
   n = EQ (eol_type, Qunix) ? 0 : EQ (eol_type, Qdos) ? 1 : 2;
-  return make_number (n);
+  return make_fixnum (n);
 }
 
 #endif /* emacs */
@@ -10842,25 +10842,25 @@ syms_of_coding (void)
   Fset (Qcoding_system_history, Qnil);
 
   /* Target FILENAME is the first argument.  */
-  Fput (Qinsert_file_contents, Qtarget_idx, make_number (0));
+  Fput (Qinsert_file_contents, Qtarget_idx, make_fixnum (0));
   /* Target FILENAME is the third argument.  */
-  Fput (Qwrite_region, Qtarget_idx, make_number (2));
+  Fput (Qwrite_region, Qtarget_idx, make_fixnum (2));
 
   DEFSYM (Qcall_process, "call-process");
   /* Target PROGRAM is the first argument.  */
-  Fput (Qcall_process, Qtarget_idx, make_number (0));
+  Fput (Qcall_process, Qtarget_idx, make_fixnum (0));
 
   DEFSYM (Qcall_process_region, "call-process-region");
   /* Target PROGRAM is the third argument.  */
-  Fput (Qcall_process_region, Qtarget_idx, make_number (2));
+  Fput (Qcall_process_region, Qtarget_idx, make_fixnum (2));
 
   DEFSYM (Qstart_process, "start-process");
   /* Target PROGRAM is the third argument.  */
-  Fput (Qstart_process, Qtarget_idx, make_number (2));
+  Fput (Qstart_process, Qtarget_idx, make_fixnum (2));
 
   DEFSYM (Qopen_network_stream, "open-network-stream");
   /* Target SERVICE is the fourth argument.  */
-  Fput (Qopen_network_stream, Qtarget_idx, make_number (3));
+  Fput (Qopen_network_stream, Qtarget_idx, make_fixnum (3));
 
   DEFSYM (Qunix, "unix");
   DEFSYM (Qdos, "dos");
@@ -10899,7 +10899,7 @@ syms_of_coding (void)
        build_pure_c_string ("Invalid coding system"));
 
   DEFSYM (Qtranslation_table, "translation-table");
-  Fput (Qtranslation_table, Qchar_table_extra_slots, make_number (2));
+  Fput (Qtranslation_table, Qchar_table_extra_slots, make_fixnum (2));
   DEFSYM (Qtranslation_table_id, "translation-table-id");
 
   /* Coding system emacs-mule and raw-text are for converting only
@@ -10916,7 +10916,7 @@ syms_of_coding (void)
   DEFSYM (QCascii_compatible_p, ":ascii-compatible-p");
 
   Vcoding_category_table
-    = Fmake_vector (make_number (coding_category_max), Qnil);
+    = Fmake_vector (make_fixnum (coding_category_max), Qnil);
   staticpro (&Vcoding_category_table);
   /* Followings are target of code detection.  */
   ASET (Vcoding_category_table, coding_category_iso_7,
@@ -11220,7 +11220,7 @@ a coding system of ISO 2022 variant which has a flag
 `accept-latin-extra-code' t (e.g. iso-latin-1) on reading a file
 or reading output of a subprocess.
 Only 128th through 159th elements have a meaning.  */);
-  Vlatin_extra_code_table = Fmake_vector (make_number (256), Qnil);
+  Vlatin_extra_code_table = Fmake_vector (make_fixnum (256), Qnil);
 
   DEFVAR_LISP ("select-safe-coding-system-function",
               Vselect_safe_coding_system_function,
@@ -11309,13 +11309,13 @@ internal character representation.  */);
       QCname,
       args[coding_arg_name] = Qno_conversion,
       QCmnemonic,
-      args[coding_arg_mnemonic] = make_number ('='),
+      args[coding_arg_mnemonic] = make_fixnum ('='),
       intern_c_string (":coding-type"),
       args[coding_arg_coding_type] = Qraw_text,
       QCascii_compatible_p,
       args[coding_arg_ascii_compatible_p] = Qt,
       QCdefault_char,
-      args[coding_arg_default_char] = make_number (0),
+      args[coding_arg_default_char] = make_fixnum (0),
       intern_c_string (":for-unibyte"),
       args[coding_arg_for_unibyte] = Qt,
       intern_c_string (":docstring"),
@@ -11332,7 +11332,7 @@ internal character representation.  */);
   Fdefine_coding_system_internal (coding_arg_max, args);
 
   plist[1] = args[coding_arg_name] = Qundecided;
-  plist[3] = args[coding_arg_mnemonic] = make_number ('-');
+  plist[3] = args[coding_arg_mnemonic] = make_fixnum ('-');
   plist[5] = args[coding_arg_coding_type] = Qundecided;
   /* This is already set.
      plist[7] = args[coding_arg_ascii_compatible_p] = Qt; */
@@ -11343,8 +11343,8 @@ internal character representation.  */);
                                   "automatic conversion on decoding.");
   plist[15] = args[coding_arg_eol_type] = Qnil;
   args[coding_arg_plist] = CALLMANY (Flist, plist);
-  args[coding_arg_undecided_inhibit_null_byte_detection] = make_number (0);
-  args[coding_arg_undecided_inhibit_iso_escape_detection] = make_number (0);
+  args[coding_arg_undecided_inhibit_null_byte_detection] = make_fixnum (0);
+  args[coding_arg_undecided_inhibit_iso_escape_detection] = make_fixnum (0);
   Fdefine_coding_system_internal (coding_arg_undecided_max, args);
 
   setup_coding_system (Qno_conversion, &safe_terminal_coding);
diff --git a/src/composite.c b/src/composite.c
index 746c295..39c54fc 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -193,12 +193,12 @@ get_composition_id (ptrdiff_t charpos, ptrdiff_t bytepos, 
ptrdiff_t nchars,
     goto invalid_composition;
 
   id = XCAR (prop);
-  if (INTEGERP (id))
+  if (FIXNUMP (id))
     {
       /* PROP should be Form-B.  */
-      if (XINT (id) < 0 || XINT (id) >= n_compositions)
+      if (XFIXNUM (id) < 0 || XFIXNUM (id) >= n_compositions)
        goto invalid_composition;
-      return XINT (id);
+      return XFIXNUM (id);
     }
 
   /* PROP should be Form-A.
@@ -206,7 +206,7 @@ get_composition_id (ptrdiff_t charpos, ptrdiff_t bytepos, 
ptrdiff_t nchars,
   if (!CONSP (id))
     goto invalid_composition;
   length = XCAR (id);
-  if (!INTEGERP (length) || XINT (length) != nchars)
+  if (!FIXNUMP (length) || XFIXNUM (length) != nchars)
     goto invalid_composition;
 
   components = XCDR (id);
@@ -215,8 +215,8 @@ get_composition_id (ptrdiff_t charpos, ptrdiff_t bytepos, 
ptrdiff_t nchars,
      by consulting composition_hash_table.  The key for this table is
      COMPONENTS (converted to a vector COMPONENTS-VEC) or, if it is
      nil, vector of characters in the composition range.  */
-  if (INTEGERP (components))
-    key = Fmake_vector (make_number (1), components);
+  if (FIXNUMP (components))
+    key = Fmake_vector (make_fixnum (1), components);
   else if (STRINGP (components) || CONSP (components))
     key = Fvconcat (1, &components);
   else if (VECTORP (components))
@@ -228,13 +228,13 @@ get_composition_id (ptrdiff_t charpos, ptrdiff_t bytepos, 
ptrdiff_t nchars,
        for (i = 0; i < nchars; i++)
          {
            FETCH_STRING_CHAR_ADVANCE (ch, string, charpos, bytepos);
-           ASET (key, i, make_number (ch));
+           ASET (key, i, make_fixnum (ch));
          }
       else
        for (i = 0; i < nchars; i++)
          {
            FETCH_CHAR_ADVANCE (ch, charpos, bytepos);
-           ASET (key, i, make_number (ch));
+           ASET (key, i, make_fixnum (ch));
          }
     }
   else
@@ -250,8 +250,8 @@ get_composition_id (ptrdiff_t charpos, ptrdiff_t bytepos, 
ptrdiff_t nchars,
       key = HASH_KEY (hash_table, hash_index);
       id = HASH_VALUE (hash_table, hash_index);
       XSETCAR (prop, id);
-      XSETCDR (prop, Fcons (make_number (nchars), Fcons (key, XCDR (prop))));
-      return XINT (id);
+      XSETCDR (prop, Fcons (make_fixnum (nchars), Fcons (key, XCDR (prop))));
+      return XFIXNUM (id);
     }
 
   /* This composition is a new one.  We must register it.  */
@@ -289,7 +289,7 @@ get_composition_id (ptrdiff_t charpos, ptrdiff_t bytepos, 
ptrdiff_t nchars,
          composition rule).  */
       for (i = 0; i < len; i++)
        {
-         if (!INTEGERP (key_contents[i]))
+         if (!FIXNUMP (key_contents[i]))
            goto invalid_composition;
        }
     }
@@ -298,14 +298,14 @@ get_composition_id (ptrdiff_t charpos, ptrdiff_t bytepos, 
ptrdiff_t nchars,
      the cons cell of PROP because it is not shared.  */
   XSETFASTINT (id, n_compositions);
   XSETCAR (prop, id);
-  XSETCDR (prop, Fcons (make_number (nchars), Fcons (key, XCDR (prop))));
+  XSETCDR (prop, Fcons (make_fixnum (nchars), Fcons (key, XCDR (prop))));
 
   /* Register the composition in composition_hash_table.  */
   hash_index = hash_put (hash_table, key, id, hash_code);
 
   method = (NILP (components)
            ? COMPOSITION_RELATIVE
-           : ((INTEGERP (components) || STRINGP (components))
+           : ((FIXNUMP (components) || STRINGP (components))
               ? COMPOSITION_WITH_ALTCHARS
               : COMPOSITION_WITH_RULE_ALTCHARS));
 
@@ -332,7 +332,7 @@ get_composition_id (ptrdiff_t charpos, ptrdiff_t bytepos, 
ptrdiff_t nchars,
       for (i = 0; i < glyph_len; i++)
        {
          int this_width;
-         ch = XINT (key_contents[i]);
+         ch = XFIXNUM (key_contents[i]);
          /* TAB in a composition means display glyphs with padding
             space on the left or right.  */
          this_width = (ch == '\t' ? 1 : CHARACTER_WIDTH (ch));
@@ -345,7 +345,7 @@ get_composition_id (ptrdiff_t charpos, ptrdiff_t bytepos, 
ptrdiff_t nchars,
       /* Rule-base composition.  */
       double leftmost = 0.0, rightmost;
 
-      ch = XINT (key_contents[0]);
+      ch = XFIXNUM (key_contents[0]);
       rightmost = ch != '\t' ? CHARACTER_WIDTH (ch) : 1;
 
       for (i = 1; i < glyph_len; i += 2)
@@ -354,8 +354,8 @@ get_composition_id (ptrdiff_t charpos, ptrdiff_t bytepos, 
ptrdiff_t nchars,
          int this_width;
          double this_left;
 
-         rule = XINT (key_contents[i]);
-         ch = XINT (key_contents[i + 1]);
+         rule = XFIXNUM (key_contents[i]);
+         ch = XFIXNUM (key_contents[i + 1]);
          this_width = ch != '\t' ? CHARACTER_WIDTH (ch) : 1;
 
          /* A composition rule is specified by an integer value
@@ -431,9 +431,9 @@ find_composition (ptrdiff_t pos, ptrdiff_t limit,
 
   if (limit > pos)             /* search forward */
     {
-      val = Fnext_single_property_change (make_number (pos), Qcomposition,
-                                         object, make_number (limit));
-      pos = XINT (val);
+      val = Fnext_single_property_change (make_fixnum (pos), Qcomposition,
+                                         object, make_fixnum (limit));
+      pos = XFIXNUM (val);
       if (pos == limit)
        return 0;
     }
@@ -442,9 +442,9 @@ find_composition (ptrdiff_t pos, ptrdiff_t limit,
       if (get_property_and_range (pos - 1, Qcomposition, prop, start, end,
                                  object))
        return 1;
-      val = Fprevious_single_property_change (make_number (pos), Qcomposition,
-                                             object, make_number (limit));
-      pos = XINT (val);
+      val = Fprevious_single_property_change (make_fixnum (pos), Qcomposition,
+                                             object, make_fixnum (limit));
+      pos = XFIXNUM (val);
       if (pos == limit)
        return 0;
       pos--;
@@ -474,7 +474,7 @@ run_composition_function (ptrdiff_t from, ptrdiff_t to, 
Lisp_Object prop)
       && !composition_valid_p (start, end, prop))
     to = end;
   if (!NILP (Ffboundp (func)))
-    call2 (func, make_number (from), make_number (to));
+    call2 (func, make_fixnum (from), make_fixnum (to));
 }
 
 /* Make invalid compositions adjacent to or inside FROM and TO valid.
@@ -519,7 +519,7 @@ update_compositions (ptrdiff_t from, ptrdiff_t to, int 
check_mask)
          if (end > to)
            max_pos = end;
          if (from < end)
-           Fput_text_property (make_number (from), make_number (end),
+           Fput_text_property (make_fixnum (from), make_fixnum (end),
                                Qcomposition,
                                Fcons (XCAR (prop), XCDR (prop)), Qnil);
          run_composition_function (start, end, prop);
@@ -560,7 +560,7 @@ update_compositions (ptrdiff_t from, ptrdiff_t to, int 
check_mask)
             the former to the copy of it.  */
          if (to < end)
            {
-             Fput_text_property (make_number (start), make_number (to),
+             Fput_text_property (make_fixnum (start), make_fixnum (to),
                                  Qcomposition,
                                  Fcons (XCAR (prop), XCDR (prop)), Qnil);
              max_pos = end;
@@ -582,8 +582,8 @@ update_compositions (ptrdiff_t from, ptrdiff_t to, int 
check_mask)
       specbind (Qinhibit_read_only, Qt);
       specbind (Qinhibit_modification_hooks, Qt);
       specbind (Qinhibit_point_motion_hooks, Qt);
-      Fremove_list_of_text_properties (make_number (min_pos),
-                                      make_number (max_pos),
+      Fremove_list_of_text_properties (make_fixnum (min_pos),
+                                      make_fixnum (max_pos),
                                       list1 (Qauto_composed), Qnil);
       unbind_to (count, Qnil);
     }
@@ -625,9 +625,9 @@ compose_text (ptrdiff_t start, ptrdiff_t end, Lisp_Object 
components,
 {
   Lisp_Object prop;
 
-  prop = Fcons (Fcons (make_number (end - start), components),
+  prop = Fcons (Fcons (make_fixnum (end - start), components),
                modification_func);
-  Fput_text_property  (make_number (start), make_number (end),
+  Fput_text_property  (make_fixnum (start), make_fixnum (end),
                       Qcomposition, prop, string);
 }
 
@@ -669,12 +669,12 @@ composition_gstring_put_cache (Lisp_Object gstring, 
ptrdiff_t len)
       len = j;
     }
 
-  copy = Fmake_vector (make_number (len + 2), Qnil);
+  copy = Fmake_vector (make_fixnum (len + 2), Qnil);
   LGSTRING_SET_HEADER (copy, Fcopy_sequence (header));
   for (i = 0; i < len; i++)
     LGSTRING_SET_GLYPH (copy, i, Fcopy_sequence (LGSTRING_GLYPH (gstring, i)));
   i = hash_put (h, LGSTRING_HEADER (copy), copy, hash);
-  LGSTRING_SET_ID (copy, make_number (i));
+  LGSTRING_SET_ID (copy, make_fixnum (i));
   return copy;
 }
 
@@ -692,7 +692,7 @@ DEFUN ("clear-composition-cache", Fclear_composition_cache,
 Clear composition cache.  */)
   (void)
 {
-  Lisp_Object args[] = {QCtest, Qequal, QCsize, make_number (311)};
+  Lisp_Object args[] = {QCtest, Qequal, QCsize, make_fixnum (311)};
   gstring_hash_table = CALLMANY (Fmake_hash_table, args);
   /* Fixme: We call Fclear_face_cache to force complete re-building of
      display glyphs.  But, it may be better to call this function from
@@ -716,9 +716,9 @@ composition_gstring_p (Lisp_Object gstring)
          && ! CODING_SYSTEM_P (LGSTRING_FONT (gstring))))
     return 0;
   for (i = 1; i < ASIZE (LGSTRING_HEADER (gstring)); i++)
-    if (! NATNUMP (AREF (LGSTRING_HEADER (gstring), i)))
+    if (! FIXNATP (AREF (LGSTRING_HEADER (gstring), i)))
       return 0;
-  if (! NILP (LGSTRING_ID (gstring)) && ! NATNUMP (LGSTRING_ID (gstring)))
+  if (! NILP (LGSTRING_ID (gstring)) && ! FIXNATP (LGSTRING_ID (gstring)))
     return 0;
   for (i = 0; i < LGSTRING_GLYPH_LEN (gstring); i++)
     {
@@ -801,7 +801,7 @@ fill_gstring_header (Lisp_Object header, ptrdiff_t from, 
ptrdiff_t from_byte,
   if (VECTORP (header))
     {
       if (ASIZE (header) != len + 1)
-       args_out_of_range (header, make_number (len + 1));
+       args_out_of_range (header, make_fixnum (len + 1));
     }
   else
     {
@@ -820,7 +820,7 @@ fill_gstring_header (Lisp_Object header, ptrdiff_t from, 
ptrdiff_t from_byte,
        FETCH_CHAR_ADVANCE_NO_CHECK (c, from, from_byte);
       else
        FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, string, from, from_byte);
-      ASET (header, i + 1, make_number (c));
+      ASET (header, i + 1, make_fixnum (c));
     }
   return header;
 }
@@ -836,7 +836,7 @@ fill_gstring_body (Lisp_Object gstring)
   for (i = 0; i < len; i++)
     {
       Lisp_Object g = LGSTRING_GLYPH (gstring, i);
-      int c = XFASTINT (AREF (header, i + 1));
+      int c = XFIXNAT (AREF (header, i + 1));
 
       if (NILP (g))
        {
@@ -852,7 +852,7 @@ fill_gstring_body (Lisp_Object gstring)
        }
       else
        {
-         int width = XFASTINT (CHAR_TABLE_REF (Vchar_width_table, c));
+         int width = XFIXNAT (CHAR_TABLE_REF (Vchar_width_table, c));
 
          LGLYPH_SET_CODE (g, c);
          LGLYPH_SET_LBEARING (g, 0);
@@ -881,7 +881,7 @@ autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, 
ptrdiff_t bytepos,
               Lisp_Object string)
 {
   ptrdiff_t count = SPECPDL_INDEX ();
-  Lisp_Object pos = make_number (charpos);
+  Lisp_Object pos = make_fixnum (charpos);
   ptrdiff_t to;
   ptrdiff_t pt = PT, pt_byte = PT_BYTE;
   Lisp_Object re, font_object, lgstring;
@@ -917,7 +917,7 @@ autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, 
ptrdiff_t bytepos,
        return unbind_to (count, Qnil);
     }
 #endif
-  lgstring = Fcomposition_get_gstring (pos, make_number (to), font_object,
+  lgstring = Fcomposition_get_gstring (pos, make_fixnum (to), font_object,
                                       string);
   if (NILP (LGSTRING_ID (lgstring)))
     {
@@ -926,7 +926,7 @@ autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, 
ptrdiff_t bytepos,
        record_unwind_protect (restore_point_unwind,
                               build_marker (current_buffer, pt, pt_byte));
       lgstring = safe_call (6, Vauto_composition_function, AREF (rule, 2),
-                           pos, make_number (to), font_object, string);
+                           pos, make_fixnum (to), font_object, string);
     }
   return unbind_to (count, lgstring);
 }
@@ -941,7 +941,7 @@ char_composable_p (int c)
   return (c > ' '
          && (c == ZERO_WIDTH_NON_JOINER || c == ZERO_WIDTH_JOINER
              || (val = CHAR_TABLE_REF (Vunicode_category_table, c),
-                 (INTEGERP (val) && (XINT (val) <= UNICODE_CATEGORY_So)))));
+                 (FIXNUMP (val) && (XFIXNUM (val) <= UNICODE_CATEGORY_So)))));
 }
 
 /* Update cmp_it->stop_pos to the next position after CHARPOS (and
@@ -1030,11 +1030,11 @@ composition_compute_stop_pos (struct composition_it 
*cmp_it, ptrdiff_t charpos,
                {
                  Lisp_Object elt = XCAR (val);
                  if (VECTORP (elt) && ASIZE (elt) == 3
-                     && NATNUMP (AREF (elt, 1))
-                     && charpos - 1 - XFASTINT (AREF (elt, 1)) >= start)
+                     && FIXNATP (AREF (elt, 1))
+                     && charpos - 1 - XFIXNAT (AREF (elt, 1)) >= start)
                    {
                      cmp_it->rule_idx = ridx;
-                     cmp_it->lookback = XFASTINT (AREF (elt, 1));
+                     cmp_it->lookback = XFIXNAT (AREF (elt, 1));
                      cmp_it->stop_pos = charpos - 1 - cmp_it->lookback;
                      cmp_it->ch = c;
                      return;
@@ -1081,10 +1081,10 @@ composition_compute_stop_pos (struct composition_it 
*cmp_it, ptrdiff_t charpos,
            {
              Lisp_Object elt = XCAR (val);
              if (VECTORP (elt) && ASIZE (elt) == 3
-                 && NATNUMP (AREF (elt, 1))
-                 && charpos - XFASTINT (AREF (elt, 1)) > endpos)
+                 && FIXNATP (AREF (elt, 1))
+                 && charpos - XFIXNAT (AREF (elt, 1)) > endpos)
                {
-                 ptrdiff_t back = XFASTINT (AREF (elt, 1));
+                 ptrdiff_t back = XFIXNAT (AREF (elt, 1));
                  ptrdiff_t cpos = charpos - back, bpos;
 
                  if (back == 0)
@@ -1221,9 +1221,9 @@ composition_reseat_it (struct composition_it *cmp_it, 
ptrdiff_t charpos,
            {
              elt = XCAR (val);
              if (! VECTORP (elt) || ASIZE (elt) != 3
-                 || ! INTEGERP (AREF (elt, 1)))
+                 || ! FIXNUMP (AREF (elt, 1)))
                continue;
-             if (XFASTINT (AREF (elt, 1)) != cmp_it->lookback)
+             if (XFIXNAT (AREF (elt, 1)) != cmp_it->lookback)
                goto no_composition;
              lgstring = autocmp_chars (elt, charpos, bytepos, endpos,
                                        w, face, string);
@@ -1262,7 +1262,7 @@ composition_reseat_it (struct composition_it *cmp_it, 
ptrdiff_t charpos,
        goto no_composition;
       if (NILP (LGSTRING_ID (lgstring)))
        lgstring = composition_gstring_put_cache (lgstring, -1);
-      cmp_it->id = XINT (LGSTRING_ID (lgstring));
+      cmp_it->id = XFIXNUM (LGSTRING_ID (lgstring));
       int i;
       for (i = 0; i < LGSTRING_GLYPH_LEN (lgstring); i++)
        if (NILP (LGSTRING_GLYPH (lgstring, i)))
@@ -1391,7 +1391,7 @@ composition_update_it (struct composition_it *cmp_it, 
ptrdiff_t charpos, ptrdiff
       cmp_it->width = 0;
       for (i = cmp_it->nchars - 1; i >= 0; i--)
        {
-         c = XINT (LGSTRING_CHAR (gstring, from + i));
+         c = XFIXNUM (LGSTRING_CHAR (gstring, from + i));
          cmp_it->nbytes += CHAR_BYTES (c);
          cmp_it->width += CHARACTER_WIDTH (c);
        }
@@ -1559,9 +1559,9 @@ find_automatic_composition (ptrdiff_t pos, ptrdiff_t 
limit,
            {
              Lisp_Object elt = XCAR (val);
 
-             if (VECTORP (elt) && ASIZE (elt) == 3 && NATNUMP (AREF (elt, 1)))
+             if (VECTORP (elt) && ASIZE (elt) == 3 && FIXNATP (AREF (elt, 1)))
                {
-                 EMACS_INT check_pos = cur.pos - XFASTINT (AREF (elt, 1));
+                 EMACS_INT check_pos = cur.pos - XFIXNAT (AREF (elt, 1));
                  struct position_record check;
 
                  if (check_pos < head
@@ -1739,8 +1739,8 @@ should be ignored.  */)
       if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
        error ("Attempt to shape unibyte text");
       validate_region (&from, &to);
-      frompos = XFASTINT (from);
-      topos = XFASTINT (to);
+      frompos = XFIXNAT (from);
+      topos = XFIXNAT (to);
       frombyte = CHAR_TO_BYTE (frompos);
     }
   else
@@ -1759,7 +1759,7 @@ should be ignored.  */)
     return gstring;
 
   if (LGSTRING_GLYPH_LEN (gstring_work) < topos - frompos)
-    gstring_work = Fmake_vector (make_number (topos - frompos + 2), Qnil);
+    gstring_work = Fmake_vector (make_fixnum (topos - frompos + 2), Qnil);
   LGSTRING_SET_HEADER (gstring_work, header);
   LGSTRING_SET_ID (gstring_work, Qnil);
   fill_gstring_body (gstring_work);
@@ -1780,12 +1780,12 @@ for the composition.  See `compose-region' for more 
details.  */)
 {
   validate_region (&start, &end);
   if (!NILP (components)
-      && !INTEGERP (components)
+      && !FIXNUMP (components)
       && !CONSP (components)
       && !STRINGP (components))
     CHECK_VECTOR (components);
 
-  compose_text (XINT (start), XINT (end), components, modification_func, Qnil);
+  compose_text (XFIXNUM (start), XFIXNUM (end), components, modification_func, 
Qnil);
   return Qnil;
 }
 
@@ -1820,11 +1820,11 @@ See `find-composition' for more details.  */)
   ptrdiff_t start, end, from, to;
   int id;
 
-  CHECK_NUMBER_COERCE_MARKER (pos);
+  CHECK_FIXNUM_COERCE_MARKER (pos);
   if (!NILP (limit))
     {
-      CHECK_NUMBER_COERCE_MARKER (limit);
-      to = min (XINT (limit), ZV);
+      CHECK_FIXNUM_COERCE_MARKER (limit);
+      to = min (XFIXNUM (limit), ZV);
     }
   else
     to = -1;
@@ -1832,15 +1832,15 @@ See `find-composition' for more details.  */)
   if (!NILP (string))
     {
       CHECK_STRING (string);
-      if (XINT (pos) < 0 || XINT (pos) > SCHARS (string))
+      if (XFIXNUM (pos) < 0 || XFIXNUM (pos) > SCHARS (string))
        args_out_of_range (string, pos);
     }
   else
     {
-      if (XINT (pos) < BEGV || XINT (pos) > ZV)
+      if (XFIXNUM (pos) < BEGV || XFIXNUM (pos) > ZV)
        args_out_of_range (Fcurrent_buffer (), pos);
     }
-  from = XINT (pos);
+  from = XFIXNUM (pos);
 
   if (!find_composition (from, to, &start, &end, &prop, string))
     {
@@ -1848,21 +1848,21 @@ See `find-composition' for more details.  */)
          && ! NILP (Vauto_composition_mode)
          && find_automatic_composition (from, to, &start, &end, &gstring,
                                         string))
-       return list3 (make_number (start), make_number (end), gstring);
+       return list3 (make_fixnum (start), make_fixnum (end), gstring);
       return Qnil;
     }
-  if ((end <= XINT (pos) || start > XINT (pos)))
+  if ((end <= XFIXNUM (pos) || start > XFIXNUM (pos)))
     {
       ptrdiff_t s, e;
 
       if (find_automatic_composition (from, to, &s, &e, &gstring, string)
-         && (e <= XINT (pos) ? e > end : s < start))
-       return list3 (make_number (s), make_number (e), gstring);
+         && (e <= XFIXNUM (pos) ? e > end : s < start))
+       return list3 (make_fixnum (s), make_fixnum (e), gstring);
     }
   if (!composition_valid_p (start, end, prop))
-    return list3 (make_number (start), make_number (end), Qnil);
+    return list3 (make_fixnum (start), make_fixnum (end), Qnil);
   if (NILP (detail_p))
-    return list3 (make_number (start), make_number (end), Qt);
+    return list3 (make_fixnum (start), make_fixnum (end), Qt);
 
   if (composition_registered_p (prop))
     id = COMPOSITION_ID (prop);
@@ -1884,12 +1884,12 @@ See `find-composition' for more details.  */)
       relative_p = (method == COMPOSITION_WITH_RULE_ALTCHARS
                    ? Qnil : Qt);
       mod_func = COMPOSITION_MODIFICATION_FUNC (prop);
-      tail = list4 (components, relative_p, mod_func, make_number (width));
+      tail = list4 (components, relative_p, mod_func, make_fixnum (width));
     }
   else
     tail = Qnil;
 
-  return Fcons (make_number (start), Fcons (make_number (end), tail));
+  return Fcons (make_fixnum (start), Fcons (make_fixnum (end), tail));
 }
 
 
@@ -1906,7 +1906,7 @@ syms_of_composite (void)
      created compositions are repeatedly used in an Emacs session,
      and thus it's not worth to save memory in such a way.  So, we
      make the table not weak.  */
-  Lisp_Object args[] = {QCtest, Qequal, QCsize, make_number (311)};
+  Lisp_Object args[] = {QCtest, Qequal, QCsize, make_fixnum (311)};
   composition_hash_table = CALLMANY (Fmake_hash_table, args);
   staticpro (&composition_hash_table);
 
@@ -1917,9 +1917,9 @@ syms_of_composite (void)
   staticpro (&gstring_work_headers);
   gstring_work_headers = make_uninit_vector (8);
   for (i = 0; i < 8; i++)
-    ASET (gstring_work_headers, i, Fmake_vector (make_number (i + 2), Qnil));
+    ASET (gstring_work_headers, i, Fmake_vector (make_fixnum (i + 2), Qnil));
   staticpro (&gstring_work);
-  gstring_work = Fmake_vector (make_number (10), Qnil);
+  gstring_work = Fmake_vector (make_fixnum (10), Qnil);
 
   /* Text property `composition' should be nonsticky by default.  */
   Vtext_property_default_nonsticky
diff --git a/src/composite.h b/src/composite.h
index 19d20fb..2d03e48 100644
--- a/src/composite.h
+++ b/src/composite.h
@@ -59,17 +59,17 @@ enum composition_method {
 INLINE bool
 composition_registered_p (Lisp_Object prop)
 {
-  return INTEGERP (XCAR (prop));
+  return FIXNUMP (XCAR (prop));
 }
 
 /* Return ID number of the already registered composition.  */
-#define COMPOSITION_ID(prop) XINT (XCAR (prop))
+#define COMPOSITION_ID(prop) XFIXNUM (XCAR (prop))
 
 /* Return length of the composition.  */
 #define COMPOSITION_LENGTH(prop)       \
   (composition_registered_p (prop)     \
-   ? XINT (XCAR (XCDR (prop)))         \
-   : XINT (XCAR (XCAR (prop))))
+   ? XFIXNUM (XCAR (XCDR (prop)))              \
+   : XFIXNUM (XCAR (XCAR (prop))))
 
 /* Return components of the composition.  */
 #define COMPOSITION_COMPONENTS(prop)   \
@@ -86,7 +86,7 @@ composition_registered_p (Lisp_Object prop)
 /* Return the Nth glyph of composition specified by CMP.  CMP is a
    pointer to `struct composition'.  */
 #define COMPOSITION_GLYPH(cmp, n)                                      \
-  XINT (XVECTOR (XVECTOR (XHASH_TABLE (composition_hash_table)         \
+  XFIXNUM (XVECTOR (XVECTOR (XHASH_TABLE (composition_hash_table)              
\
                          ->key_and_value)                              \
                 ->contents[cmp->hash_index * 2])                       \
        ->contents[cmp->method == COMPOSITION_WITH_RULE_ALTCHARS        \
@@ -96,7 +96,7 @@ composition_registered_p (Lisp_Object prop)
    rule-base composition specified by CMP.  CMP is a pointer to
    `struct composition'. */
 #define COMPOSITION_RULE(cmp, n)                               \
-  XINT (XVECTOR (XVECTOR (XHASH_TABLE (composition_hash_table) \
+  XFIXNUM (XVECTOR (XVECTOR (XHASH_TABLE (composition_hash_table)      \
                          ->key_and_value)                      \
                 ->contents[cmp->hash_index * 2])               \
        ->contents[(n) * 2 - 1])
@@ -213,7 +213,7 @@ composition_method (Lisp_Object prop)
       Lisp_Object temp = XCDR (XCAR (prop));
       return (NILP (temp)
              ? COMPOSITION_RELATIVE
-             : INTEGERP (temp) || STRINGP (temp)
+             : FIXNUMP (temp) || STRINGP (temp)
              ? COMPOSITION_WITH_ALTCHARS
              : COMPOSITION_WITH_RULE_ALTCHARS);
     }
@@ -234,7 +234,7 @@ composition_valid_p (ptrdiff_t start, ptrdiff_t end, 
Lisp_Object prop)
                  && (NILP (XCDR (XCAR (prop)))
                      || STRINGP (XCDR (XCAR (prop)))
                      || VECTORP (XCDR (XCAR (prop)))
-                     || INTEGERP (XCDR (XCAR (prop)))
+                     || FIXNUMP (XCDR (XCAR (prop)))
                      || CONSP (XCDR (XCAR (prop))))))
          && COMPOSITION_LENGTH (prop) == end - start);
 }
@@ -274,41 +274,41 @@ enum lglyph_indices
     LGLYPH_SIZE
   };
 
-#define LGLYPH_NEW() Fmake_vector (make_number (LGLYPH_SIZE), Qnil)
-#define LGLYPH_FROM(g) XINT (AREF ((g), LGLYPH_IX_FROM))
-#define LGLYPH_TO(g) XINT (AREF ((g), LGLYPH_IX_TO))
-#define LGLYPH_CHAR(g) XINT (AREF ((g), LGLYPH_IX_CHAR))
+#define LGLYPH_NEW() Fmake_vector (make_fixnum (LGLYPH_SIZE), Qnil)
+#define LGLYPH_FROM(g) XFIXNUM (AREF ((g), LGLYPH_IX_FROM))
+#define LGLYPH_TO(g) XFIXNUM (AREF ((g), LGLYPH_IX_TO))
+#define LGLYPH_CHAR(g) XFIXNUM (AREF ((g), LGLYPH_IX_CHAR))
 #define LGLYPH_CODE(g)                                         \
   (NILP (AREF ((g), LGLYPH_IX_CODE))                           \
    ? FONT_INVALID_CODE                                         \
    : cons_to_unsigned (AREF (g, LGLYPH_IX_CODE), TYPE_MAXIMUM (unsigned)))
-#define LGLYPH_WIDTH(g) XINT (AREF ((g), LGLYPH_IX_WIDTH))
-#define LGLYPH_LBEARING(g) XINT (AREF ((g), LGLYPH_IX_LBEARING))
-#define LGLYPH_RBEARING(g) XINT (AREF ((g), LGLYPH_IX_RBEARING))
-#define LGLYPH_ASCENT(g) XINT (AREF ((g), LGLYPH_IX_ASCENT))
-#define LGLYPH_DESCENT(g) XINT (AREF ((g), LGLYPH_IX_DESCENT))
+#define LGLYPH_WIDTH(g) XFIXNUM (AREF ((g), LGLYPH_IX_WIDTH))
+#define LGLYPH_LBEARING(g) XFIXNUM (AREF ((g), LGLYPH_IX_LBEARING))
+#define LGLYPH_RBEARING(g) XFIXNUM (AREF ((g), LGLYPH_IX_RBEARING))
+#define LGLYPH_ASCENT(g) XFIXNUM (AREF ((g), LGLYPH_IX_ASCENT))
+#define LGLYPH_DESCENT(g) XFIXNUM (AREF ((g), LGLYPH_IX_DESCENT))
 #define LGLYPH_ADJUSTMENT(g) AREF ((g), LGLYPH_IX_ADJUSTMENT)
-#define LGLYPH_SET_FROM(g, val) ASET ((g), LGLYPH_IX_FROM, make_number (val))
-#define LGLYPH_SET_TO(g, val) ASET ((g), LGLYPH_IX_TO, make_number (val))
-#define LGLYPH_SET_CHAR(g, val) ASET ((g), LGLYPH_IX_CHAR, make_number (val))
+#define LGLYPH_SET_FROM(g, val) ASET ((g), LGLYPH_IX_FROM, make_fixnum (val))
+#define LGLYPH_SET_TO(g, val) ASET ((g), LGLYPH_IX_TO, make_fixnum (val))
+#define LGLYPH_SET_CHAR(g, val) ASET ((g), LGLYPH_IX_CHAR, make_fixnum (val))
 /* Callers must assure that VAL is not negative!  */
 #define LGLYPH_SET_CODE(g, val)                                                
\
   ASET (g, LGLYPH_IX_CODE,                                             \
        val == FONT_INVALID_CODE ? Qnil : INTEGER_TO_CONS (val))
 
-#define LGLYPH_SET_WIDTH(g, val) ASET ((g), LGLYPH_IX_WIDTH, make_number (val))
-#define LGLYPH_SET_LBEARING(g, val) ASET ((g), LGLYPH_IX_LBEARING, make_number 
(val))
-#define LGLYPH_SET_RBEARING(g, val) ASET ((g), LGLYPH_IX_RBEARING, make_number 
(val))
-#define LGLYPH_SET_ASCENT(g, val) ASET ((g), LGLYPH_IX_ASCENT, make_number 
(val))
-#define LGLYPH_SET_DESCENT(g, val) ASET ((g), LGLYPH_IX_DESCENT, make_number 
(val))
+#define LGLYPH_SET_WIDTH(g, val) ASET ((g), LGLYPH_IX_WIDTH, make_fixnum (val))
+#define LGLYPH_SET_LBEARING(g, val) ASET ((g), LGLYPH_IX_LBEARING, make_fixnum 
(val))
+#define LGLYPH_SET_RBEARING(g, val) ASET ((g), LGLYPH_IX_RBEARING, make_fixnum 
(val))
+#define LGLYPH_SET_ASCENT(g, val) ASET ((g), LGLYPH_IX_ASCENT, make_fixnum 
(val))
+#define LGLYPH_SET_DESCENT(g, val) ASET ((g), LGLYPH_IX_DESCENT, make_fixnum 
(val))
 #define LGLYPH_SET_ADJUSTMENT(g, val) ASET ((g), LGLYPH_IX_ADJUSTMENT, (val))
 
 #define LGLYPH_XOFF(g) (VECTORP (LGLYPH_ADJUSTMENT (g)) \
-                       ? XINT (AREF (LGLYPH_ADJUSTMENT (g), 0)) : 0)
+                       ? XFIXNUM (AREF (LGLYPH_ADJUSTMENT (g), 0)) : 0)
 #define LGLYPH_YOFF(g) (VECTORP (LGLYPH_ADJUSTMENT (g)) \
-                       ? XINT (AREF (LGLYPH_ADJUSTMENT (g), 1)) : 0)
+                       ? XFIXNUM (AREF (LGLYPH_ADJUSTMENT (g), 1)) : 0)
 #define LGLYPH_WADJUST(g) (VECTORP (LGLYPH_ADJUSTMENT (g)) \
-                          ? XINT (AREF (LGLYPH_ADJUSTMENT (g), 2)) : 0)
+                          ? XFIXNUM (AREF (LGLYPH_ADJUSTMENT (g), 2)) : 0)
 
 extern Lisp_Object composition_gstring_put_cache (Lisp_Object, ptrdiff_t);
 extern Lisp_Object composition_gstring_from_id (ptrdiff_t);
diff --git a/src/conf_post.h b/src/conf_post.h
index 9758298..f9838bc 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -20,9 +20,16 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 
 /* Put the code here rather than in configure.ac using AH_BOTTOM.
    This way, the code does not get processed by autoheader.  For
-   example, undefs here are not commented out.
+   example, undefs here are not commented out.  */
 
-   To help make dependencies clearer elsewhere, this file typically
+/* Disable 'assert' unless enabling checking.  Do this early, in
+   case some misguided implementation depends on NDEBUG in some
+   include file other than assert.h.  */
+#if !defined ENABLE_CHECKING && !defined NDEBUG
+# define NDEBUG
+#endif
+
+/* To help make dependencies clearer elsewhere, this file typically
    does not #include other files.  The exceptions are first stdbool.h
    because it is unlikely to interfere with configuration and bool is
    such a core part of the C language, and second ms-w32.h (DOS_NT
@@ -202,6 +209,13 @@ extern void _DebPrint (const char *fmt, ...);
 #endif
 #endif
 
+#ifdef emacs /* Don't do this for lib-src.  */
+/* Tell regex.c to use a type compatible with Emacs.  */
+#define RE_TRANSLATE_TYPE Lisp_Object
+#define RE_TRANSLATE(TBL, C) char_table_translate (TBL, C)
+#define RE_TRANSLATE_P(TBL) (!EQ (TBL, make_fixnum (0)))
+#endif
+
 /* Tell time_rz.c to use Emacs's getter and setter for TZ.
    Only Emacs uses time_rz so this is OK.  */
 #define getenv_TZ emacs_getenv_TZ
diff --git a/src/data.c b/src/data.c
index aaccb67..5a355d9 100644
--- a/src/data.c
+++ b/src/data.c
@@ -74,7 +74,7 @@ XKBOARD_OBJFWD (union Lisp_Fwd *a)
   return &a->u_kboard_objfwd;
 }
 static struct Lisp_Intfwd *
-XINTFWD (union Lisp_Fwd *a)
+XFIXNUMFWD (union Lisp_Fwd *a)
 {
   eassert (INTFWDP (a));
   return &a->u_intfwd;
@@ -132,13 +132,13 @@ set_blv_valcell (struct Lisp_Buffer_Local_Value *blv, 
Lisp_Object val)
 static _Noreturn void
 wrong_length_argument (Lisp_Object a1, Lisp_Object a2, Lisp_Object a3)
 {
-  Lisp_Object size1 = make_number (bool_vector_size (a1));
-  Lisp_Object size2 = make_number (bool_vector_size (a2));
+  Lisp_Object size1 = make_fixnum (bool_vector_size (a1));
+  Lisp_Object size2 = make_fixnum (bool_vector_size (a2));
   if (NILP (a3))
     xsignal2 (Qwrong_length_argument, size1, size2);
   else
     xsignal3 (Qwrong_length_argument, size1, size2,
-             make_number (bool_vector_size (a3)));
+             make_fixnum (bool_vector_size (a3)));
 }
 
 _Noreturn void
@@ -221,27 +221,17 @@ for example, (type-of 1) returns `integer'.  */)
     case Lisp_Cons:
       return Qcons;
 
-    case Lisp_Misc:
-      switch (XMISCTYPE (object))
-       {
-       case Lisp_Misc_Marker:
-         return Qmarker;
-       case Lisp_Misc_Overlay:
-         return Qoverlay;
-        case Lisp_Misc_Finalizer:
-          return Qfinalizer;
-#ifdef HAVE_MODULES
-       case Lisp_Misc_User_Ptr:
-         return Quser_ptr;
-#endif
-       default:
-         emacs_abort ();
-       }
-
     case Lisp_Vectorlike:
       switch (PSEUDOVECTOR_TYPE (XVECTOR (object)))
         {
         case PVEC_NORMAL_VECTOR: return Qvector;
+       case PVEC_BIGNUM: return Qinteger;
+       case PVEC_MARKER: return Qmarker;
+       case PVEC_OVERLAY: return Qoverlay;
+       case PVEC_FINALIZER: return Qfinalizer;
+#ifdef HAVE_MODULES
+       case PVEC_USER_PTR: return Quser_ptr;
+#endif
         case PVEC_WINDOW_CONFIGURATION: return Qwindow_configuration;
         case PVEC_PROCESS: return Qprocess;
         case PVEC_WINDOW: return Qwindow;
@@ -277,6 +267,7 @@ for example, (type-of 1) returns `integer'.  */)
         case PVEC_MODULE_FUNCTION:
           return Qmodule_function;
         /* "Impossible" cases.  */
+       case PVEC_MISC_PTR:
         case PVEC_XWIDGET:
         case PVEC_OTHER:
         case PVEC_XWIDGET_VIEW:
@@ -520,6 +511,16 @@ DEFUN ("integerp", Fintegerp, Sintegerp, 1, 1, 0,
   return Qnil;
 }
 
+DEFUN ("fixnump", Ffixnump, Sfixnump, 1, 1, 0,
+       doc: /* Return t if OBJECT is an fixnum.  */
+       attributes: const)
+  (Lisp_Object object)
+{
+  if (FIXNUMP (object))
+    return Qt;
+  return Qnil;
+}
+
 DEFUN ("integer-or-marker-p", Finteger_or_marker_p, Sinteger_or_marker_p, 1, 
1, 0,
        doc: /* Return t if OBJECT is an integer or a marker (editor pointer).  
*/)
   (register Lisp_Object object)
@@ -597,6 +598,15 @@ DEFUN ("condition-variable-p", Fcondition_variable_p, 
Scondition_variable_p,
     return Qt;
   return Qnil;
 }
+
+DEFUN ("bignump", Fbignump, Sbignump, 1, 1, 0,
+       doc: /* Return t if OBJECT is a bignum.  */)
+  (Lisp_Object object)
+{
+  if (BIGNUMP (object))
+    return Qt;
+  return Qnil;
+}
 
 /* Extract and set components of lists.  */
 
@@ -858,10 +868,10 @@ function with `&rest' args, or `unevalled' for a special 
form.  */)
   CHECK_SUBR (subr);
   minargs = XSUBR (subr)->min_args;
   maxargs = XSUBR (subr)->max_args;
-  return Fcons (make_number (minargs),
+  return Fcons (make_fixnum (minargs),
                maxargs == MANY ?        Qmany
                : maxargs == UNEVALLED ? Qunevalled
-               :                        make_number (maxargs));
+               :                        make_fixnum (maxargs));
 }
 
 DEFUN ("subr-name", Fsubr_name, Ssubr_name, 1, 1, 0,
@@ -992,7 +1002,7 @@ do_symval_forwarding (register union Lisp_Fwd *valcontents)
   switch (XFWDTYPE (valcontents))
     {
     case Lisp_Fwd_Int:
-      XSETINT (val, *XINTFWD (valcontents)->intvar);
+      XSETINT (val, *XFIXNUMFWD (valcontents)->intvar);
       return val;
 
     case Lisp_Fwd_Bool:
@@ -1029,7 +1039,7 @@ do_symval_forwarding (register union Lisp_Fwd 
*valcontents)
 void
 wrong_choice (Lisp_Object choice, Lisp_Object wrong)
 {
-  ptrdiff_t i = 0, len = XINT (Flength (choice));
+  ptrdiff_t i = 0, len = XFIXNUM (Flength (choice));
   Lisp_Object obj, *args;
   AUTO_STRING (one_of, "One of ");
   AUTO_STRING (comma, ", ");
@@ -1084,8 +1094,8 @@ store_symval_forwarding (union Lisp_Fwd *valcontents, 
register Lisp_Object newva
   switch (XFWDTYPE (valcontents))
     {
     case Lisp_Fwd_Int:
-      CHECK_NUMBER (newval);
-      *XINTFWD (valcontents)->intvar = XINT (newval);
+      CHECK_FIXNUM (newval);
+      *XFIXNUMFWD (valcontents)->intvar = XFIXNUM (newval);
       break;
 
     case Lisp_Fwd_Bool:
@@ -1140,7 +1150,7 @@ store_symval_forwarding (union Lisp_Fwd *valcontents, 
register Lisp_Object newva
                else if ((prop = Fget (predicate, Qrange), !NILP (prop)))
                  {
                    Lisp_Object min = XCAR (prop), max = XCDR (prop);
-                   if (! NUMBERP (newval)
+                   if (! FIXED_OR_FLOATP (newval)
                        || NILP (CALLN (Fleq, min, newval, max)))
                      wrong_range (min, max, newval);
                  }
@@ -2232,8 +2242,8 @@ or a byte-code object.  IDX starts at 0.  */)
 {
   register EMACS_INT idxval;
 
-  CHECK_NUMBER (idx);
-  idxval = XINT (idx);
+  CHECK_FIXNUM (idx);
+  idxval = XFIXNUM (idx);
   if (STRINGP (array))
     {
       int c;
@@ -2242,11 +2252,11 @@ or a byte-code object.  IDX starts at 0.  */)
       if (idxval < 0 || idxval >= SCHARS (array))
        args_out_of_range (array, idx);
       if (! STRING_MULTIBYTE (array))
-       return make_number ((unsigned char) SREF (array, idxval));
+       return make_fixnum ((unsigned char) SREF (array, idxval));
       idxval_byte = string_char_to_byte (array, idxval);
 
       c = STRING_CHAR (SDATA (array) + idxval_byte);
-      return make_number (c);
+      return make_fixnum (c);
     }
   else if (BOOL_VECTOR_P (array))
     {
@@ -2283,8 +2293,8 @@ bool-vector.  IDX starts at 0.  */)
 {
   register EMACS_INT idxval;
 
-  CHECK_NUMBER (idx);
-  idxval = XINT (idx);
+  CHECK_FIXNUM (idx);
+  idxval = XFIXNUM (idx);
   if (! RECORDP (array))
     CHECK_ARRAY (array, Qarrayp);
 
@@ -2320,7 +2330,7 @@ bool-vector.  IDX starts at 0.  */)
       if (idxval < 0 || idxval >= SCHARS (array))
        args_out_of_range (array, idx);
       CHECK_CHARACTER (newelt);
-      c = XFASTINT (newelt);
+      c = XFIXNAT (newelt);
 
       if (STRING_MULTIBYTE (array))
        {
@@ -2376,23 +2386,129 @@ bool-vector.  IDX starts at 0.  */)
 
 /* Arithmetic functions */
 
+#ifndef isnan
+# define isnan(x) ((x) != (x))
+#endif
+
+static Lisp_Object
+bignumcompare (Lisp_Object num1, Lisp_Object num2,
+              enum Arith_Comparison comparison)
+{
+  int cmp;
+  bool test;
+
+  if (BIGNUMP (num1))
+    {
+      if (FLOATP (num2))
+       {
+         /* Note that GMP doesn't define comparisons against NaN, so
+            we need to handle them specially.  */
+         if (isnan (XFLOAT_DATA (num2)))
+           return Qnil;
+         cmp = mpz_cmp_d (XBIGNUM (num1)->value, XFLOAT_DATA (num2));
+       }
+      else if (FIXNUMP (num2))
+        {
+          if (sizeof (EMACS_INT) > sizeof (long) && XFIXNUM (num2) > LONG_MAX)
+            {
+              mpz_t tem;
+              mpz_init (tem);
+              mpz_set_intmax (tem, XFIXNUM (num2));
+              cmp = mpz_cmp (XBIGNUM (num1)->value, tem);
+              mpz_clear (tem);
+            }
+          else
+            cmp = mpz_cmp_si (XBIGNUM (num1)->value, XFIXNUM (num2));
+        }
+      else
+       {
+         eassume (BIGNUMP (num2));
+         cmp = mpz_cmp (XBIGNUM (num1)->value, XBIGNUM (num2)->value);
+       }
+    }
+  else
+    {
+      eassume (BIGNUMP (num2));
+      if (FLOATP (num1))
+       {
+         /* Note that GMP doesn't define comparisons against NaN, so
+            we need to handle them specially.  */
+         if (isnan (XFLOAT_DATA (num1)))
+           return Qnil;
+         cmp = - mpz_cmp_d (XBIGNUM (num2)->value, XFLOAT_DATA (num1));
+       }
+      else
+        {
+         eassume (FIXNUMP (num1));
+          if (sizeof (EMACS_INT) > sizeof (long) && XFIXNUM (num1) > LONG_MAX)
+            {
+              mpz_t tem;
+              mpz_init (tem);
+              mpz_set_intmax (tem, XFIXNUM (num1));
+              cmp = - mpz_cmp (XBIGNUM (num2)->value, tem);
+              mpz_clear (tem);
+            }
+          else
+            cmp = - mpz_cmp_si (XBIGNUM (num2)->value, XFIXNUM (num1));
+        }
+    }
+
+  switch (comparison)
+    {
+    case ARITH_EQUAL:
+      test = cmp == 0;
+      break;
+
+    case ARITH_NOTEQUAL:
+      test = cmp != 0;
+      break;
+
+    case ARITH_LESS:
+      test = cmp < 0;
+      break;
+
+    case ARITH_LESS_OR_EQUAL:
+      test = cmp <= 0;
+      break;
+
+    case ARITH_GRTR:
+      test = cmp > 0;
+      break;
+
+    case ARITH_GRTR_OR_EQUAL:
+      test = cmp >= 0;
+      break;
+
+    default:
+      eassume (false);
+    }
+
+  return test ? Qt : Qnil;
+}
+
 Lisp_Object
 arithcompare (Lisp_Object num1, Lisp_Object num2,
              enum Arith_Comparison comparison)
 {
   double f1, f2;
   EMACS_INT i1, i2;
-  bool fneq;
+  bool lt, eq, gt;
   bool test;
 
-  CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (num1);
-  CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (num2);
+  CHECK_NUMBER_COERCE_MARKER (num1);
+  CHECK_NUMBER_COERCE_MARKER (num2);
+
+  if (BIGNUMP (num1) || BIGNUMP (num2))
+    return bignumcompare (num1, num2, comparison);
 
   /* If either arg is floating point, set F1 and F2 to the 'double'
-     approximations of the two arguments, and set FNEQ if floating-point
-     comparison reports that F1 is not equal to F2, possibly because F1
-     or F2 is a NaN.  Regardless, set I1 and I2 to integers that break
-     ties if the floating-point comparison is either not done or reports
+     approximations of the two arguments, and set LT, EQ, and GT to
+     the <, ==, > floating-point comparisons of F1 and F2
+     respectively, taking care to avoid problems if either is a NaN,
+     and trying to avoid problems on platforms where variables (in
+     violation of the C standard) can contain excess precision.
+     Regardless, set I1 and I2 to integers that break ties if the
+     floating-point comparison is either not done or reports
      equality.  */
 
   if (FLOATP (num1))
@@ -2413,52 +2529,64 @@ arithcompare (Lisp_Object num1, Lisp_Object num2,
             floating-point comparison reports a tie, NUM1 = F1 = F2 = I1
             (exactly) so I1 - I2 = NUM1 - NUM2 (exactly), so comparing I1
             to I2 will break the tie correctly.  */
-         i1 = f2 = i2 = XINT (num2);
+         i1 = f2 = i2 = XFIXNUM (num2);
        }
-      fneq = f1 != f2;
+      lt = f1 < f2;
+      eq = f1 == f2;
+      gt = f1 > f2;
     }
   else
     {
-      i1 = XINT (num1);
+      i1 = XFIXNUM (num1);
       if (FLOATP (num2))
        {
          /* Compare an integer NUM1 to a float NUM2.  This is the
             converse of comparing float to integer (see above).  */
          i2 = f1 = i1;
          f2 = XFLOAT_DATA (num2);
-         fneq = f1 != f2;
+         lt = f1 < f2;
+         eq = f1 == f2;
+         gt = f1 > f2;
        }
       else
        {
-         i2 = XINT (num2);
-         fneq = false;
+         i2 = XFIXNUM (num2);
+         eq = true;
        }
     }
 
+  if (eq)
+    {
+      /* Break a floating-point tie by comparing the integers.  */
+      lt = i1 < i2;
+      eq = i1 == i2;
+      gt = i1 > i2;
+    }
+
   switch (comparison)
     {
     case ARITH_EQUAL:
-      test = !fneq && i1 == i2;
+      test = eq;
       break;
 
     case ARITH_NOTEQUAL:
-      test = fneq || i1 != i2;
+      test = !eq;
       break;
 
     case ARITH_LESS:
-      test = fneq ? f1 < f2 : i1 < i2;
+      test = lt;
       break;
 
     case ARITH_LESS_OR_EQUAL:
-      test = fneq ? f1 <= f2 : i1 <= i2;
+      test = lt | eq;
       break;
 
     case ARITH_GRTR:
-      test = fneq ? f1 > f2 : i1 > i2;
+      test = gt;
       break;
 
     case ARITH_GRTR_OR_EQUAL:
-      test = fneq ? f1 >= f2 : i1 >= i2;
+      test = gt | eq;
       break;
 
     default:
@@ -2532,12 +2660,12 @@ DEFUN ("/=", Fneq, Sneq, 2, 2, 0,
   (eassert (FIXNUM_OVERFLOW_P (i)),                                \
    (! (FIXNUM_OVERFLOW_P ((extremum) >> 16)                        \
        && FIXNUM_OVERFLOW_P ((i) >> 16))                           \
-    ? Fcons (make_number ((i) >> 16), make_number ((i) & 0xffff))   \
+    ? Fcons (make_fixnum ((i) >> 16), make_fixnum ((i) & 0xffff))   \
     : ! (FIXNUM_OVERFLOW_P ((extremum) >> 16 >> 24)                \
         && FIXNUM_OVERFLOW_P ((i) >> 16 >> 24))                    \
-    ? Fcons (make_number ((i) >> 16 >> 24),                        \
-            Fcons (make_number ((i) >> 16 & 0xffffff),             \
-                   make_number ((i) & 0xffff)))                    \
+    ? Fcons (make_fixnum ((i) >> 16 >> 24),                        \
+            Fcons (make_fixnum ((i) >> 16 & 0xffffff),             \
+                   make_fixnum ((i) & 0xffff)))                    \
     : make_float (i)))
 
 Lisp_Object
@@ -2561,10 +2689,10 @@ cons_to_unsigned (Lisp_Object c, uintmax_t max)
 {
   bool valid = false;
   uintmax_t val UNINIT;
-  if (INTEGERP (c))
+  if (FIXNUMP (c))
     {
-      valid = XINT (c) >= 0;
-      val = XINT (c);
+      valid = XFIXNUM (c) >= 0;
+      val = XFIXNUM (c);
     }
   else if (FLOATP (c))
     {
@@ -2575,26 +2703,26 @@ cons_to_unsigned (Lisp_Object c, uintmax_t max)
          valid = val == d;
        }
     }
-  else if (CONSP (c) && NATNUMP (XCAR (c)))
+  else if (CONSP (c) && FIXNATP (XCAR (c)))
     {
-      uintmax_t top = XFASTINT (XCAR (c));
+      uintmax_t top = XFIXNAT (XCAR (c));
       Lisp_Object rest = XCDR (c);
       if (top <= UINTMAX_MAX >> 24 >> 16
          && CONSP (rest)
-         && NATNUMP (XCAR (rest)) && XFASTINT (XCAR (rest)) < 1 << 24
-         && NATNUMP (XCDR (rest)) && XFASTINT (XCDR (rest)) < 1 << 16)
+         && FIXNATP (XCAR (rest)) && XFIXNAT (XCAR (rest)) < 1 << 24
+         && FIXNATP (XCDR (rest)) && XFIXNAT (XCDR (rest)) < 1 << 16)
        {
-         uintmax_t mid = XFASTINT (XCAR (rest));
-         val = top << 24 << 16 | mid << 16 | XFASTINT (XCDR (rest));
+         uintmax_t mid = XFIXNAT (XCAR (rest));
+         val = top << 24 << 16 | mid << 16 | XFIXNAT (XCDR (rest));
          valid = true;
        }
       else if (top <= UINTMAX_MAX >> 16)
        {
          if (CONSP (rest))
            rest = XCAR (rest);
-         if (NATNUMP (rest) && XFASTINT (rest) < 1 << 16)
+         if (FIXNATP (rest) && XFIXNAT (rest) < 1 << 16)
            {
-             val = top << 16 | XFASTINT (rest);
+             val = top << 16 | XFIXNAT (rest);
              valid = true;
            }
        }
@@ -2615,9 +2743,9 @@ cons_to_signed (Lisp_Object c, intmax_t min, intmax_t max)
 {
   bool valid = false;
   intmax_t val UNINIT;
-  if (INTEGERP (c))
+  if (FIXNUMP (c))
     {
-      val = XINT (c);
+      val = XFIXNUM (c);
       valid = true;
     }
   else if (FLOATP (c))
@@ -2629,26 +2757,26 @@ cons_to_signed (Lisp_Object c, intmax_t min, intmax_t 
max)
          valid = val == d;
        }
     }
-  else if (CONSP (c) && INTEGERP (XCAR (c)))
+  else if (CONSP (c) && FIXNUMP (XCAR (c)))
     {
-      intmax_t top = XINT (XCAR (c));
+      intmax_t top = XFIXNUM (XCAR (c));
       Lisp_Object rest = XCDR (c);
       if (top >= INTMAX_MIN >> 24 >> 16 && top <= INTMAX_MAX >> 24 >> 16
          && CONSP (rest)
-         && NATNUMP (XCAR (rest)) && XFASTINT (XCAR (rest)) < 1 << 24
-         && NATNUMP (XCDR (rest)) && XFASTINT (XCDR (rest)) < 1 << 16)
+         && FIXNATP (XCAR (rest)) && XFIXNAT (XCAR (rest)) < 1 << 24
+         && FIXNATP (XCDR (rest)) && XFIXNAT (XCDR (rest)) < 1 << 16)
        {
-         intmax_t mid = XFASTINT (XCAR (rest));
-         val = top << 24 << 16 | mid << 16 | XFASTINT (XCDR (rest));
+         intmax_t mid = XFIXNAT (XCAR (rest));
+         val = top << 24 << 16 | mid << 16 | XFIXNAT (XCDR (rest));
          valid = true;
        }
       else if (top >= INTMAX_MIN >> 16 && top <= INTMAX_MAX >> 16)
        {
          if (CONSP (rest))
            rest = XCAR (rest);
-         if (NATNUMP (rest) && XFASTINT (rest) < 1 << 16)
+         if (FIXNATP (rest) && XFIXNAT (rest) < 1 << 16)
            {
-             val = top << 16 | XFASTINT (rest);
+             val = top << 16 | XFIXNAT (rest);
              valid = true;
            }
        }
@@ -2668,12 +2796,20 @@ NUMBER may be an integer or a floating point number.  
*/)
   char buffer[max (FLOAT_TO_STRING_BUFSIZE, INT_BUFSIZE_BOUND (EMACS_INT))];
   int len;
 
-  CHECK_NUMBER_OR_FLOAT (number);
+  if (BIGNUMP (number))
+    {
+      ptrdiff_t count = SPECPDL_INDEX ();
+      char *str = mpz_get_str (NULL, 10, XBIGNUM (number)->value);
+      record_unwind_protect_ptr (xfree, str);
+      return unbind_to (count, make_unibyte_string (str, strlen (str)));
+    }
+
+  CHECK_FIXNUM_OR_FLOAT (number);
 
   if (FLOATP (number))
     len = float_to_string (buffer, XFLOAT_DATA (number));
   else
-    len = sprintf (buffer, "%"pI"d", XINT (number));
+    len = sprintf (buffer, "%"pI"d", XFIXNUM (number));
 
   return make_unibyte_string (buffer, len);
 }
@@ -2696,19 +2832,18 @@ If the base used is not 10, STRING is always parsed as 
an integer.  */)
     b = 10;
   else
     {
-      CHECK_NUMBER (base);
-      if (! (XINT (base) >= 2 && XINT (base) <= 16))
+      CHECK_FIXNUM (base);
+      if (! (XFIXNUM (base) >= 2 && XFIXNUM (base) <= 16))
        xsignal1 (Qargs_out_of_range, base);
-      b = XINT (base);
+      b = XFIXNUM (base);
     }
 
   char *p = SSDATA (string);
   while (*p == ' ' || *p == '\t')
     p++;
 
-  int flags = S2N_IGNORE_TRAILING | S2N_OVERFLOW_TO_FLOAT;
-  Lisp_Object val = string_to_number (p, b, flags);
-  return NILP (val) ? make_number (0) : val;
+  Lisp_Object val = string_to_number (p, b, S2N_IGNORE_TRAILING);
+  return NILP (val) ? make_fixnum (0) : val;
 }
 
 enum arithop
@@ -2722,16 +2857,25 @@ enum arithop
     Alogxor
   };
 
+static void
+free_mpz_value (void *value_ptr)
+{
+  mpz_clear (*(mpz_t *) value_ptr);
+}
+
 static Lisp_Object float_arith_driver (double, ptrdiff_t, enum arithop,
                                        ptrdiff_t, Lisp_Object *);
+
 static Lisp_Object
 arith_driver (enum arithop code, ptrdiff_t nargs, Lisp_Object *args)
 {
-  Lisp_Object val;
-  ptrdiff_t argnum, ok_args;
-  EMACS_INT accum = 0;
-  EMACS_INT next, ok_accum;
-  bool overflow = 0;
+  Lisp_Object val = Qnil;
+  ptrdiff_t argnum;
+  ptrdiff_t count = SPECPDL_INDEX ();
+  mpz_t accum;
+
+  mpz_init (accum);
+  record_unwind_protect_ptr (free_mpz_value, &accum);
 
   switch (code)
     {
@@ -2739,14 +2883,14 @@ arith_driver (enum arithop code, ptrdiff_t nargs, 
Lisp_Object *args)
     case Alogxor:
     case Aadd:
     case Asub:
-      accum = 0;
+      /* ACCUM is already 0.  */
       break;
     case Amult:
     case Adiv:
-      accum = 1;
+      mpz_set_si (accum, 1);
       break;
     case Alogand:
-      accum = -1;
+      mpz_set_si (accum, -1);
       break;
     default:
       break;
@@ -2754,62 +2898,147 @@ arith_driver (enum arithop code, ptrdiff_t nargs, 
Lisp_Object *args)
 
   for (argnum = 0; argnum < nargs; argnum++)
     {
-      if (! overflow)
-       {
-         ok_args = argnum;
-         ok_accum = accum;
-       }
-
-      /* Using args[argnum] as argument to CHECK_NUMBER_... */
+      /* Using args[argnum] as argument to CHECK_NUMBER... */
       val = args[argnum];
-      CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (val);
+      CHECK_NUMBER_COERCE_MARKER (val);
 
       if (FLOATP (val))
-       return float_arith_driver (ok_accum, ok_args, code,
-                                  nargs, args);
-      args[argnum] = val;
-      next = XINT (args[argnum]);
+       return unbind_to (count,
+                         float_arith_driver (mpz_get_d (accum), argnum, code,
+                                             nargs, args));
       switch (code)
        {
        case Aadd:
-         overflow |= INT_ADD_WRAPV (accum, next, &accum);
+         if (BIGNUMP (val))
+           mpz_add (accum, accum, XBIGNUM (val)->value);
+         else if (sizeof (EMACS_INT) > sizeof (long))
+            {
+             mpz_t tem;
+             mpz_init (tem);
+             mpz_set_intmax (tem, XFIXNUM (val));
+             mpz_add (accum, accum, tem);
+             mpz_clear (tem);
+            }
+          else if (XFIXNUM (val) < 0)
+           mpz_sub_ui (accum, accum, - XFIXNUM (val));
+         else
+           mpz_add_ui (accum, accum, XFIXNUM (val));
          break;
        case Asub:
          if (! argnum)
-           accum = nargs == 1 ? - next : next;
+           {
+             if (BIGNUMP (val))
+               mpz_set (accum, XBIGNUM (val)->value);
+             else
+               mpz_set_intmax (accum, XFIXNUM (val));
+             if (nargs == 1)
+               mpz_neg (accum, accum);
+           }
+         else if (BIGNUMP (val))
+           mpz_sub (accum, accum, XBIGNUM (val)->value);
+         else if (sizeof (EMACS_INT) > sizeof (long))
+            {
+             mpz_t tem;
+             mpz_init (tem);
+             mpz_set_intmax (tem, XFIXNUM (val));
+             mpz_sub (accum, accum, tem);
+             mpz_clear (tem);
+            }
+         else if (XFIXNUM (val) < 0)
+           mpz_add_ui (accum, accum, - XFIXNUM (val));
          else
-           overflow |= INT_SUBTRACT_WRAPV (accum, next, &accum);
+           mpz_sub_ui (accum, accum, XFIXNUM (val));
          break;
        case Amult:
-         overflow |= INT_MULTIPLY_WRAPV (accum, next, &accum);
+         if (BIGNUMP (val))
+           mpz_mul (accum, accum, XBIGNUM (val)->value);
+         else if (sizeof (EMACS_INT) > sizeof (long))
+            {
+             mpz_t tem;
+             mpz_init (tem);
+             mpz_set_intmax (tem, XFIXNUM (val));
+             mpz_mul (accum, accum, tem);
+             mpz_clear (tem);
+            }
+         else
+           mpz_mul_si (accum, accum, XFIXNUM (val));
          break;
        case Adiv:
          if (! (argnum || nargs == 1))
-           accum = next;
+           {
+             if (BIGNUMP (val))
+               mpz_set (accum, XBIGNUM (val)->value);
+             else
+               mpz_set_intmax (accum, XFIXNUM (val));
+           }
          else
            {
-             if (next == 0)
+             /* Note that a bignum can never be 0, so we don't need
+                to check that case.  */
+             if (FIXNUMP (val) && XFIXNUM (val) == 0)
                xsignal0 (Qarith_error);
-             if (INT_DIVIDE_OVERFLOW (accum, next))
-               overflow = true;
+             if (BIGNUMP (val))
+               mpz_tdiv_q (accum, accum, XBIGNUM (val)->value);
+              else if (sizeof (EMACS_INT) > sizeof (long))
+                {
+                  mpz_t tem;
+                  mpz_init (tem);
+                  mpz_set_intmax (tem, XFIXNUM (val));
+                  mpz_tdiv_q (accum, accum, tem);
+                  mpz_clear (tem);
+                }
              else
-               accum /= next;
+               {
+                 EMACS_INT value = XFIXNUM (val);
+                 bool negate = value < 0;
+                 if (negate)
+                   value = -value;
+                 mpz_tdiv_q_ui (accum, accum, value);
+                 if (negate)
+                   mpz_neg (accum, accum);
+               }
            }
          break;
        case Alogand:
-         accum &= next;
+         if (BIGNUMP (val))
+           mpz_and (accum, accum, XBIGNUM (val)->value);
+         else
+           {
+             mpz_t tem;
+             mpz_init (tem);
+             mpz_set_intmax (tem, XFIXNUM (val));
+             mpz_and (accum, accum, tem);
+             mpz_clear (tem);
+           }
          break;
        case Alogior:
-         accum |= next;
+         if (BIGNUMP (val))
+           mpz_ior (accum, accum, XBIGNUM (val)->value);
+         else
+           {
+             mpz_t tem;
+             mpz_init (tem);
+             mpz_set_intmax (tem, XFIXNUM (val));
+             mpz_ior (accum, accum, tem);
+             mpz_clear (tem);
+           }
          break;
        case Alogxor:
-         accum ^= next;
+         if (BIGNUMP (val))
+           mpz_xor (accum, accum, XBIGNUM (val)->value);
+         else
+           {
+             mpz_t tem;
+             mpz_init (tem);
+             mpz_set_intmax (tem, XFIXNUM (val));
+             mpz_xor (accum, accum, tem);
+             mpz_clear (tem);
+           }
          break;
        }
     }
 
-  XSETINT (val, accum);
-  return val;
+  return unbind_to (count, make_number (accum));
 }
 
 static Lisp_Object
@@ -2821,17 +3050,20 @@ float_arith_driver (double accum, ptrdiff_t argnum, 
enum arithop code,
 
   for (; argnum < nargs; argnum++)
     {
-      val = args[argnum];    /* using args[argnum] as argument to 
CHECK_NUMBER_... */
-      CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (val);
+      /* using args[argnum] as argument to CHECK_NUMBER_... */
+      val = args[argnum];
+      CHECK_NUMBER_COERCE_MARKER (val);
 
       if (FLOATP (val))
        {
          next = XFLOAT_DATA (val);
        }
+      else if (BIGNUMP (val))
+       next = mpz_get_d (XBIGNUM (val)->value);
       else
        {
          args[argnum] = val;    /* runs into a compiler bug. */
-         next = XINT (args[argnum]);
+         next = XFIXNUM (args[argnum]);
        }
       switch (code)
        {
@@ -2913,13 +3145,49 @@ Both must be integers or markers.  */)
 {
   Lisp_Object val;
 
-  CHECK_NUMBER_COERCE_MARKER (x);
-  CHECK_NUMBER_COERCE_MARKER (y);
+  CHECK_INTEGER_COERCE_MARKER (x);
+  CHECK_INTEGER_COERCE_MARKER (y);
 
-  if (XINT (y) == 0)
+  /* Note that a bignum can never be 0, so we don't need to check that
+     case.  */
+  if (FIXNUMP (y) && XFIXNUM (y) == 0)
     xsignal0 (Qarith_error);
 
-  XSETINT (val, XINT (x) % XINT (y));
+  if (FIXNUMP (x) && FIXNUMP (y))
+    XSETINT (val, XFIXNUM (x) % XFIXNUM (y));
+  else
+    {
+      mpz_t xm, ym, *xmp, *ymp;
+      mpz_t result;
+
+      if (BIGNUMP (x))
+       xmp = &XBIGNUM (x)->value;
+      else
+       {
+         mpz_init (xm);
+         mpz_set_intmax (xm, XFIXNUM (x));
+         xmp = &xm;
+       }
+
+      if (BIGNUMP (y))
+       ymp = &XBIGNUM (y)->value;
+      else
+       {
+         mpz_init (ym);
+         mpz_set_intmax (ym, XFIXNUM (y));
+         ymp = &ym;
+       }
+
+      mpz_init (result);
+      mpz_tdiv_r (result, *xmp, *ymp);
+      val = make_number (result);
+      mpz_clear (result);
+
+      if (xmp == &xm)
+       mpz_clear (xm);
+      if (ymp == &ym)
+       mpz_clear (ym);
+    }
   return val;
 }
 
@@ -2932,25 +3200,75 @@ Both X and Y must be numbers or markers.  */)
   Lisp_Object val;
   EMACS_INT i1, i2;
 
-  CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (x);
-  CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (y);
+  CHECK_NUMBER_COERCE_MARKER (x);
+  CHECK_NUMBER_COERCE_MARKER (y);
+
+  /* Note that a bignum can never be 0, so we don't need to check that
+     case.  */
+  if (FIXNUMP (y) && XFIXNUM (y) == 0)
+    xsignal0 (Qarith_error);
 
   if (FLOATP (x) || FLOATP (y))
     return fmod_float (x, y);
 
-  i1 = XINT (x);
-  i2 = XINT (y);
+  if (FIXNUMP (x) && FIXNUMP (y))
+    {
+      i1 = XFIXNUM (x);
+      i2 = XFIXNUM (y);
+
+      if (i2 == 0)
+       xsignal0 (Qarith_error);
 
-  if (i2 == 0)
-    xsignal0 (Qarith_error);
+      i1 %= i2;
+
+      /* If the "remainder" comes out with the wrong sign, fix it.  */
+      if (i2 < 0 ? i1 > 0 : i1 < 0)
+       i1 += i2;
+
+      XSETINT (val, i1);
+    }
+  else
+    {
+      mpz_t xm, ym, *xmp, *ymp;
+      mpz_t result;
+      int cmpr, cmpy;
+
+      if (BIGNUMP (x))
+       xmp = &XBIGNUM (x)->value;
+      else
+       {
+         mpz_init (xm);
+         mpz_set_intmax (xm, XFIXNUM (x));
+         xmp = &xm;
+       }
+
+      if (BIGNUMP (y))
+       ymp = &XBIGNUM (y)->value;
+      else
+       {
+         mpz_init (ym);
+         mpz_set_intmax (ym, XFIXNUM (y));
+         ymp = &ym;
+       }
+
+      mpz_init (result);
+      mpz_mod (result, *xmp, *ymp);
+
+      /* Fix the sign if needed.  */
+      cmpr = mpz_sgn (result);
+      cmpy = mpz_sgn (*ymp);
+      if (cmpy < 0 ? cmpr > 0 : cmpr < 0)
+       mpz_add (result, result, *ymp);
 
-  i1 %= i2;
+      val = make_number (result);
+      mpz_clear (result);
 
-  /* If the "remainder" comes out with the wrong sign, fix it.  */
-  if (i2 < 0 ? i1 > 0 : i1 < 0)
-    i1 += i2;
+      if (xmp == &xm)
+       mpz_clear (xm);
+      if (ymp == &ym)
+       mpz_clear (ym);
+    }
 
-  XSETINT (val, i1);
   return val;
 }
 
@@ -2959,11 +3277,11 @@ minmax_driver (ptrdiff_t nargs, Lisp_Object *args,
               enum Arith_Comparison comparison)
 {
   Lisp_Object accum = args[0];
-  CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (accum);
+  CHECK_NUMBER_COERCE_MARKER (accum);
   for (ptrdiff_t argnum = 1; argnum < nargs; argnum++)
     {
       Lisp_Object val = args[argnum];
-      CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (val);
+      CHECK_NUMBER_COERCE_MARKER (val);
       if (!NILP (arithcompare (val, accum, comparison)))
        accum = val;
       else if (FLOATP (val) && isnan (XFLOAT_DATA (val)))
@@ -3024,9 +3342,23 @@ of VALUE.  If VALUE is negative, return the number of 
zero bits in the
 representation.  */)
   (Lisp_Object value)
 {
-  CHECK_NUMBER (value);
-  EMACS_INT v = XINT (value) < 0 ? -1 - XINT (value) : XINT (value);
-  return make_number (EMACS_UINT_WIDTH <= UINT_WIDTH
+  CHECK_INTEGER (value);
+
+  if (BIGNUMP (value))
+    {
+      if (mpz_sgn (XBIGNUM (value)->value) >= 0)
+       return make_fixnum (mpz_popcount (XBIGNUM (value)->value));
+      mpz_t tem;
+      mpz_init (tem);
+      mpz_com (tem, XBIGNUM (value)->value);
+      Lisp_Object result = make_fixnum (mpz_popcount (tem));
+      mpz_clear (tem);
+      return result;
+    }
+
+  eassume (FIXNUMP (value));
+  EMACS_INT v = XFIXNUM (value) < 0 ? -1 - XFIXNUM (value) : XFIXNUM (value);
+  return make_fixnum (EMACS_UINT_WIDTH <= UINT_WIDTH
                      ? count_one_bits (v)
                      : EMACS_UINT_WIDTH <= ULONG_WIDTH
                      ? count_one_bits_l (v)
@@ -3041,18 +3373,47 @@ ash_lsh_impl (Lisp_Object value, Lisp_Object count, 
bool lsh)
 
   Lisp_Object val;
 
-  CHECK_NUMBER (value);
-  CHECK_NUMBER (count);
+  CHECK_INTEGER (value);
+  CHECK_FIXNUM (count);
 
-  if (XINT (count) >= EMACS_INT_WIDTH)
-    XSETINT (val, 0);
-  else if (XINT (count) > 0)
-    XSETINT (val, XUINT (value) << XINT (count));
-  else if (XINT (count) <= -EMACS_INT_WIDTH)
-    XSETINT (val, lsh ? 0 : XINT (value) < 0 ? -1 : 0);
+  if (BIGNUMP (value))
+    {
+      mpz_t result;
+      mpz_init (result);
+      if (XFIXNUM (count) >= 0)
+       mpz_mul_2exp (result, XBIGNUM (value)->value, XFIXNUM (count));
+      else if (lsh)
+       mpz_tdiv_q_2exp (result, XBIGNUM (value)->value, - XFIXNUM (count));
+      else
+       mpz_fdiv_q_2exp (result, XBIGNUM (value)->value, - XFIXNUM (count));
+      val = make_number (result);
+      mpz_clear (result);
+    }
   else
-    XSETINT (val, (lsh ? XUINT (value) >> -XINT (count)
-                  : XINT (value) >> -XINT (count)));
+    {
+      /* Just do the work as bignums to make the code simpler.  */
+      mpz_t result;
+      eassume (FIXNUMP (value));
+      mpz_init (result);
+
+      mpz_set_intmax (result, XFIXNUM (value));
+
+      if (XFIXNUM (count) >= 0)
+       mpz_mul_2exp (result, result, XFIXNUM (count));
+      else if (lsh)
+       {
+         if (mpz_sgn (result) > 0)
+           mpz_fdiv_q_2exp (result, result, - XFIXNUM (count));
+         else
+           mpz_fdiv_q_2exp (result, result, - XFIXNUM (count));
+       }
+      else /* ash */
+       mpz_fdiv_q_2exp (result, result, - XFIXNUM (count));
+
+      val = make_number (result);
+      mpz_clear (result);
+    }
+
   return val;
 }
 
@@ -3079,12 +3440,33 @@ DEFUN ("1+", Fadd1, Sadd1, 1, 1, 0,
 Markers are converted to integers.  */)
   (register Lisp_Object number)
 {
-  CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (number);
+  CHECK_NUMBER_COERCE_MARKER (number);
 
   if (FLOATP (number))
     return (make_float (1.0 + XFLOAT_DATA (number)));
 
-  XSETINT (number, XINT (number) + 1);
+  if (BIGNUMP (number))
+    {
+      mpz_t num;
+      mpz_init (num);
+      mpz_add_ui (num, XBIGNUM (number)->value, 1);
+      number = make_number (num);
+      mpz_clear (num);
+    }
+  else
+    {
+      eassume (FIXNUMP (number));
+      if (XFIXNUM (number) < MOST_POSITIVE_FIXNUM)
+       XSETINT (number, XFIXNUM (number) + 1);
+      else
+       {
+         mpz_t num;
+         mpz_init (num);
+         mpz_set_intmax (num, XFIXNUM (number) + 1);
+         number = make_number (num);
+         mpz_clear (num);
+       }
+    }
   return number;
 }
 
@@ -3093,12 +3475,33 @@ DEFUN ("1-", Fsub1, Ssub1, 1, 1, 0,
 Markers are converted to integers.  */)
   (register Lisp_Object number)
 {
-  CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (number);
+  CHECK_NUMBER_COERCE_MARKER (number);
 
   if (FLOATP (number))
     return (make_float (-1.0 + XFLOAT_DATA (number)));
 
-  XSETINT (number, XINT (number) - 1);
+  if (BIGNUMP (number))
+    {
+      mpz_t num;
+      mpz_init (num);
+      mpz_sub_ui (num, XBIGNUM (number)->value, 1);
+      number = make_number (num);
+      mpz_clear (num);
+    }
+  else
+    {
+      eassume (FIXNUMP (number));
+      if (XFIXNUM (number) > MOST_NEGATIVE_FIXNUM)
+       XSETINT (number, XFIXNUM (number) - 1);
+      else
+       {
+         mpz_t num;
+         mpz_init (num);
+         mpz_set_intmax (num, XFIXNUM (number) - 1);
+         number = make_number (num);
+         mpz_clear (num);
+       }
+    }
   return number;
 }
 
@@ -3106,8 +3509,20 @@ DEFUN ("lognot", Flognot, Slognot, 1, 1, 0,
        doc: /* Return the bitwise complement of NUMBER.  NUMBER must be an 
integer.  */)
   (register Lisp_Object number)
 {
-  CHECK_NUMBER (number);
-  XSETINT (number, ~XINT (number));
+  CHECK_INTEGER (number);
+  if (BIGNUMP (number))
+    {
+      mpz_t value;
+      mpz_init (value);
+      mpz_com (value, XBIGNUM (number)->value);
+      number = make_number (value);
+      mpz_clear (value);
+    }
+  else
+    {
+      eassume (FIXNUMP (number));
+      XSETINT (number, ~XFIXNUM (number));
+    }
   return number;
 }
 
@@ -3121,7 +3536,7 @@ lowercase l) for small endian machines.  */
   unsigned i = 0x04030201;
   int order = *(char *)&i == 1 ? 108 : 66;
 
-  return make_number (order);
+  return make_fixnum (order);
 }
 
 /* Because we round up the bool vector allocate size to word_size
@@ -3474,7 +3889,7 @@ value from A's length.  */)
   for (i = 0; i < nwords; i++)
     count += count_one_bits_word (adata[i]);
 
-  return make_number (count);
+  return make_fixnum (count);
 }
 
 DEFUN ("bool-vector-count-consecutive", Fbool_vector_count_consecutive,
@@ -3493,16 +3908,16 @@ A is a bool vector, B is t or nil, and I is an index 
into A.  */)
   ptrdiff_t nr_words;
 
   CHECK_BOOL_VECTOR (a);
-  CHECK_NATNUM (i);
+  CHECK_FIXNAT (i);
 
   nr_bits = bool_vector_size (a);
-  if (XFASTINT (i) > nr_bits) /* Allow one past the end for convenience */
+  if (XFIXNAT (i) > nr_bits) /* Allow one past the end for convenience */
     args_out_of_range (a, i);
 
   adata = bool_vector_data (a);
   nr_words = bool_vector_words (nr_bits);
-  pos = XFASTINT (i) / BITS_PER_BITS_WORD;
-  offset = XFASTINT (i) % BITS_PER_BITS_WORD;
+  pos = XFIXNAT (i) / BITS_PER_BITS_WORD;
+  offset = XFIXNAT (i) % BITS_PER_BITS_WORD;
   count = 0;
 
   /* By XORing with twiddle, we transform the problem of "count
@@ -3523,7 +3938,7 @@ A is a bool vector, B is t or nil, and I is an index into 
A.  */)
       count = count_trailing_zero_bits (mword);
       pos++;
       if (count + offset < BITS_PER_BITS_WORD)
-        return make_number (count);
+        return make_fixnum (count);
     }
 
   /* Scan whole words until we either reach the end of the vector or
@@ -3550,7 +3965,7 @@ A is a bool vector, B is t or nil, and I is an index into 
A.  */)
       count -= BITS_PER_BITS_WORD - nr_bits % BITS_PER_BITS_WORD;
     }
 
-  return make_number (count);
+  return make_fixnum (count);
 }
 
 
@@ -3593,6 +4008,7 @@ syms_of_data (void)
   DEFSYM (Qlistp, "listp");
   DEFSYM (Qconsp, "consp");
   DEFSYM (Qsymbolp, "symbolp");
+  DEFSYM (Qfixnump, "fixnump");
   DEFSYM (Qintegerp, "integerp");
   DEFSYM (Qnatnump, "natnump");
   DEFSYM (Qwholenump, "wholenump");
@@ -3741,6 +4157,7 @@ syms_of_data (void)
   defsubr (&Sconsp);
   defsubr (&Satom);
   defsubr (&Sintegerp);
+  defsubr (&Sfixnump);
   defsubr (&Sinteger_or_marker_p);
   defsubr (&Snumberp);
   defsubr (&Snumber_or_marker_p);
@@ -3766,6 +4183,7 @@ syms_of_data (void)
   defsubr (&Sthreadp);
   defsubr (&Smutexp);
   defsubr (&Scondition_variable_p);
+  defsubr (&Sbignump);
   defsubr (&Scar);
   defsubr (&Scdr);
   defsubr (&Scar_safe);
@@ -3841,15 +4259,15 @@ syms_of_data (void)
   set_symbol_function (Qwholenump, XSYMBOL (Qnatnump)->u.s.function);
 
   DEFVAR_LISP ("most-positive-fixnum", Vmost_positive_fixnum,
-              doc: /* The largest value that is representable in a Lisp 
integer.
+              doc: /* The greatest integer that is represented efficiently.
 This variable cannot be set; trying to do so will signal an error.  */);
-  Vmost_positive_fixnum = make_number (MOST_POSITIVE_FIXNUM);
+  Vmost_positive_fixnum = make_fixnum (MOST_POSITIVE_FIXNUM);
   make_symbol_constant (intern_c_string ("most-positive-fixnum"));
 
   DEFVAR_LISP ("most-negative-fixnum", Vmost_negative_fixnum,
-              doc: /* The smallest value that is representable in a Lisp 
integer.
+              doc: /* The least integer that is represented efficiently.
 This variable cannot be set; trying to do so will signal an error.  */);
-  Vmost_negative_fixnum = make_number (MOST_NEGATIVE_FIXNUM);
+  Vmost_negative_fixnum = make_fixnum (MOST_NEGATIVE_FIXNUM);
   make_symbol_constant (intern_c_string ("most-negative-fixnum"));
 
   DEFSYM (Qwatchers, "watchers");
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 9642981..fe92d39 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -201,8 +201,8 @@ xd_symbol_to_dbus_type (Lisp_Object object)
    arguments to a D-Bus message.  */
 #define XD_OBJECT_TO_DBUS_TYPE(object)                                 \
   ((EQ (object, Qt) || NILP (object)) ? DBUS_TYPE_BOOLEAN              \
-   : (NATNUMP (object)) ? DBUS_TYPE_UINT32                             \
-   : (INTEGERP (object)) ? DBUS_TYPE_INT32                             \
+   : (FIXNATP (object)) ? DBUS_TYPE_UINT32                             \
+   : (FIXNUMP (object)) ? DBUS_TYPE_INT32                              \
    : (FLOATP (object)) ? DBUS_TYPE_DOUBLE                              \
    : (STRINGP (object)) ? DBUS_TYPE_STRING                             \
    : (XD_DBUS_TYPE_P (object)) ? xd_symbol_to_dbus_type (object)       \
@@ -355,7 +355,7 @@ xd_signature (char *signature, int dtype, int parent_type, 
Lisp_Object object)
     {
     case DBUS_TYPE_BYTE:
     case DBUS_TYPE_UINT16:
-      CHECK_NATNUM (object);
+      CHECK_FIXNAT (object);
       sprintf (signature, "%c", dtype);
       break;
 
@@ -366,7 +366,7 @@ xd_signature (char *signature, int dtype, int parent_type, 
Lisp_Object object)
       break;
 
     case DBUS_TYPE_INT16:
-      CHECK_NUMBER (object);
+      CHECK_FIXNUM (object);
       sprintf (signature, "%c", dtype);
       break;
 
@@ -378,7 +378,7 @@ xd_signature (char *signature, int dtype, int parent_type, 
Lisp_Object object)
     case DBUS_TYPE_INT32:
     case DBUS_TYPE_INT64:
     case DBUS_TYPE_DOUBLE:
-      CHECK_NUMBER_OR_FLOAT (object);
+      CHECK_FIXNUM_OR_FLOAT (object);
       sprintf (signature, "%c", dtype);
       break;
 
@@ -519,11 +519,11 @@ xd_signature (char *signature, int dtype, int 
parent_type, Lisp_Object object)
 static intmax_t
 xd_extract_signed (Lisp_Object x, intmax_t lo, intmax_t hi)
 {
-  CHECK_NUMBER_OR_FLOAT (x);
-  if (INTEGERP (x))
+  CHECK_FIXNUM_OR_FLOAT (x);
+  if (FIXNUMP (x))
     {
-      if (lo <= XINT (x) && XINT (x) <= hi)
-       return XINT (x);
+      if (lo <= XFIXNUM (x) && XFIXNUM (x) <= hi)
+       return XFIXNUM (x);
     }
   else
     {
@@ -547,11 +547,11 @@ xd_extract_signed (Lisp_Object x, intmax_t lo, intmax_t 
hi)
 static uintmax_t
 xd_extract_unsigned (Lisp_Object x, uintmax_t hi)
 {
-  CHECK_NUMBER_OR_FLOAT (x);
-  if (INTEGERP (x))
+  CHECK_FIXNUM_OR_FLOAT (x);
+  if (FIXNUMP (x))
     {
-      if (0 <= XINT (x) && XINT (x) <= hi)
-       return XINT (x);
+      if (0 <= XFIXNUM (x) && XFIXNUM (x) <= hi)
+       return XFIXNUM (x);
     }
   else
     {
@@ -566,7 +566,7 @@ xd_extract_unsigned (Lisp_Object x, uintmax_t hi)
   if (xd_in_read_queued_messages)
     Fthrow (Qdbus_error, Qnil);
   else
-    args_out_of_range_3 (x, make_number (0), make_fixnum_or_float (hi));
+    args_out_of_range_3 (x, make_fixnum (0), make_fixnum_or_float (hi));
 }
 
 /* Append C value, extracted from Lisp OBJECT, to iteration ITER.
@@ -584,9 +584,9 @@ xd_append_arg (int dtype, Lisp_Object object, 
DBusMessageIter *iter)
     switch (dtype)
       {
       case DBUS_TYPE_BYTE:
-       CHECK_NATNUM (object);
+       CHECK_FIXNAT (object);
        {
-         unsigned char val = XFASTINT (object) & 0xFF;
+         unsigned char val = XFIXNAT (object) & 0xFF;
          XD_DEBUG_MESSAGE ("%c %u", dtype, val);
          if (!dbus_message_iter_append_basic (iter, dtype, &val))
            XD_SIGNAL2 (build_string ("Unable to append argument"), object);
@@ -750,7 +750,7 @@ xd_append_arg (int dtype, Lisp_Object object, 
DBusMessageIter *iter)
          if (!dbus_message_iter_open_container (iter, dtype,
                                                 signature, &subiter))
            XD_SIGNAL3 (build_string ("Cannot open container"),
-                       make_number (dtype), build_string (signature));
+                       make_fixnum (dtype), build_string (signature));
          break;
 
        case DBUS_TYPE_VARIANT:
@@ -763,7 +763,7 @@ xd_append_arg (int dtype, Lisp_Object object, 
DBusMessageIter *iter)
          if (!dbus_message_iter_open_container (iter, dtype,
                                                 signature, &subiter))
            XD_SIGNAL3 (build_string ("Cannot open container"),
-                       make_number (dtype), build_string (signature));
+                       make_fixnum (dtype), build_string (signature));
          break;
 
        case DBUS_TYPE_STRUCT:
@@ -772,7 +772,7 @@ xd_append_arg (int dtype, Lisp_Object object, 
DBusMessageIter *iter)
          XD_DEBUG_MESSAGE ("%c %s", dtype, XD_OBJECT_TO_STRING (object));
          if (!dbus_message_iter_open_container (iter, dtype, NULL, &subiter))
            XD_SIGNAL2 (build_string ("Cannot open container"),
-                       make_number (dtype));
+                       make_fixnum (dtype));
          break;
        }
 
@@ -790,7 +790,7 @@ xd_append_arg (int dtype, Lisp_Object object, 
DBusMessageIter *iter)
       /* Close the subiteration.  */
       if (!dbus_message_iter_close_container (iter, &subiter))
        XD_SIGNAL2 (build_string ("Cannot close container"),
-                   make_number (dtype));
+                   make_fixnum (dtype));
     }
 }
 
@@ -810,7 +810,7 @@ xd_retrieve_arg (int dtype, DBusMessageIter *iter)
        dbus_message_iter_get_basic (iter, &val);
        val = val & 0xFF;
        XD_DEBUG_MESSAGE ("%c %u", dtype, val);
-       return make_number (val);
+       return make_fixnum (val);
       }
 
     case DBUS_TYPE_BOOLEAN:
@@ -828,7 +828,7 @@ xd_retrieve_arg (int dtype, DBusMessageIter *iter)
        dbus_message_iter_get_basic (iter, &val);
        pval = val;
        XD_DEBUG_MESSAGE ("%c %d", dtype, pval);
-       return make_number (val);
+       return make_fixnum (val);
       }
 
     case DBUS_TYPE_UINT16:
@@ -838,7 +838,7 @@ xd_retrieve_arg (int dtype, DBusMessageIter *iter)
        dbus_message_iter_get_basic (iter, &val);
        pval = val;
        XD_DEBUG_MESSAGE ("%c %d", dtype, pval);
-       return make_number (val);
+       return make_fixnum (val);
       }
 
     case DBUS_TYPE_INT32:
@@ -1200,7 +1200,7 @@ this connection to those buses.  */)
   refcount = xd_get_connection_references (connection);
   XD_DEBUG_MESSAGE ("Bus %s, Reference counter %"pD"d",
                    XD_OBJECT_TO_STRING (bus), refcount);
-  return make_number (refcount);
+  return make_fixnum (refcount);
 }
 
 DEFUN ("dbus-get-unique-name", Fdbus_get_unique_name, Sdbus_get_unique_name,
@@ -1275,11 +1275,11 @@ usage: (dbus-message-internal &rest REST)  */)
   service = args[2];
   handler = Qnil;
 
-  CHECK_NATNUM (message_type);
-  if (! (DBUS_MESSAGE_TYPE_INVALID < XFASTINT (message_type)
-        && XFASTINT (message_type) < DBUS_NUM_MESSAGE_TYPES))
+  CHECK_FIXNAT (message_type);
+  if (! (DBUS_MESSAGE_TYPE_INVALID < XFIXNAT (message_type)
+        && XFIXNAT (message_type) < DBUS_NUM_MESSAGE_TYPES))
     XD_SIGNAL2 (build_string ("Invalid message type"), message_type);
-  mtype = XFASTINT (message_type);
+  mtype = XFIXNAT (message_type);
 
   if ((mtype == DBUS_MESSAGE_TYPE_METHOD_CALL)
       || (mtype == DBUS_MESSAGE_TYPE_SIGNAL))
@@ -1303,7 +1303,7 @@ usage: (dbus-message-internal &rest REST)  */)
   if (nargs < count)
     xsignal2 (Qwrong_number_of_arguments,
              Qdbus_message_internal,
-             make_number (nargs));
+             make_fixnum (nargs));
 
   if ((mtype == DBUS_MESSAGE_TYPE_METHOD_CALL)
       || (mtype == DBUS_MESSAGE_TYPE_SIGNAL))
@@ -1409,8 +1409,8 @@ usage: (dbus-message-internal &rest REST)  */)
   /* Check for timeout parameter.  */
   if ((count + 2 <= nargs) && EQ (args[count], QCtimeout))
     {
-      CHECK_NATNUM (args[count+1]);
-      timeout = min (XFASTINT (args[count+1]), INT_MAX);
+      CHECK_FIXNAT (args[count+1]);
+      timeout = min (XFIXNAT (args[count+1]), INT_MAX);
       count = count+2;
     }
 
@@ -1609,7 +1609,7 @@ xd_read_message_1 (DBusConnection *connection, 
Lisp_Object bus)
   event.arg = Fcons ((uname == NULL ? Qnil : build_string (uname)),
                     event.arg);
   event.arg = Fcons (make_fixnum_or_float (serial), event.arg);
-  event.arg = Fcons (make_number (mtype), event.arg);
+  event.arg = Fcons (make_fixnum (mtype), event.arg);
 
   /* Add the bus symbol to the event.  */
   event.arg = Fcons (bus, event.arg);
@@ -1754,28 +1754,28 @@ syms_of_dbusbind (void)
   DEFVAR_LISP ("dbus-message-type-invalid",
               Vdbus_message_type_invalid,
     doc: /* This value is never a valid message type.  */);
-  Vdbus_message_type_invalid = make_number (DBUS_MESSAGE_TYPE_INVALID);
+  Vdbus_message_type_invalid = make_fixnum (DBUS_MESSAGE_TYPE_INVALID);
 
   DEFVAR_LISP ("dbus-message-type-method-call",
               Vdbus_message_type_method_call,
     doc: /* Message type of a method call message.  */);
-  Vdbus_message_type_method_call = make_number (DBUS_MESSAGE_TYPE_METHOD_CALL);
+  Vdbus_message_type_method_call = make_fixnum (DBUS_MESSAGE_TYPE_METHOD_CALL);
 
   DEFVAR_LISP ("dbus-message-type-method-return",
               Vdbus_message_type_method_return,
     doc: /* Message type of a method return message.  */);
   Vdbus_message_type_method_return
-    = make_number (DBUS_MESSAGE_TYPE_METHOD_RETURN);
+    = make_fixnum (DBUS_MESSAGE_TYPE_METHOD_RETURN);
 
   DEFVAR_LISP ("dbus-message-type-error",
               Vdbus_message_type_error,
     doc: /* Message type of an error reply message.  */);
-  Vdbus_message_type_error = make_number (DBUS_MESSAGE_TYPE_ERROR);
+  Vdbus_message_type_error = make_fixnum (DBUS_MESSAGE_TYPE_ERROR);
 
   DEFVAR_LISP ("dbus-message-type-signal",
               Vdbus_message_type_signal,
     doc: /* Message type of a signal message.  */);
-  Vdbus_message_type_signal = make_number (DBUS_MESSAGE_TYPE_SIGNAL);
+  Vdbus_message_type_signal = make_fixnum (DBUS_MESSAGE_TYPE_SIGNAL);
 
   DEFVAR_LISP ("dbus-registered-objects-table",
               Vdbus_registered_objects_table,
diff --git a/src/decompress.c b/src/decompress.c
index 6f75f82..9f7fbe4 100644
--- a/src/decompress.c
+++ b/src/decompress.c
@@ -149,8 +149,8 @@ This function can be called only in unibyte buffers.  */)
 
   /* This is a unibyte buffer, so character positions and bytes are
      the same.  */
-  istart = XINT (start);
-  iend = XINT (end);
+  istart = XFIXNUM (start);
+  iend = XFIXNUM (end);
 
   /* Do the following before manipulating the gap. */
   modify_text (istart, iend);
diff --git a/src/dired.c b/src/dired.c
index 472ec11..b92cd2b 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -671,15 +671,15 @@ file_name_completion (Lisp_Object file, Lisp_Object 
dirname, bool all_flag,
       /* Reject entries where the encoded strings match, but the
          decoded don't.  For example, "a" should not match "a-ring" on
          file systems that store decomposed characters. */
-      Lisp_Object zero = make_number (0);
+      Lisp_Object zero = make_fixnum (0);
 
       if (check_decoded && SCHARS (file) <= SCHARS (name))
        {
          /* FIXME: This is a copy of the code below.  */
          ptrdiff_t compare = SCHARS (file);
          Lisp_Object cmp
-           = Fcompare_strings (name, zero, make_number (compare),
-                               file, zero, make_number (compare),
+           = Fcompare_strings (name, zero, make_fixnum (compare),
+                               file, zero, make_fixnum (compare),
                                completion_ignore_case ? Qt : Qnil);
          if (!EQ (cmp, Qt))
            continue;
@@ -701,10 +701,10 @@ file_name_completion (Lisp_Object file, Lisp_Object 
dirname, bool all_flag,
          /* FIXME: This is a copy of the code in Ftry_completion.  */
          ptrdiff_t compare = min (bestmatchsize, SCHARS (name));
          Lisp_Object cmp
-           = Fcompare_strings (bestmatch, zero, make_number (compare),
-                               name, zero, make_number (compare),
+           = Fcompare_strings (bestmatch, zero, make_fixnum (compare),
+                               name, zero, make_fixnum (compare),
                                completion_ignore_case ? Qt : Qnil);
-         ptrdiff_t matchsize = EQ (cmp, Qt) ? compare : eabs (XINT (cmp)) - 1;
+         ptrdiff_t matchsize = EQ (cmp, Qt) ? compare : eabs (XFIXNUM (cmp)) - 
1;
 
          if (completion_ignore_case)
            {
@@ -729,13 +729,13 @@ file_name_completion (Lisp_Object file, Lisp_Object 
dirname, bool all_flag,
                    ==
                    (matchsize + directoryp == SCHARS (bestmatch)))
                   && (cmp = Fcompare_strings (name, zero,
-                                              make_number (SCHARS (file)),
+                                              make_fixnum (SCHARS (file)),
                                               file, zero,
                                               Qnil,
                                               Qnil),
                       EQ (Qt, cmp))
                   && (cmp = Fcompare_strings (bestmatch, zero,
-                                              make_number (SCHARS (file)),
+                                              make_fixnum (SCHARS (file)),
                                               file, zero,
                                               Qnil,
                                               Qnil),
@@ -769,8 +769,8 @@ file_name_completion (Lisp_Object file, Lisp_Object 
dirname, bool all_flag,
      it does not require any change to be made.  */
   if (matchcount == 1 && !NILP (Fequal (bestmatch, file)))
     return Qt;
-  bestmatch = Fsubstring (bestmatch, make_number (0),
-                         make_number (bestmatchsize));
+  bestmatch = Fsubstring (bestmatch, make_fixnum (0),
+                         make_fixnum (bestmatchsize));
   return bestmatch;
 }
 
@@ -1009,7 +1009,7 @@ file_attributes (int fd, char const *name,
 
   return CALLN (Flist,
                file_type,
-               make_number (s.st_nlink),
+               make_fixnum (s.st_nlink),
                (uname
                 ? DECODE_SYSTEM (build_unibyte_string (uname))
                 : make_fixnum_or_float (s.st_uid)),
diff --git a/src/dispextern.h b/src/dispextern.h
index 2180c9a..9cc65f6 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -306,24 +306,24 @@ INLINE int
 GLYPH_CODE_CHAR (Lisp_Object gc)
 {
   return (CONSP (gc)
-         ? XINT (XCAR (gc))
-         : XINT (gc) & MAX_CHAR);
+         ? XFIXNUM (XCAR (gc))
+         : XFIXNUM (gc) & MAX_CHAR);
 }
 
 INLINE int
 GLYPH_CODE_FACE (Lisp_Object gc)
 {
-  return CONSP (gc) ? XINT (XCDR (gc)) : XINT (gc) >> CHARACTERBITS;
+  return CONSP (gc) ? XFIXNUM (XCDR (gc)) : XFIXNUM (gc) >> CHARACTERBITS;
 }
 
 #define SET_GLYPH_FROM_GLYPH_CODE(glyph, gc)                           \
   do                                                                   \
     {                                                                  \
       if (CONSP (gc))                                                  \
-       SET_GLYPH (glyph, XINT (XCAR (gc)), XINT (XCDR (gc)));          \
+       SET_GLYPH (glyph, XFIXNUM (XCAR (gc)), XFIXNUM (XCDR (gc)));            
\
       else                                                             \
-       SET_GLYPH (glyph, (XINT (gc) & ((1 << CHARACTERBITS)-1)),       \
-                  (XINT (gc) >> CHARACTERBITS));                       \
+       SET_GLYPH (glyph, (XFIXNUM (gc) & ((1 << CHARACTERBITS)-1)),    \
+                  (XFIXNUM (gc) >> CHARACTERBITS));                    \
     }                                                                  \
   while (false)
 
@@ -1837,8 +1837,8 @@ GLYPH_CODE_P (Lisp_Object gc)
 {
   return (CONSP (gc)
          ? (CHARACTERP (XCAR (gc))
-            && RANGED_INTEGERP (0, XCDR (gc), MAX_FACE_ID))
-         : (RANGED_INTEGERP
+            && RANGED_FIXNUMP (0, XCDR (gc), MAX_FACE_ID))
+         : (RANGED_FIXNUMP
             (0, gc,
              (MAX_FACE_ID < TYPE_MAXIMUM (EMACS_INT) >> CHARACTERBITS
               ? ((EMACS_INT) MAX_FACE_ID << CHARACTERBITS) | MAX_CHAR
@@ -2482,7 +2482,7 @@ struct it
 
      If `what' is anything else, these two are undefined (will
      probably hold values for the last IT_CHARACTER or IT_COMPOSITION
-     traversed by the iterator.
+     traversed by the iterator).
 
      The values are updated by get_next_display_element, so they are
      out of sync with the value returned by IT_CHARPOS between the
diff --git a/src/dispnew.c b/src/dispnew.c
index fc6f9e2..b54ae88 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -5717,8 +5717,8 @@ additional wait period, in milliseconds; this is for 
backwards compatibility.
 
   if (!NILP (milliseconds))
     {
-      CHECK_NUMBER (milliseconds);
-      duration += XINT (milliseconds) / 1000.0;
+      CHECK_FIXNUM (milliseconds);
+      duration += XFIXNUM (milliseconds) / 1000.0;
     }
 
   if (duration > 0)
@@ -5766,9 +5766,9 @@ sit_for (Lisp_Object timeout, bool reading, int 
display_option)
   if (display_option > 1)
     redisplay_preserve_echo_area (2);
 
-  if (INTEGERP (timeout))
+  if (FIXNUMP (timeout))
     {
-      sec = XINT (timeout);
+      sec = XFIXNUM (timeout);
       if (sec <= 0)
        return Qt;
       nsec = 0;
@@ -5925,7 +5925,7 @@ pass nil for VARIABLE.  */)
       || n + 20 < ASIZE (state) / 2)
     /* Add 20 extra so we grow it less often.  */
     {
-      state = Fmake_vector (make_number (n + 20), Qlambda);
+      state = Fmake_vector (make_fixnum (n + 20), Qlambda);
       if (! NILP (variable))
        Fset (variable, state);
       else
@@ -6041,7 +6041,7 @@ init_display (void)
     {
       Vinitial_window_system = Qx;
 #ifdef HAVE_X11
-      Vwindow_system_version = make_number (11);
+      Vwindow_system_version = make_fixnum (11);
 #endif
 #ifdef USE_NCURSES
       /* In some versions of ncurses,
@@ -6057,7 +6057,7 @@ init_display (void)
   if (!inhibit_window_system)
     {
       Vinitial_window_system = Qw32;
-      Vwindow_system_version = make_number (1);
+      Vwindow_system_version = make_fixnum (1);
       return;
     }
 #endif /* HAVE_NTGUI */
@@ -6070,7 +6070,7 @@ init_display (void)
       )
     {
       Vinitial_window_system = Qns;
-      Vwindow_system_version = make_number (10);
+      Vwindow_system_version = make_fixnum (10);
       return;
     }
 #endif
@@ -6223,7 +6223,7 @@ syms_of_display (void)
   defsubr (&Sdump_redisplay_history);
 #endif
 
-  frame_and_buffer_state = Fmake_vector (make_number (20), Qlambda);
+  frame_and_buffer_state = Fmake_vector (make_fixnum (20), Qlambda);
   staticpro (&frame_and_buffer_state);
 
   /* This is the "purpose" slot of a display table.  */
diff --git a/src/disptab.h b/src/disptab.h
index a86a9130..c8de011 100644
--- a/src/disptab.h
+++ b/src/disptab.h
@@ -72,14 +72,14 @@ extern struct Lisp_Char_Table *buffer_display_table (void);
 /* Given BASE and LEN returned by the two previous macros,
    return nonzero if GLYPH code G is aliased to a different code.  */
 #define GLYPH_ALIAS_P(base,len,g) \
-  (GLYPH_FACE (g) == DEFAULT_FACE_ID && GLYPH_CHAR (g) < (len) && INTEGERP 
(base[GLYPH_CHAR (g)]))
+  (GLYPH_FACE (g) == DEFAULT_FACE_ID && GLYPH_CHAR (g) < (len) && FIXNUMP 
(base[GLYPH_CHAR (g)]))
 
 /* Follow all aliases for G in the glyph table given by (BASE,
    LENGTH), and set G to the final glyph.  */
 #define GLYPH_FOLLOW_ALIASES(base, length, g)                  \
   do {                                                         \
     while (GLYPH_ALIAS_P ((base), (length), (g)))              \
-      SET_GLYPH_CHAR ((g), XINT ((base)[GLYPH_CHAR (g)]));     \
+      SET_GLYPH_CHAR ((g), XFIXNUM ((base)[GLYPH_CHAR (g)]));  \
     if (!GLYPH_CHAR_VALID_P (g))                               \
       SET_GLYPH_CHAR (g, ' ');                                 \
   } while (false)
diff --git a/src/doc.c b/src/doc.c
index 075154e..3437346 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -89,7 +89,7 @@ get_doc_string (Lisp_Object filepos, bool unibyte, bool 
definition)
   ptrdiff_t count = SPECPDL_INDEX ();
   USE_SAFE_ALLOCA;
 
-  if (INTEGERP (filepos))
+  if (FIXNUMP (filepos))
     {
       file = Vdoc_file_name;
       pos = filepos;
@@ -102,7 +102,7 @@ get_doc_string (Lisp_Object filepos, bool unibyte, bool 
definition)
   else
     return Qnil;
 
-  position = eabs (XINT (pos));
+  position = eabs (XFIXNUM (pos));
 
   if (!STRINGP (Vdoc_directory))
     return Qnil;
@@ -339,7 +339,7 @@ string is passed through `substitute-command-keys'.  */)
   if (CONSP (fun) && EQ (XCAR (fun), Qmacro))
     fun = XCDR (fun);
   if (SUBRP (fun))
-    doc = make_number (XSUBR (fun)->doc);
+    doc = make_fixnum (XSUBR (fun)->doc);
   else if (MODULE_FUNCTIONP (fun))
     doc = XMODULE_FUNCTION (fun)->documentation;
   else if (COMPILEDP (fun))
@@ -351,7 +351,7 @@ string is passed through `substitute-command-keys'.  */)
          Lisp_Object tem = AREF (fun, COMPILED_DOC_STRING);
          if (STRINGP (tem))
            doc = tem;
-         else if (NATNUMP (tem) || CONSP (tem))
+         else if (FIXNATP (tem) || CONSP (tem))
            doc = tem;
          else
            return Qnil;
@@ -378,7 +378,7 @@ string is passed through `substitute-command-keys'.  */)
            doc = tem;
          /* Handle a doc reference--but these never come last
             in the function body, so reject them if they are last.  */
-         else if ((NATNUMP (tem) || (CONSP (tem) && INTEGERP (XCDR (tem))))
+         else if ((FIXNATP (tem) || (CONSP (tem) && FIXNUMP (XCDR (tem))))
                   && !NILP (XCDR (tem1)))
            doc = tem;
          else
@@ -395,9 +395,9 @@ string is passed through `substitute-command-keys'.  */)
 
   /* If DOC is 0, it's typically because of a dumped file missing
      from the DOC file (bug in src/Makefile.in).  */
-  if (EQ (doc, make_number (0)))
+  if (EQ (doc, make_fixnum (0)))
     doc = Qnil;
-  if (INTEGERP (doc) || CONSP (doc))
+  if (FIXNUMP (doc) || CONSP (doc))
     {
       Lisp_Object tem;
       tem = get_doc_string (doc, 0, 0);
@@ -437,9 +437,9 @@ aren't strings.  */)
  documentation_property:
 
   tem = Fget (symbol, prop);
-  if (EQ (tem, make_number (0)))
+  if (EQ (tem, make_fixnum (0)))
     tem = Qnil;
-  if (INTEGERP (tem) || (CONSP (tem) && INTEGERP (XCDR (tem))))
+  if (FIXNUMP (tem) || (CONSP (tem) && FIXNUMP (XCDR (tem))))
     {
       Lisp_Object doc = tem;
       tem = get_doc_string (tem, 0, 0);
@@ -486,10 +486,10 @@ store_function_docstring (Lisp_Object obj, EMACS_INT 
offset)
          || (EQ (tem, Qclosure) && (fun = XCDR (fun), 1)))
        {
          tem = Fcdr (Fcdr (fun));
-         if (CONSP (tem) && INTEGERP (XCAR (tem)))
+         if (CONSP (tem) && FIXNUMP (XCAR (tem)))
            /* FIXME: This modifies typically pure hash-cons'd data, so its
               correctness is quite delicate.  */
-           XSETCAR (tem, make_number (offset));
+           XSETCAR (tem, make_fixnum (offset));
        }
     }
 
@@ -503,7 +503,7 @@ store_function_docstring (Lisp_Object obj, EMACS_INT offset)
       /* This bytecode object must have a slot for the
         docstring, since we've found a docstring for it.  */
       if (PVSIZE (fun) > COMPILED_DOC_STRING)
-       ASET (fun, COMPILED_DOC_STRING, make_number (offset));
+       ASET (fun, COMPILED_DOC_STRING, make_fixnum (offset));
       else
        {
          AUTO_STRING (format, "No docstring slot for %s");
@@ -635,7 +635,7 @@ the same file name is found in the `doc-directory'.  */)
                       || !NILP (Fmemq (sym, delayed_init)))
                       && strncmp (end, "\nSKIP", 5))
                     Fput (sym, Qvariable_documentation,
-                          make_number ((pos + end + 1 - buf)
+                          make_fixnum ((pos + end + 1 - buf)
                                        * (end[1] == '*' ? -1 : 1)));
                }
 
@@ -671,7 +671,7 @@ default_to_grave_quoting_style (void)
   Lisp_Object dv = DISP_CHAR_VECTOR (XCHAR_TABLE (Vstandard_display_table),
                                     LEFT_SINGLE_QUOTATION_MARK);
   return (VECTORP (dv) && ASIZE (dv) == 1
-         && EQ (AREF (dv, 0), make_number ('`')));
+         && EQ (AREF (dv, 0), make_fixnum ('`')));
 }
 
 /* Return the current effective text quoting style.  */
diff --git a/src/dosfns.c b/src/dosfns.c
index f9845a3..25932ff 100644
--- a/src/dosfns.c
+++ b/src/dosfns.c
@@ -66,33 +66,33 @@ REGISTERS should be a vector produced by `make-register' and
   int no;
   union REGS inregs, outregs;
 
-  CHECK_NUMBER (interrupt);
-  no = (unsigned long) XINT (interrupt);
+  CHECK_FIXNUM (interrupt);
+  no = (unsigned long) XFIXNUM (interrupt);
   CHECK_VECTOR (registers);
   if (no < 0 || no > 0xff || ASIZE (registers) != 8)
     return Qnil;
   for (i = 0; i < 8; i++)
-    CHECK_NUMBER (AREF (registers, i));
+    CHECK_FIXNUM (AREF (registers, i));
 
-  inregs.x.ax    = (unsigned long) XFASTINT (AREF (registers, 0));
-  inregs.x.bx    = (unsigned long) XFASTINT (AREF (registers, 1));
-  inregs.x.cx    = (unsigned long) XFASTINT (AREF (registers, 2));
-  inregs.x.dx    = (unsigned long) XFASTINT (AREF (registers, 3));
-  inregs.x.si    = (unsigned long) XFASTINT (AREF (registers, 4));
-  inregs.x.di    = (unsigned long) XFASTINT (AREF (registers, 5));
-  inregs.x.cflag = (unsigned long) XFASTINT (AREF (registers, 6));
-  inregs.x.flags = (unsigned long) XFASTINT (AREF (registers, 7));
+  inregs.x.ax    = (unsigned long) XFIXNAT (AREF (registers, 0));
+  inregs.x.bx    = (unsigned long) XFIXNAT (AREF (registers, 1));
+  inregs.x.cx    = (unsigned long) XFIXNAT (AREF (registers, 2));
+  inregs.x.dx    = (unsigned long) XFIXNAT (AREF (registers, 3));
+  inregs.x.si    = (unsigned long) XFIXNAT (AREF (registers, 4));
+  inregs.x.di    = (unsigned long) XFIXNAT (AREF (registers, 5));
+  inregs.x.cflag = (unsigned long) XFIXNAT (AREF (registers, 6));
+  inregs.x.flags = (unsigned long) XFIXNAT (AREF (registers, 7));
 
   int86 (no, &inregs, &outregs);
 
-  ASET (registers, 0, make_number (outregs.x.ax));
-  ASET (registers, 1, make_number (outregs.x.bx));
-  ASET (registers, 2, make_number (outregs.x.cx));
-  ASET (registers, 3, make_number (outregs.x.dx));
-  ASET (registers, 4, make_number (outregs.x.si));
-  ASET (registers, 5, make_number (outregs.x.di));
-  ASET (registers, 6, make_number (outregs.x.cflag));
-  ASET (registers, 7, make_number (outregs.x.flags));
+  ASET (registers, 0, make_fixnum (outregs.x.ax));
+  ASET (registers, 1, make_fixnum (outregs.x.bx));
+  ASET (registers, 2, make_fixnum (outregs.x.cx));
+  ASET (registers, 3, make_fixnum (outregs.x.dx));
+  ASET (registers, 4, make_fixnum (outregs.x.si));
+  ASET (registers, 5, make_fixnum (outregs.x.di));
+  ASET (registers, 6, make_fixnum (outregs.x.cflag));
+  ASET (registers, 7, make_fixnum (outregs.x.flags));
 
   return registers;
 }
@@ -106,8 +106,8 @@ Return the updated VECTOR.  */)
   int offs, len;
   char *buf;
 
-  CHECK_NUMBER (address);
-  offs = (unsigned long) XINT (address);
+  CHECK_FIXNUM (address);
+  offs = (unsigned long) XFIXNUM (address);
   CHECK_VECTOR (vector);
   len = ASIZE (vector);
   if (len < 1 || len > 2048 || offs < 0 || offs > 0xfffff - len)
@@ -116,7 +116,7 @@ Return the updated VECTOR.  */)
   dosmemget (offs, len, buf);
 
   for (i = 0; i < len; i++)
-    ASET (vector, i, make_number (buf[i]));
+    ASET (vector, i, make_fixnum (buf[i]));
 
   return vector;
 }
@@ -129,8 +129,8 @@ DEFUN ("msdos-memput", Fdos_memput, Sdos_memput, 2, 2, 0,
   int offs, len;
   char *buf;
 
-  CHECK_NUMBER (address);
-  offs = (unsigned long) XINT (address);
+  CHECK_FIXNUM (address);
+  offs = (unsigned long) XFIXNUM (address);
   CHECK_VECTOR (vector);
   len = ASIZE (vector);
   if (len < 1 || len > 2048 || offs < 0 || offs > 0xfffff - len)
@@ -139,8 +139,8 @@ DEFUN ("msdos-memput", Fdos_memput, Sdos_memput, 2, 2, 0,
 
   for (i = 0; i < len; i++)
     {
-      CHECK_NUMBER (AREF (vector, i));
-      buf[i] = (unsigned char) XFASTINT (AREF (vector, i)) & 0xFF;
+      CHECK_FIXNUM (AREF (vector, i));
+      buf[i] = (unsigned char) XFIXNAT (AREF (vector, i)) & 0xFF;
     }
 
   dosmemput (buf, len, offs);
@@ -154,8 +154,8 @@ all keys; otherwise it is only used when the ALT key is 
pressed.
 The current keyboard layout is available in dos-keyboard-code.  */)
   (Lisp_Object country_code, Lisp_Object allkeys)
 {
-  CHECK_NUMBER (country_code);
-  if (!dos_set_keyboard (XINT (country_code), !NILP (allkeys)))
+  CHECK_FIXNUM (country_code);
+  if (!dos_set_keyboard (XFIXNUM (country_code), !NILP (allkeys)))
     return Qnil;
   return Qt;
 }
@@ -280,7 +280,7 @@ init_dosfns (void)
 
   regs.x.ax = 0x3000;
   intdos (&regs, &regs);
-  Vdos_version = Fcons (make_number (regs.h.al), make_number (regs.h.ah));
+  Vdos_version = Fcons (make_fixnum (regs.h.al), make_fixnum (regs.h.ah));
 
   /* Obtain the country code via DPMI, use DJGPP transfer buffer.  */
   dpmiregs.x.ax = 0x3800;
@@ -341,7 +341,7 @@ init_dosfns (void)
     {
       dos_windows_version = dpmiregs.x.ax;
       Vdos_windows_version =
-       Fcons (make_number (dpmiregs.h.al), make_number (dpmiregs.h.ah));
+       Fcons (make_fixnum (dpmiregs.h.al), make_fixnum (dpmiregs.h.ah));
 
       /* Save the current title of this virtual machine, so we can restore
         it before exiting.  Otherwise, Windows 95 will continue to use
@@ -520,8 +520,8 @@ system_process_attributes (Lisp_Object pid)
   int proc_id;
   Lisp_Object attrs = Qnil;
 
-  CHECK_NUMBER_OR_FLOAT (pid);
-  proc_id = FLOATP (pid) ? XFLOAT_DATA (pid) : XINT (pid);
+  CHECK_FIXNUM_OR_FLOAT (pid);
+  proc_id = FLOATP (pid) ? XFLOAT_DATA (pid) : XFIXNUM (pid);
 
   if (proc_id == getpid ())
     {
@@ -555,13 +555,13 @@ system_process_attributes (Lisp_Object pid)
                                                  Vlocale_coding_system, 0);
       attrs = Fcons (Fcons (Qcomm, decoded_cmd), attrs);
       /* Pretend we have 0 as PPID.  */
-      attrs = Fcons (Fcons (Qppid, make_number (0)), attrs);
+      attrs = Fcons (Fcons (Qppid, make_fixnum (0)), attrs);
       attrs = Fcons (Fcons (Qpgrp, pid), attrs);
       attrs = Fcons (Fcons (Qttname, build_string ("/dev/tty")), attrs);
       /* We are never idle!  */
       tem = Fget_internal_run_time ();
       attrs = Fcons (Fcons (Qtime, tem), attrs);
-      attrs = Fcons (Fcons (Qthcount, make_number (1)), attrs);
+      attrs = Fcons (Fcons (Qthcount, make_fixnum (1)), attrs);
       attrs = Fcons (Fcons (Qstart,
                            Fsymbol_value (intern ("before-init-time"))),
                     attrs);
diff --git a/src/editfns.c b/src/editfns.c
index 0fbc5aa..d2281d7 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -158,30 +158,30 @@ tzlookup (Lisp_Object zone, bool settz)
 
   if (NILP (zone))
     return local_tz;
-  else if (EQ (zone, Qt) || EQ (zone, make_number (0)))
+  else if (EQ (zone, Qt) || EQ (zone, make_fixnum (0)))
     {
       zone_string = "UTC0";
       new_tz = utc_tz;
     }
   else
     {
-      bool plain_integer = INTEGERP (zone);
+      bool plain_integer = FIXNUMP (zone);
 
       if (EQ (zone, Qwall))
        zone_string = 0;
       else if (STRINGP (zone))
        zone_string = SSDATA (ENCODE_SYSTEM (zone));
-      else if (plain_integer || (CONSP (zone) && INTEGERP (XCAR (zone))
+      else if (plain_integer || (CONSP (zone) && FIXNUMP (XCAR (zone))
                                 && CONSP (XCDR (zone))))
        {
-         Lisp_Object abbr;
+         Lisp_Object abbr UNINIT;
          if (!plain_integer)
            {
              abbr = XCAR (XCDR (zone));
              zone = XCAR (zone);
            }
 
-         EMACS_INT abszone = eabs (XINT (zone)), hour = abszone / (60 * 60);
+         EMACS_INT abszone = eabs (XFIXNUM (zone)), hour = abszone / (60 * 60);
          int hour_remainder = abszone % (60 * 60);
          int min = hour_remainder / 60, sec = hour_remainder % 60;
 
@@ -196,8 +196,8 @@ tzlookup (Lisp_Object zone, bool settz)
                    prec += 2, numzone = 100 * numzone + sec;
                }
              sprintf (tzbuf, tzbuf_format, prec,
-                      XINT (zone) < 0 ? -numzone : numzone,
-                      &"-"[XINT (zone) < 0], hour, min, sec);
+                      XFIXNUM (zone) < 0 ? -numzone : numzone,
+                      &"-"[XFIXNUM (zone) < 0], hour, min, sec);
              zone_string = tzbuf;
            }
          else
@@ -205,7 +205,7 @@ tzlookup (Lisp_Object zone, bool settz)
              AUTO_STRING (leading, "<");
              AUTO_STRING_WITH_LEN (trailing, tzbuf,
                                    sprintf (tzbuf, trailing_tzbuf_format,
-                                            &"-"[XINT (zone) < 0],
+                                            &"-"[XFIXNUM (zone) < 0],
                                             hour, min, sec));
              zone_string = SSDATA (concat3 (leading, ENCODE_SYSTEM (abbr),
                                             trailing));
@@ -217,11 +217,11 @@ tzlookup (Lisp_Object zone, bool settz)
       new_tz = tzalloc (zone_string);
 
       if (HAVE_TZALLOC_BUG && !new_tz && errno != ENOMEM && plain_integer
-         && XINT (zone) % (60 * 60) == 0)
+         && XFIXNUM (zone) % (60 * 60) == 0)
        {
          /* tzalloc mishandles POSIX strings; fall back on tzdb if
             possible (Bug#30738).  */
-         sprintf (tzbuf, "Etc/GMT%+"pI"d", - (XINT (zone) / (60 * 60)));
+         sprintf (tzbuf, "Etc/GMT%+"pI"d", - (XFIXNUM (zone) / (60 * 60)));
          new_tz = tzalloc (zone_string);
        }
 
@@ -359,7 +359,7 @@ usage: (char-to-string CHAR)  */)
   unsigned char str[MAX_MULTIBYTE_LENGTH];
 
   CHECK_CHARACTER (character);
-  c = XFASTINT (character);
+  c = XFIXNAT (character);
 
   len = CHAR_STRING (c, str);
   return make_string_from_bytes ((char *) str, 1, len);
@@ -370,10 +370,10 @@ DEFUN ("byte-to-string", Fbyte_to_string, 
Sbyte_to_string, 1, 1, 0,
   (Lisp_Object byte)
 {
   unsigned char b;
-  CHECK_NUMBER (byte);
-  if (XINT (byte) < 0 || XINT (byte) > 255)
+  CHECK_FIXNUM (byte);
+  if (XFIXNUM (byte) < 0 || XFIXNUM (byte) > 255)
     error ("Invalid byte");
-  b = XINT (byte);
+  b = XFIXNUM (byte);
   return make_string_from_bytes ((char *) &b, 1, 1);
 }
 
@@ -421,8 +421,8 @@ The return value is POSITION.  */)
 {
   if (MARKERP (position))
     set_point_from_marker (position);
-  else if (INTEGERP (position))
-    SET_PT (clip_to_bounds (BEGV, XINT (position), ZV));
+  else if (FIXNUMP (position))
+    SET_PT (clip_to_bounds (BEGV, XFIXNUM (position), ZV));
   else
     wrong_type_argument (Qinteger_or_marker_p, position);
   return position;
@@ -448,9 +448,9 @@ region_limit (bool beginningp)
     error ("The mark is not set now, so there is no region");
 
   /* Clip to the current narrowing (bug#11770).  */
-  return make_number ((PT < XFASTINT (m)) == beginningp
+  return make_fixnum ((PT < XFIXNAT (m)) == beginningp
                      ? PT
-                     : clip_to_bounds (BEGV, XFASTINT (m), ZV));
+                     : clip_to_bounds (BEGV, XFIXNAT (m), ZV));
 }
 
 DEFUN ("region-beginning", Fregion_beginning, Sregion_beginning, 0, 0, 0,
@@ -484,21 +484,18 @@ If you set the marker not to point anywhere, the buffer 
will have no mark.  */)
 static ptrdiff_t
 overlays_around (EMACS_INT pos, Lisp_Object *vec, ptrdiff_t len)
 {
-  Lisp_Object overlay, start, end;
-  struct Lisp_Overlay *tail;
-  ptrdiff_t startpos, endpos;
   ptrdiff_t idx = 0;
 
-  for (tail = current_buffer->overlays_before; tail; tail = tail->next)
+  for (struct Lisp_Overlay *tail = current_buffer->overlays_before;
+       tail; tail = tail->next)
     {
-      XSETMISC (overlay, tail);
-
-      end = OVERLAY_END (overlay);
-      endpos = OVERLAY_POSITION (end);
+      Lisp_Object overlay = make_lisp_ptr (tail, Lisp_Vectorlike);
+      Lisp_Object end = OVERLAY_END (overlay);
+      ptrdiff_t endpos = OVERLAY_POSITION (end);
       if (endpos < pos)
          break;
-      start = OVERLAY_START (overlay);
-      startpos = OVERLAY_POSITION (start);
+      Lisp_Object start = OVERLAY_START (overlay);
+      ptrdiff_t startpos = OVERLAY_POSITION (start);
       if (startpos <= pos)
        {
          if (idx < len)
@@ -508,16 +505,16 @@ overlays_around (EMACS_INT pos, Lisp_Object *vec, 
ptrdiff_t len)
        }
     }
 
-  for (tail = current_buffer->overlays_after; tail; tail = tail->next)
+  for (struct Lisp_Overlay *tail = current_buffer->overlays_after;
+       tail; tail = tail->next)
     {
-      XSETMISC (overlay, tail);
-
-      start = OVERLAY_START (overlay);
-      startpos = OVERLAY_POSITION (start);
+      Lisp_Object overlay = make_lisp_ptr (tail, Lisp_Vectorlike);
+      Lisp_Object start = OVERLAY_START (overlay);
+      ptrdiff_t startpos = OVERLAY_POSITION (start);
       if (pos < startpos)
        break;
-      end = OVERLAY_END (overlay);
-      endpos = OVERLAY_POSITION (end);
+      Lisp_Object end = OVERLAY_END (overlay);
+      ptrdiff_t endpos = OVERLAY_POSITION (end);
       if (pos <= endpos)
        {
          if (idx < len)
@@ -539,7 +536,7 @@ i.e. the property that a char would inherit if it were 
inserted
 at POSITION.  */)
   (Lisp_Object position, register Lisp_Object prop, Lisp_Object object)
 {
-  CHECK_NUMBER_COERCE_MARKER (position);
+  CHECK_FIXNUM_COERCE_MARKER (position);
 
   if (NILP (object))
     XSETBUFFER (object, current_buffer);
@@ -553,7 +550,7 @@ at POSITION.  */)
     return Fget_text_property (position, prop, object);
   else
     {
-      EMACS_INT posn = XINT (position);
+      EMACS_INT posn = XFIXNUM (position);
       ptrdiff_t noverlays;
       Lisp_Object *overlay_vec, tem;
       struct buffer *obuf = current_buffer;
@@ -606,8 +603,8 @@ at POSITION.  */)
        if (stickiness > 0)
          return Fget_text_property (position, prop, object);
        else if (stickiness < 0
-                && XINT (position) > BUF_BEGV (XBUFFER (object)))
-         return Fget_text_property (make_number (XINT (position) - 1),
+                && XFIXNUM (position) > BUF_BEGV (XBUFFER (object)))
+         return Fget_text_property (make_fixnum (XFIXNUM (position) - 1),
                                     prop, object);
        else
          return Qnil;
@@ -650,13 +647,13 @@ find_field (Lisp_Object pos, Lisp_Object 
merge_at_boundary,
   if (NILP (pos))
     XSETFASTINT (pos, PT);
   else
-    CHECK_NUMBER_COERCE_MARKER (pos);
+    CHECK_FIXNUM_COERCE_MARKER (pos);
 
   after_field
     = get_char_property_and_overlay (pos, Qfield, Qnil, NULL);
   before_field
-    = (XFASTINT (pos) > BEGV
-       ? get_char_property_and_overlay (make_number (XINT (pos) - 1),
+    = (XFIXNAT (pos) > BEGV
+       ? get_char_property_and_overlay (make_fixnum (XFIXNUM (pos) - 1),
                                        Qfield, Qnil, NULL)
        /* Using nil here would be a more obvious choice, but it would
           fail when the buffer starts with a non-sticky field.  */
@@ -710,7 +707,7 @@ find_field (Lisp_Object pos, Lisp_Object merge_at_boundary,
       if (at_field_start)
        /* POS is at the edge of a field, and we should consider it as
           the beginning of the following field.  */
-       *beg = XFASTINT (pos);
+       *beg = XFIXNAT (pos);
       else
        /* Find the previous field boundary.  */
        {
@@ -722,7 +719,7 @@ find_field (Lisp_Object pos, Lisp_Object merge_at_boundary,
 
          p = Fprevious_single_char_property_change (p, Qfield, Qnil,
                                                     beg_limit);
-         *beg = NILP (p) ? BEGV : XFASTINT (p);
+         *beg = NILP (p) ? BEGV : XFIXNAT (p);
        }
     }
 
@@ -731,7 +728,7 @@ find_field (Lisp_Object pos, Lisp_Object merge_at_boundary,
       if (at_field_end)
        /* POS is at the edge of a field, and we should consider it as
           the end of the previous field.  */
-       *end = XFASTINT (pos);
+       *end = XFIXNAT (pos);
       else
        /* Find the next field boundary.  */
        {
@@ -742,7 +739,7 @@ find_field (Lisp_Object pos, Lisp_Object merge_at_boundary,
 
          pos = Fnext_single_char_property_change (pos, Qfield, Qnil,
                                                   end_limit);
-         *end = NILP (pos) ? ZV : XFASTINT (pos);
+         *end = NILP (pos) ? ZV : XFIXNAT (pos);
        }
     }
 }
@@ -795,7 +792,7 @@ is before LIMIT, then LIMIT will be returned instead.  */)
 {
   ptrdiff_t beg;
   find_field (pos, escape_from_edge, limit, &beg, Qnil, 0);
-  return make_number (beg);
+  return make_fixnum (beg);
 }
 
 DEFUN ("field-end", Ffield_end, Sfield_end, 0, 3, 0,
@@ -810,7 +807,7 @@ is after LIMIT, then LIMIT will be returned instead.  */)
 {
   ptrdiff_t end;
   find_field (pos, escape_from_edge, Qnil, 0, limit, &end);
-  return make_number (end);
+  return make_fixnum (end);
 }
 
 DEFUN ("constrain-to-field", Fconstrain_to_field, Sconstrain_to_field, 2, 5, 0,
@@ -856,13 +853,13 @@ Field boundaries are not noticed if 
`inhibit-field-text-motion' is non-nil.  */)
       XSETFASTINT (new_pos, PT);
     }
 
-  CHECK_NUMBER_COERCE_MARKER (new_pos);
-  CHECK_NUMBER_COERCE_MARKER (old_pos);
+  CHECK_FIXNUM_COERCE_MARKER (new_pos);
+  CHECK_FIXNUM_COERCE_MARKER (old_pos);
 
-  fwd = (XINT (new_pos) > XINT (old_pos));
+  fwd = (XFIXNUM (new_pos) > XFIXNUM (old_pos));
 
-  prev_old = make_number (XINT (old_pos) - 1);
-  prev_new = make_number (XINT (new_pos) - 1);
+  prev_old = make_fixnum (XFIXNUM (old_pos) - 1);
+  prev_new = make_fixnum (XFIXNUM (new_pos) - 1);
 
   if (NILP (Vinhibit_field_text_motion)
       && !EQ (new_pos, old_pos)
@@ -872,16 +869,16 @@ Field boundaries are not noticed if 
`inhibit-field-text-motion' is non-nil.  */)
              previous positions; we could use `Fget_pos_property'
              instead, but in itself that would fail inside non-sticky
              fields (like comint prompts).  */
-          || (XFASTINT (new_pos) > BEGV
+          || (XFIXNAT (new_pos) > BEGV
               && !NILP (Fget_char_property (prev_new, Qfield, Qnil)))
-          || (XFASTINT (old_pos) > BEGV
+          || (XFIXNAT (old_pos) > BEGV
               && !NILP (Fget_char_property (prev_old, Qfield, Qnil))))
       && (NILP (inhibit_capture_property)
           /* Field boundaries are again a problem; but now we must
              decide the case exactly, so we need to call
              `get_pos_property' as well.  */
           || (NILP (Fget_pos_property (old_pos, inhibit_capture_property, 
Qnil))
-              && (XFASTINT (old_pos) <= BEGV
+              && (XFIXNAT (old_pos) <= BEGV
                   || NILP (Fget_char_property
                           (old_pos, inhibit_capture_property, Qnil))
                   || NILP (Fget_char_property
@@ -901,7 +898,7 @@ Field boundaries are not noticed if 
`inhibit-field-text-motion' is non-nil.  */)
              other side of NEW_POS, which would mean that NEW_POS is
              already acceptable, and it's not necessary to constrain it
              to FIELD_BOUND.  */
-         ((XFASTINT (field_bound) < XFASTINT (new_pos)) ? fwd : !fwd)
+         ((XFIXNAT (field_bound) < XFIXNAT (new_pos)) ? fwd : !fwd)
          /* NEW_POS should be constrained, but only if either
             ONLY_IN_LINE is nil (in which case any constraint is OK),
             or NEW_POS and FIELD_BOUND are on the same line (in which
@@ -910,16 +907,16 @@ Field boundaries are not noticed if 
`inhibit-field-text-motion' is non-nil.  */)
              /* This is the ONLY_IN_LINE case, check that NEW_POS and
                 FIELD_BOUND are on the same line by seeing whether
                 there's an intervening newline or not.  */
-             || (find_newline (XFASTINT (new_pos), -1,
-                               XFASTINT (field_bound), -1,
+             || (find_newline (XFIXNAT (new_pos), -1,
+                               XFIXNAT (field_bound), -1,
                                fwd ? -1 : 1, &shortage, NULL, 1),
                  shortage != 0)))
        /* Constrain NEW_POS to FIELD_BOUND.  */
        new_pos = field_bound;
 
-      if (orig_point && XFASTINT (new_pos) != orig_point)
+      if (orig_point && XFIXNAT (new_pos) != orig_point)
        /* The NEW_POS argument was originally nil, so automatically set PT. */
-       SET_PT (XFASTINT (new_pos));
+       SET_PT (XFIXNAT (new_pos));
     }
 
   return new_pos;
@@ -950,13 +947,13 @@ This function does not move point.  */)
   if (NILP (n))
     XSETFASTINT (n, 1);
   else
-    CHECK_NUMBER (n);
+    CHECK_FIXNUM (n);
 
-  scan_newline_from_point (XINT (n) - 1, &charpos, &bytepos);
+  scan_newline_from_point (XFIXNUM (n) - 1, &charpos, &bytepos);
 
   /* Return END constrained to the current input field.  */
-  return Fconstrain_to_field (make_number (charpos), make_number (PT),
-                             XINT (n) != 1 ? Qt : Qnil,
+  return Fconstrain_to_field (make_fixnum (charpos), make_fixnum (PT),
+                             XFIXNUM (n) != 1 ? Qt : Qnil,
                              Qt, Qnil);
 }
 
@@ -985,14 +982,14 @@ This function does not move point.  */)
   if (NILP (n))
     XSETFASTINT (n, 1);
   else
-    CHECK_NUMBER (n);
+    CHECK_FIXNUM (n);
 
-  clipped_n = clip_to_bounds (PTRDIFF_MIN + 1, XINT (n), PTRDIFF_MAX);
+  clipped_n = clip_to_bounds (PTRDIFF_MIN + 1, XFIXNUM (n), PTRDIFF_MAX);
   end_pos = find_before_next_newline (orig, 0, clipped_n - (clipped_n <= 0),
                                      NULL);
 
   /* Return END_POS constrained to the current input field.  */
-  return Fconstrain_to_field (make_number (end_pos), make_number (orig),
+  return Fconstrain_to_field (make_fixnum (end_pos), make_fixnum (orig),
                              Qnil, Qt, Qnil);
 }
 
@@ -1034,7 +1031,7 @@ save_excursion_restore (Lisp_Object marker, Lisp_Object 
window)
       /* Set window point if WINDOW is live and shows the current buffer.  */
       Lisp_Object contents = XWINDOW (window)->contents;
       if (BUFFERP (contents) && XBUFFER (contents) == current_buffer)
-       Fset_window_point (window, make_number (PT));
+       Fset_window_point (window, make_fixnum (PT));
     }
 }
 
@@ -1088,11 +1085,11 @@ in some other BUFFER, use
   (Lisp_Object buffer)
 {
   if (NILP (buffer))
-    return make_number (Z - BEG);
+    return make_fixnum (Z - BEG);
   else
     {
       CHECK_BUFFER (buffer);
-      return make_number (BUF_Z (XBUFFER (buffer))
+      return make_fixnum (BUF_Z (XBUFFER (buffer))
                          - BUF_BEG (XBUFFER (buffer)));
     }
 }
@@ -1160,10 +1157,10 @@ DEFUN ("position-bytes", Fposition_bytes, 
Sposition_bytes, 1, 1, 0,
 If POSITION is out of range, the value is nil.  */)
   (Lisp_Object position)
 {
-  CHECK_NUMBER_COERCE_MARKER (position);
-  if (XINT (position) < BEG || XINT (position) > Z)
+  CHECK_FIXNUM_COERCE_MARKER (position);
+  if (XFIXNUM (position) < BEG || XFIXNUM (position) > Z)
     return Qnil;
-  return make_number (CHAR_TO_BYTE (XINT (position)));
+  return make_fixnum (CHAR_TO_BYTE (XFIXNUM (position)));
 }
 
 DEFUN ("byte-to-position", Fbyte_to_position, Sbyte_to_position, 1, 1, 0,
@@ -1173,8 +1170,8 @@ If BYTEPOS is out of range, the value is nil.  */)
 {
   ptrdiff_t pos_byte;
 
-  CHECK_NUMBER (bytepos);
-  pos_byte = XINT (bytepos);
+  CHECK_FIXNUM (bytepos);
+  pos_byte = XFIXNUM (bytepos);
   if (pos_byte < BEG_BYTE || pos_byte > Z_BYTE)
     return Qnil;
   if (Z != Z_BYTE)
@@ -1184,7 +1181,7 @@ If BYTEPOS is out of range, the value is nil.  */)
        character.  */
     while (!CHAR_HEAD_P (FETCH_BYTE (pos_byte)))
       pos_byte--;
-  return make_number (BYTE_TO_CHAR (pos_byte));
+  return make_fixnum (BYTE_TO_CHAR (pos_byte));
 }
 
 DEFUN ("following-char", Ffollowing_char, Sfollowing_char, 0, 0, 0,
@@ -1280,14 +1277,14 @@ If POS is out of range, the value is nil.  */)
     }
   else
     {
-      CHECK_NUMBER_COERCE_MARKER (pos);
-      if (XINT (pos) < BEGV || XINT (pos) >= ZV)
+      CHECK_FIXNUM_COERCE_MARKER (pos);
+      if (XFIXNUM (pos) < BEGV || XFIXNUM (pos) >= ZV)
        return Qnil;
 
-      pos_byte = CHAR_TO_BYTE (XINT (pos));
+      pos_byte = CHAR_TO_BYTE (XFIXNUM (pos));
     }
 
-  return make_number (FETCH_CHAR (pos_byte));
+  return make_fixnum (FETCH_CHAR (pos_byte));
 }
 
 DEFUN ("char-before", Fchar_before, Schar_before, 0, 1, 0,
@@ -1314,12 +1311,12 @@ If POS is out of range, the value is nil.  */)
     }
   else
     {
-      CHECK_NUMBER_COERCE_MARKER (pos);
+      CHECK_FIXNUM_COERCE_MARKER (pos);
 
-      if (XINT (pos) <= BEGV || XINT (pos) > ZV)
+      if (XFIXNUM (pos) <= BEGV || XFIXNUM (pos) > ZV)
        return Qnil;
 
-      pos_byte = CHAR_TO_BYTE (XINT (pos));
+      pos_byte = CHAR_TO_BYTE (XFIXNUM (pos));
     }
 
   if (!NILP (BVAR (current_buffer, enable_multibyte_characters)))
@@ -1432,7 +1429,7 @@ name, or nil if there is no such user.  */)
 
   if (NILP (uid))
     return Vuser_full_name;
-  else if (NUMBERP (uid))
+  else if (FIXED_OR_FLOATP (uid))
     {
       uid_t u;
       CONS_TO_INTEGER (uid, uid_t, u);
@@ -1463,7 +1460,7 @@ name, or nil if there is no such user.  */)
   /* Substitute the login name for the &, upcasing the first character.  */
   if (q)
     {
-      Lisp_Object login = Fuser_login_name (make_number (pw->pw_uid));
+      Lisp_Object login = Fuser_login_name (make_fixnum (pw->pw_uid));
       USE_SAFE_ALLOCA;
       char *r = SAFE_ALLOCA (strlen (p) + SBYTES (login) + 1);
       memcpy (r, p, q - p);
@@ -1605,14 +1602,14 @@ time_arith (Lisp_Object a, Lisp_Object b,
   switch (max (alen, blen))
     {
     default:
-      val = Fcons (make_number (t.ps), val);
+      val = Fcons (make_fixnum (t.ps), val);
       FALLTHROUGH;
     case 3:
-      val = Fcons (make_number (t.us), val);
+      val = Fcons (make_fixnum (t.us), val);
       FALLTHROUGH;
     case 2:
-      val = Fcons (make_number (t.lo), val);
-      val = Fcons (make_number (t.hi), val);
+      val = Fcons (make_fixnum (t.lo), val);
+      val = Fcons (make_fixnum (t.hi), val);
       break;
     }
 
@@ -1714,10 +1711,10 @@ disassemble_lisp_time (Lisp_Object specified_time, 
Lisp_Object *phigh,
                       Lisp_Object *plow, Lisp_Object *pusec,
                       Lisp_Object *ppsec)
 {
-  Lisp_Object high = make_number (0);
+  Lisp_Object high = make_fixnum (0);
   Lisp_Object low = specified_time;
-  Lisp_Object usec = make_number (0);
-  Lisp_Object psec = make_number (0);
+  Lisp_Object usec = make_fixnum (0);
+  Lisp_Object psec = make_fixnum (0);
   int len = 4;
 
   if (CONSP (specified_time))
@@ -1750,10 +1747,10 @@ disassemble_lisp_time (Lisp_Object specified_time, 
Lisp_Object *phigh,
 
       /* When combining components, require LOW to be an integer,
         as otherwise it would be a pain to add up times.  */
-      if (! INTEGERP (low))
+      if (! FIXNUMP (low))
        return 0;
     }
-  else if (INTEGERP (specified_time))
+  else if (FIXNUMP (specified_time))
     len = 2;
 
   *phigh = high;
@@ -1815,10 +1812,10 @@ decode_time_components (Lisp_Object high, Lisp_Object 
low, Lisp_Object usec,
                        struct lisp_time *result, double *dresult)
 {
   EMACS_INT hi, lo, us, ps;
-  if (! (INTEGERP (high)
-        && INTEGERP (usec) && INTEGERP (psec)))
+  if (! (FIXNUMP (high)
+        && FIXNUMP (usec) && FIXNUMP (psec)))
     return 0;
-  if (! INTEGERP (low))
+  if (! FIXNUMP (low))
     {
       if (FLOATP (low))
        {
@@ -1847,10 +1844,10 @@ decode_time_components (Lisp_Object high, Lisp_Object 
low, Lisp_Object usec,
        return 0;
     }
 
-  hi = XINT (high);
-  lo = XINT (low);
-  us = XINT (usec);
-  ps = XINT (psec);
+  hi = XFIXNUM (high);
+  lo = XFIXNUM (low);
+  us = XFIXNUM (usec);
+  ps = XFIXNUM (psec);
 
   /* Normalize out-of-range lower-order components by carrying
      each overflow into the next higher-order component.  */
@@ -1933,8 +1930,8 @@ lisp_seconds_argument (Lisp_Object specified_time)
   int val = disassemble_lisp_time (specified_time, &high, &low, &usec, &psec);
   if (val != 0)
     {
-      val = decode_time_components (high, low, make_number (0),
-                                   make_number (0), &t, 0);
+      val = decode_time_components (high, low, make_fixnum (0),
+                                   make_fixnum (0), &t, 0);
       if (0 < val
          && ! ((TYPE_SIGNED (time_t)
                 ? TIME_T_MIN >> LO_TIME_BITS <= t.hi
@@ -2186,18 +2183,18 @@ usage: (decode-time &optional TIME ZONE)  */)
   EMACS_INT tm_year_base = TM_YEAR_BASE;
 
   return CALLN (Flist,
-               make_number (local_tm.tm_sec),
-               make_number (local_tm.tm_min),
-               make_number (local_tm.tm_hour),
-               make_number (local_tm.tm_mday),
-               make_number (local_tm.tm_mon + 1),
-               make_number (local_tm.tm_year + tm_year_base),
-               make_number (local_tm.tm_wday),
+               make_fixnum (local_tm.tm_sec),
+               make_fixnum (local_tm.tm_min),
+               make_fixnum (local_tm.tm_hour),
+               make_fixnum (local_tm.tm_mday),
+               make_fixnum (local_tm.tm_mon + 1),
+               make_fixnum (local_tm.tm_year + tm_year_base),
+               make_fixnum (local_tm.tm_wday),
                local_tm.tm_isdst ? Qt : Qnil,
                (HAVE_TM_GMTOFF
-                ? make_number (tm_gmtoff (&local_tm))
+                ? make_fixnum (tm_gmtoff (&local_tm))
                 : gmtime_r (&time_spec, &gmt_tm)
-                ? make_number (tm_diff (&local_tm, &gmt_tm))
+                ? make_fixnum (tm_diff (&local_tm, &gmt_tm))
                 : Qnil));
 }
 
@@ -2206,8 +2203,8 @@ usage: (decode-time &optional TIME ZONE)  */)
 static int
 check_tm_member (Lisp_Object obj, int offset)
 {
-  CHECK_NUMBER (obj);
-  EMACS_INT n = XINT (obj);
+  CHECK_FIXNUM (obj);
+  EMACS_INT n = XFIXNUM (obj);
   int result;
   if (INT_SUBTRACT_WRAPV (n, offset, &result))
     time_overflow ();
@@ -2389,7 +2386,7 @@ the data it can't find.  */)
       long int offset = (HAVE_TM_GMTOFF
                         ? tm_gmtoff (&local_tm)
                         : tm_diff (&local_tm, &gmt_tm));
-      zone_offset = make_number (offset);
+      zone_offset = make_fixnum (offset);
       if (SCHARS (zone_name) == 0)
        {
          /* No local time zone name is available; use numeric zone instead.  */
@@ -2532,7 +2529,7 @@ general_insert_function (void (*insert_func)
       val = args[argnum];
       if (CHARACTERP (val))
        {
-         int c = XFASTINT (val);
+         int c = XFIXNAT (val);
          unsigned char str[MAX_MULTIBYTE_LENGTH];
          int len;
 
@@ -2688,18 +2685,18 @@ called interactively, INHERIT is t.  */)
   CHECK_CHARACTER (character);
   if (NILP (count))
     XSETFASTINT (count, 1);
-  CHECK_NUMBER (count);
-  c = XFASTINT (character);
+  CHECK_FIXNUM (count);
+  c = XFIXNAT (character);
 
   if (!NILP (BVAR (current_buffer, enable_multibyte_characters)))
     len = CHAR_STRING (c, str);
   else
     str[0] = c, len = 1;
-  if (XINT (count) <= 0)
+  if (XFIXNUM (count) <= 0)
     return Qnil;
-  if (BUF_BYTES_MAX / len < XINT (count))
+  if (BUF_BYTES_MAX / len < XFIXNUM (count))
     buffer_overflow ();
-  n = XINT (count) * len;
+  n = XFIXNUM (count) * len;
   stringlen = min (n, sizeof string - sizeof string % len);
   for (i = 0; i < stringlen; i++)
     string[i] = str[i % len];
@@ -2732,12 +2729,12 @@ The optional third arg INHERIT, if non-nil, says to 
inherit text properties
 from adjoining text, if those properties are sticky.  */)
   (Lisp_Object byte, Lisp_Object count, Lisp_Object inherit)
 {
-  CHECK_NUMBER (byte);
-  if (XINT (byte) < 0 || XINT (byte) > 255)
-    args_out_of_range_3 (byte, make_number (0), make_number (255));
-  if (XINT (byte) >= 128
+  CHECK_FIXNUM (byte);
+  if (XFIXNUM (byte) < 0 || XFIXNUM (byte) > 255)
+    args_out_of_range_3 (byte, make_fixnum (0), make_fixnum (255));
+  if (XFIXNUM (byte) >= 128
       && ! NILP (BVAR (current_buffer, enable_multibyte_characters)))
-    XSETFASTINT (byte, BYTE8_TO_CHAR (XINT (byte)));
+    XSETFASTINT (byte, BYTE8_TO_CHAR (XFIXNUM (byte)));
   return Finsert_char (byte, count, inherit);
 }
 
@@ -2820,10 +2817,10 @@ make_buffer_string_both (ptrdiff_t start, ptrdiff_t 
start_byte,
     {
       update_buffer_properties (start, end);
 
-      tem = Fnext_property_change (make_number (start), Qnil, make_number 
(end));
-      tem1 = Ftext_properties_at (make_number (start), Qnil);
+      tem = Fnext_property_change (make_fixnum (start), Qnil, make_fixnum 
(end));
+      tem1 = Ftext_properties_at (make_fixnum (start), Qnil);
 
-      if (XINT (tem) != end || !NILP (tem1))
+      if (XFIXNUM (tem) != end || !NILP (tem1))
        copy_intervals_to_string (result, current_buffer, start,
                                  end - start);
     }
@@ -2846,7 +2843,7 @@ update_buffer_properties (ptrdiff_t start, ptrdiff_t end)
       if (!NILP (Vbuffer_access_fontified_property))
        {
          Lisp_Object tem
-           = Ftext_property_any (make_number (start), make_number (end),
+           = Ftext_property_any (make_fixnum (start), make_fixnum (end),
                                  Vbuffer_access_fontified_property,
                                  Qnil, Qnil);
          if (NILP (tem))
@@ -2854,7 +2851,7 @@ update_buffer_properties (ptrdiff_t start, ptrdiff_t end)
        }
 
       CALLN (Frun_hook_with_args, Qbuffer_access_fontify_functions,
-            make_number (start), make_number (end));
+            make_fixnum (start), make_fixnum (end));
     }
 }
 
@@ -2872,8 +2869,8 @@ use `buffer-substring-no-properties' instead.  */)
   register ptrdiff_t b, e;
 
   validate_region (&start, &end);
-  b = XINT (start);
-  e = XINT (end);
+  b = XFIXNUM (start);
+  e = XFIXNUM (end);
 
   return make_buffer_string (b, e, 1);
 }
@@ -2888,8 +2885,8 @@ they can be in either order.  */)
   register ptrdiff_t b, e;
 
   validate_region (&start, &end);
-  b = XINT (start);
-  e = XINT (end);
+  b = XFIXNUM (start);
+  e = XFIXNUM (end);
 
   return make_buffer_string (b, e, 0);
 }
@@ -2934,15 +2931,15 @@ using `string-make-multibyte' or `string-make-unibyte', 
which see.  */)
     b = BUF_BEGV (bp);
   else
     {
-      CHECK_NUMBER_COERCE_MARKER (start);
-      b = XINT (start);
+      CHECK_FIXNUM_COERCE_MARKER (start);
+      b = XFIXNUM (start);
     }
   if (NILP (end))
     e = BUF_ZV (bp);
   else
     {
-      CHECK_NUMBER_COERCE_MARKER (end);
-      e = XINT (end);
+      CHECK_FIXNUM_COERCE_MARKER (end);
+      e = XFIXNUM (end);
     }
 
   if (b > e)
@@ -3002,15 +2999,15 @@ determines whether case is significant or ignored.  */)
     begp1 = BUF_BEGV (bp1);
   else
     {
-      CHECK_NUMBER_COERCE_MARKER (start1);
-      begp1 = XINT (start1);
+      CHECK_FIXNUM_COERCE_MARKER (start1);
+      begp1 = XFIXNUM (start1);
     }
   if (NILP (end1))
     endp1 = BUF_ZV (bp1);
   else
     {
-      CHECK_NUMBER_COERCE_MARKER (end1);
-      endp1 = XINT (end1);
+      CHECK_FIXNUM_COERCE_MARKER (end1);
+      endp1 = XFIXNUM (end1);
     }
 
   if (begp1 > endp1)
@@ -3040,15 +3037,15 @@ determines whether case is significant or ignored.  */)
     begp2 = BUF_BEGV (bp2);
   else
     {
-      CHECK_NUMBER_COERCE_MARKER (start2);
-      begp2 = XINT (start2);
+      CHECK_FIXNUM_COERCE_MARKER (start2);
+      begp2 = XFIXNUM (start2);
     }
   if (NILP (end2))
     endp2 = BUF_ZV (bp2);
   else
     {
-      CHECK_NUMBER_COERCE_MARKER (end2);
-      endp2 = XINT (end2);
+      CHECK_FIXNUM_COERCE_MARKER (end2);
+      endp2 = XFIXNUM (end2);
     }
 
   if (begp2 > endp2)
@@ -3103,7 +3100,7 @@ determines whether case is significant or ignored.  */)
        }
 
       if (c1 != c2)
-       return make_number (c1 < c2 ? -1 - chars : chars + 1);
+       return make_fixnum (c1 < c2 ? -1 - chars : chars + 1);
 
       chars++;
       rarely_quit (chars);
@@ -3112,12 +3109,12 @@ determines whether case is significant or ignored.  */)
   /* The strings match as far as they go.
      If one is shorter, that one is less.  */
   if (chars < endp1 - begp1)
-    return make_number (chars + 1);
+    return make_fixnum (chars + 1);
   else if (chars < endp2 - begp2)
-    return make_number (- chars - 1);
+    return make_fixnum (- chars - 1);
 
   /* Same length too => they are equal.  */
-  return make_number (0);
+  return make_fixnum (0);
 }
 
 
@@ -3298,8 +3295,8 @@ differences between the two buffers.  */)
           if (beg_b < end_b)
             {
               SET_PT (beg_a);
-              Finsert_buffer_substring (source, make_natnum (beg_b),
-                                        make_natnum (end_b));
+              Finsert_buffer_substring (source, make_fixed_natnum (beg_b),
+                                        make_fixed_natnum (end_b));
             }
        }
       --i;
@@ -3426,8 +3423,8 @@ Both characters must have the same length of multi-byte 
form.  */)
   validate_region (&start, &end);
   CHECK_CHARACTER (fromchar);
   CHECK_CHARACTER (tochar);
-  fromc = XFASTINT (fromchar);
-  toc = XFASTINT (tochar);
+  fromc = XFIXNAT (fromchar);
+  toc = XFIXNAT (tochar);
 
   if (multibyte_p)
     {
@@ -3453,9 +3450,9 @@ Both characters must have the same length of multi-byte 
form.  */)
       tostr[0] = toc;
     }
 
-  pos = XINT (start);
+  pos = XFIXNUM (start);
   pos_byte = CHAR_TO_BYTE (pos);
-  stop = CHAR_TO_BYTE (XINT (end));
+  stop = CHAR_TO_BYTE (XFIXNUM (end));
   end_byte = stop;
 
   /* If we don't want undo, turn off putting stuff on the list.
@@ -3503,7 +3500,7 @@ Both characters must have the same length of multi-byte 
form.  */)
          else if (!changed)
            {
              changed = -1;
-             modify_text (pos, XINT (end));
+             modify_text (pos, XFIXNUM (end));
 
              if (! NILP (noundo))
                {
@@ -3626,7 +3623,7 @@ check_translation (ptrdiff_t pos, ptrdiff_t pos_byte, 
ptrdiff_t end,
                  buf[buf_used++] = STRING_CHAR_AND_LENGTH (p, len1);
                  pos_byte += len1;
                }
-             if (XINT (AREF (elt, i)) != buf[i])
+             if (XFIXNUM (AREF (elt, i)) != buf[i])
                break;
            }
          if (i == len)
@@ -3678,9 +3675,9 @@ It returns the number of characters changed.  */)
       tt = SDATA (table);
     }
 
-  pos = XINT (start);
+  pos = XFIXNUM (start);
   pos_byte = CHAR_TO_BYTE (pos);
-  end_pos = XINT (end);
+  end_pos = XFIXNUM (end);
   modify_text (pos, end_pos);
 
   cnt = 0;
@@ -3729,7 +3726,7 @@ It returns the number of characters changed.  */)
              val = CHAR_TABLE_REF (table, oc);
              if (CHARACTERP (val))
                {
-                 nc = XFASTINT (val);
+                 nc = XFIXNAT (val);
                  str_len = CHAR_STRING (nc, buf);
                  str = buf;
                }
@@ -3790,7 +3787,7 @@ It returns the number of characters changed.  */)
                }
              else
                {
-                 string = Fmake_string (make_number (1), val, Qnil);
+                 string = Fmake_string (make_fixnum (1), val, Qnil);
                }
              replace_range (pos, pos + len, string, 1, 0, 1, 0);
              pos_byte += SBYTES (string);
@@ -3804,7 +3801,7 @@ It returns the number of characters changed.  */)
       pos++;
     }
 
-  return make_number (cnt);
+  return make_fixnum (cnt);
 }
 
 DEFUN ("delete-region", Fdelete_region, Sdelete_region, 2, 2, "r",
@@ -3814,7 +3811,7 @@ This command deletes buffer text without modifying the 
kill ring.  */)
   (Lisp_Object start, Lisp_Object end)
 {
   validate_region (&start, &end);
-  del_range (XINT (start), XINT (end));
+  del_range (XFIXNUM (start), XFIXNUM (end));
   return Qnil;
 }
 
@@ -3824,9 +3821,9 @@ DEFUN ("delete-and-extract-region", 
Fdelete_and_extract_region,
   (Lisp_Object start, Lisp_Object end)
 {
   validate_region (&start, &end);
-  if (XINT (start) == XINT (end))
+  if (XFIXNUM (start) == XFIXNUM (end))
     return empty_unibyte_string;
-  return del_range_1 (XINT (start), XINT (end), 1, 1);
+  return del_range_1 (XFIXNUM (start), XFIXNUM (end), 1, 1);
 }
 
 DEFUN ("widen", Fwiden, Swiden, 0, 0, "",
@@ -3855,27 +3852,27 @@ When calling from a program, pass two arguments; 
positions (integers
 or markers) bounding the text that should remain visible.  */)
   (register Lisp_Object start, Lisp_Object end)
 {
-  CHECK_NUMBER_COERCE_MARKER (start);
-  CHECK_NUMBER_COERCE_MARKER (end);
+  CHECK_FIXNUM_COERCE_MARKER (start);
+  CHECK_FIXNUM_COERCE_MARKER (end);
 
-  if (XINT (start) > XINT (end))
+  if (XFIXNUM (start) > XFIXNUM (end))
     {
       Lisp_Object tem;
       tem = start; start = end; end = tem;
     }
 
-  if (!(BEG <= XINT (start) && XINT (start) <= XINT (end) && XINT (end) <= Z))
+  if (!(BEG <= XFIXNUM (start) && XFIXNUM (start) <= XFIXNUM (end) && XFIXNUM 
(end) <= Z))
     args_out_of_range (start, end);
 
-  if (BEGV != XFASTINT (start) || ZV != XFASTINT (end))
+  if (BEGV != XFIXNAT (start) || ZV != XFIXNAT (end))
     current_buffer->clip_changed = 1;
 
-  SET_BUF_BEGV (current_buffer, XFASTINT (start));
-  SET_BUF_ZV (current_buffer, XFASTINT (end));
-  if (PT < XFASTINT (start))
-    SET_PT (XFASTINT (start));
-  if (PT > XFASTINT (end))
-    SET_PT (XFASTINT (end));
+  SET_BUF_BEGV (current_buffer, XFIXNAT (start));
+  SET_BUF_ZV (current_buffer, XFIXNAT (end));
+  if (PT < XFIXNAT (start))
+    SET_PT (XFIXNAT (start));
+  if (PT > XFIXNAT (end))
+    SET_PT (XFIXNAT (end));
   /* Changing the buffer bounds invalidates any recorded current column.  */
   invalidate_current_column ();
   return Qnil;
@@ -4121,8 +4118,8 @@ usage: (propertize STRING &rest PROPERTIES)  */)
   for (i = 1; i < nargs; i += 2)
     properties = Fcons (args[i], Fcons (args[i + 1], properties));
 
-  Fadd_text_properties (make_number (0),
-                       make_number (SCHARS (string)),
+  Fadd_text_properties (make_fixnum (0),
+                       make_fixnum (SCHARS (string)),
                        properties, string);
   return string;
 }
@@ -4268,6 +4265,9 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool 
message)
     /* The start and end bytepos in the output string.  */
     ptrdiff_t start, end;
 
+    /* The start of the spec in the format string.  */
+    ptrdiff_t fbeg;
+
     /* Whether the argument is a string with intervals.  */
     bool_bf intervals : 1;
   } *info;
@@ -4421,6 +4421,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool 
message)
          char conversion = *format++;
          memset (&discarded[format0 - format_start], 1,
                  format - format0 - (conversion == '%'));
+         info[ispec].fbeg = format0 - format_start;
          if (conversion == '%')
            {
              new_result = true;
@@ -4462,7 +4463,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool 
message)
            }
          else if (conversion == 'c')
            {
-             if (INTEGERP (arg) && ! ASCII_CHAR_P (XINT (arg)))
+             if (FIXNUMP (arg) && ! ASCII_CHAR_P (XFIXNUM (arg)))
                {
                  if (!multibyte)
                    {
@@ -4476,6 +4477,25 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool 
message)
                conversion = 's';
              zero_flag = false;
            }
+         else if ((conversion == 'd' || conversion == 'i'
+                   || conversion == 'o' || conversion == 'x'
+                   || conversion == 'X')
+                  && BIGNUMP (arg))
+           {
+             int base = 10;
+
+             if (conversion == 'o')
+               base = 8;
+             else if (conversion == 'x')
+               base = 16;
+             else if (conversion == 'X')
+               base = -16;
+
+             char *str = mpz_get_str (NULL, base, XBIGNUM (arg)->value);
+             arg = make_unibyte_string (str, strlen (str));
+             xfree (str);
+             conversion = 's';
+           }
 
          if (SYMBOLP (arg))
            {
@@ -4587,7 +4607,8 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool 
message)
                      || conversion == 'X'))
            error ("Invalid format operation %%%c",
                   STRING_CHAR ((unsigned char *) format - 1));
-         else if (! (INTEGERP (arg) || (FLOATP (arg) && conversion != 'c')))
+         else if (! (FIXNUMP (arg) || ((BIGNUMP (arg) || FLOATP (arg))
+                                       && conversion != 'c')))
            error ("Format specifier doesn't match argument type");
          else
            {
@@ -4648,7 +4669,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool 
message)
                  if (INT_AS_LDBL)
                    {
                      *f = 'L';
-                     f += INTEGERP (arg);
+                     f += FIXNUMP (arg);
                    }
                }
              else if (conversion != 'c')
@@ -4679,12 +4700,12 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool 
message)
              ptrdiff_t sprintf_bytes;
              if (float_conversion)
                {
-                 if (INT_AS_LDBL && INTEGERP (arg))
+                 if (INT_AS_LDBL && FIXNUMP (arg))
                    {
                      /* Although long double may have a rounding error if
                         DIG_BITS_LBOUND * LDBL_MANT_DIG < FIXNUM_BITS - 1,
                         it is more accurate than plain 'double'.  */
-                     long double x = XINT (arg);
+                     long double x = XFIXNUM (arg);
                      sprintf_bytes = sprintf (sprintf_buf, convspec, prec, x);
                    }
                  else
@@ -4694,15 +4715,15 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool 
message)
              else if (conversion == 'c')
                {
                  /* Don't use sprintf here, as it might mishandle prec.  */
-                 sprintf_buf[0] = XINT (arg);
+                 sprintf_buf[0] = XFIXNUM (arg);
                  sprintf_bytes = prec != 0;
                  sprintf_buf[sprintf_bytes] = '\0';
                }
              else if (conversion == 'd' || conversion == 'i')
                {
-                 if (INTEGERP (arg))
+                 if (FIXNUMP (arg))
                    {
-                     printmax_t x = XINT (arg);
+                     printmax_t x = XFIXNUM (arg);
                      sprintf_bytes = sprintf (sprintf_buf, convspec, prec, x);
                    }
                  else
@@ -4729,12 +4750,12 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool 
message)
                    {
                      if (binary_as_unsigned)
                        {
-                         x = XUINT (arg);
+                         x = XUFIXNUM (arg);
                          negative = false;
                        }
                      else
                        {
-                         EMACS_INT i = XINT (arg);
+                         EMACS_INT i = XFIXNUM (arg);
                          negative = i < 0;
                          x = negative ? -i : i;
                        }
@@ -4975,8 +4996,8 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool 
message)
   if (string_intervals (args[0]) || arg_intervals)
     {
       /* Add text properties from the format string.  */
-      Lisp_Object len = make_number (SCHARS (args[0]));
-      Lisp_Object props = text_property_list (args[0], make_number (0),
+      Lisp_Object len = make_fixnum (SCHARS (args[0]));
+      Lisp_Object props = text_property_list (args[0], make_fixnum (0),
                                              len, Qnil);
       if (CONSP (props))
        {
@@ -5000,7 +5021,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool 
message)
              Lisp_Object item = XCAR (list);
 
              /* First adjust the property start position.  */
-             ptrdiff_t pos = XINT (XCAR (item));
+             ptrdiff_t pos = XFIXNUM (XCAR (item));
 
              /* Advance BYTEPOS, POSITION, TRANSLATED and ARGN
                 up to this position.  */
@@ -5011,7 +5032,9 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool 
message)
                  else if (discarded[bytepos] == 1)
                    {
                      position++;
-                     if (fieldn < nspec && translated == info[fieldn].start)
+                     if (fieldn < nspec
+                         && position > info[fieldn].fbeg
+                         && translated == info[fieldn].start)
                        {
                          translated += info[fieldn].end - info[fieldn].start;
                          fieldn++;
@@ -5019,10 +5042,10 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool 
message)
                    }
                }
 
-             XSETCAR (item, make_number (translated));
+             XSETCAR (item, make_fixnum (translated));
 
              /* Likewise adjust the property end position.  */
-             pos = XINT (XCAR (XCDR (item)));
+             pos = XFIXNUM (XCAR (XCDR (item)));
 
              for (; position < pos; bytepos++)
                {
@@ -5031,7 +5054,9 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool 
message)
                  else if (discarded[bytepos] == 1)
                    {
                      position++;
-                     if (fieldn < nspec && translated == info[fieldn].start)
+                     if (fieldn < nspec
+                         && position > info[fieldn].fbeg
+                         && translated == info[fieldn].start)
                        {
                          translated += info[fieldn].end - info[fieldn].start;
                          fieldn++;
@@ -5039,10 +5064,10 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool 
message)
                    }
                }
 
-             XSETCAR (XCDR (item), make_number (translated));
+             XSETCAR (XCDR (item), make_fixnum (translated));
            }
 
-         add_text_properties_from_list (val, props, make_number (0));
+         add_text_properties_from_list (val, props, make_fixnum (0));
        }
 
       /* Add text properties from arguments.  */
@@ -5050,17 +5075,17 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool 
message)
        for (ptrdiff_t i = 0; i < nspec; i++)
          if (info[i].intervals)
            {
-             len = make_number (SCHARS (info[i].argument));
-             Lisp_Object new_len = make_number (info[i].end - info[i].start);
+             len = make_fixnum (SCHARS (info[i].argument));
+             Lisp_Object new_len = make_fixnum (info[i].end - info[i].start);
              props = text_property_list (info[i].argument,
-                                          make_number (0), len, Qnil);
+                                          make_fixnum (0), len, Qnil);
              props = extend_property_ranges (props, len, new_len);
              /* If successive arguments have properties, be sure that
                 the value of `composition' property be the copy.  */
              if (1 < i && info[i - 1].end)
                make_composition_value_copy (props);
              add_text_properties_from_list (val, props,
-                                            make_number (info[i].start));
+                                            make_fixnum (info[i].start));
            }
     }
 
@@ -5083,13 +5108,13 @@ Case is ignored if `case-fold-search' is non-nil in the 
current buffer.  */)
   CHECK_CHARACTER (c1);
   CHECK_CHARACTER (c2);
 
-  if (XINT (c1) == XINT (c2))
+  if (XFIXNUM (c1) == XFIXNUM (c2))
     return Qt;
   if (NILP (BVAR (current_buffer, case_fold_search)))
     return Qnil;
 
-  i1 = XFASTINT (c1);
-  i2 = XFASTINT (c2);
+  i1 = XFIXNAT (c1);
+  i2 = XFIXNAT (c2);
 
   /* FIXME: It is possible to compare multibyte characters even when
      the current buffer is unibyte.  Unfortunately this is ambiguous
@@ -5233,10 +5258,10 @@ ring.  */)
   validate_region (&startr1, &endr1);
   validate_region (&startr2, &endr2);
 
-  start1 = XFASTINT (startr1);
-  end1 = XFASTINT (endr1);
-  start2 = XFASTINT (startr2);
-  end2 = XFASTINT (endr2);
+  start1 = XFIXNAT (startr1);
+  end1 = XFIXNAT (endr1);
+  start2 = XFIXNAT (startr2);
+  end2 = XFIXNAT (endr2);
   gap = GPT;
 
   /* Swap the regions if they're reversed.  */
diff --git a/src/emacs-module.c b/src/emacs-module.c
index 5b9f662..e7ba174 100644
--- a/src/emacs-module.c
+++ b/src/emacs-module.c
@@ -302,15 +302,15 @@ module_make_global_ref (emacs_env *env, emacs_value ref)
   if (i >= 0)
     {
       Lisp_Object value = HASH_VALUE (h, i);
-      EMACS_INT refcount = XFASTINT (value) + 1;
+      EMACS_INT refcount = XFIXNAT (value) + 1;
       if (MOST_POSITIVE_FIXNUM < refcount)
        xsignal0 (Qoverflow_error);
-      value = make_natnum (refcount);
+      value = make_fixed_natnum (refcount);
       set_hash_value_slot (h, i, value);
     }
   else
     {
-      hash_put (h, new_obj, make_natnum (1), hashcode);
+      hash_put (h, new_obj, make_fixed_natnum (1), hashcode);
     }
 
   return lisp_to_value (module_assertions ? global_env : env, new_obj);
@@ -329,9 +329,9 @@ module_free_global_ref (emacs_env *env, emacs_value ref)
 
   if (i >= 0)
     {
-      EMACS_INT refcount = XFASTINT (HASH_VALUE (h, i)) - 1;
+      EMACS_INT refcount = XFIXNAT (HASH_VALUE (h, i)) - 1;
       if (refcount > 0)
-        set_hash_value_slot (h, i, make_natnum (refcount));
+        set_hash_value_slot (h, i, make_fixed_natnum (refcount));
       else
         {
           eassert (refcount == 0);
@@ -441,7 +441,7 @@ module_make_function (emacs_env *env, ptrdiff_t min_arity, 
ptrdiff_t max_arity,
             ? (min_arity <= MOST_POSITIVE_FIXNUM
                && max_arity == emacs_variadic_function)
             : min_arity <= max_arity && max_arity <= MOST_POSITIVE_FIXNUM)))
-    xsignal2 (Qinvalid_arity, make_number (min_arity), make_number 
(max_arity));
+    xsignal2 (Qinvalid_arity, make_fixnum (min_arity), make_fixnum 
(max_arity));
 
   struct Lisp_Module_Function *function = allocate_module_function ();
   function->min_arity = min_arity;
@@ -518,17 +518,32 @@ module_extract_integer (emacs_env *env, emacs_value n)
 {
   MODULE_FUNCTION_BEGIN (0);
   Lisp_Object l = value_to_lisp (n);
-  CHECK_NUMBER (l);
-  return XINT (l);
+  CHECK_INTEGER (l);
+  if (BIGNUMP (l))
+    {
+      if (!mpz_fits_slong_p (XBIGNUM (l)->value))
+       xsignal1 (Qoverflow_error, l);
+      return mpz_get_si (XBIGNUM (l)->value);
+    }
+  return XFIXNUM (l);
 }
 
 static emacs_value
 module_make_integer (emacs_env *env, intmax_t n)
 {
+  Lisp_Object obj;
   MODULE_FUNCTION_BEGIN (module_nil);
   if (FIXNUM_OVERFLOW_P (n))
-    xsignal0 (Qoverflow_error);
-  return lisp_to_value (env, make_number (n));
+    {
+      mpz_t val;
+      mpz_init (val);
+      mpz_set_intmax (val, n);
+      obj = make_number (val);
+      mpz_clear (val);
+    }
+  else
+    obj = make_fixnum (n);
+  return lisp_to_value (env, obj);
 }
 
 static double
@@ -640,7 +655,7 @@ check_vec_index (Lisp_Object lvec, ptrdiff_t i)
   CHECK_VECTOR (lvec);
   if (! (0 <= i && i < ASIZE (lvec)))
     args_out_of_range_3 (make_fixnum_or_float (i),
-                        make_number (0), make_number (ASIZE (lvec) - 1));
+                        make_fixnum (0), make_fixnum (ASIZE (lvec) - 1));
 }
 
 static void
@@ -749,7 +764,7 @@ DEFUN ("module-load", Fmodule_load, Smodule_load, 1, 1, 0,
     {
       if (FIXNUM_OVERFLOW_P (r))
         xsignal0 (Qoverflow_error);
-      xsignal2 (Qmodule_init_failed, file, make_number (r));
+      xsignal2 (Qmodule_init_failed, file, make_fixnum (r));
     }
 
   module_signal_or_throw (&env_priv);
@@ -763,7 +778,7 @@ funcall_module (Lisp_Object function, ptrdiff_t nargs, 
Lisp_Object *arglist)
   eassume (0 <= func->min_arity);
   if (! (func->min_arity <= nargs
         && (func->max_arity < 0 || nargs <= func->max_arity)))
-    xsignal2 (Qwrong_number_of_arguments, function, make_number (nargs));
+    xsignal2 (Qwrong_number_of_arguments, function, make_fixnum (nargs));
 
   emacs_env pub;
   struct emacs_env_private priv;
@@ -802,8 +817,8 @@ module_function_arity (const struct Lisp_Module_Function 
*const function)
 {
   ptrdiff_t minargs = function->min_arity;
   ptrdiff_t maxargs = function->max_arity;
-  return Fcons (make_number (minargs),
-               maxargs == MANY ? Qmany : make_number (maxargs));
+  return Fcons (make_fixnum (minargs),
+               maxargs == MANY ? Qmany : make_fixnum (maxargs));
 }
 
 
@@ -991,7 +1006,7 @@ lisp_to_value_bits (Lisp_Object o)
 
   /* Compress O into the space of a pointer, possibly losing information.  */
   EMACS_UINT u = XLI (o);
-  if (INTEGERP (o))
+  if (FIXNUMP (o))
     {
       uintptr_t i = (u << VALBITS) + XTYPE (o);
       return (emacs_value) i;
diff --git a/src/emacs.c b/src/emacs.c
index 7304bc4..11ee0b8 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -377,7 +377,7 @@ terminate_due_to_signal (int sig, int backtrace_limit)
 
           totally_unblock_input ();
           if (sig == SIGTERM || sig == SIGHUP || sig == SIGINT)
-            Fkill_emacs (make_number (sig));
+            Fkill_emacs (make_fixnum (sig));
 
           shut_down_emacs (sig, Qnil);
           emacs_backtrace (backtrace_limit);
@@ -446,7 +446,7 @@ init_cmdargs (int argc, char **argv, int skip_args, char 
*original_pwd)
     {
       Lisp_Object found;
       int yes = openp (Vexec_path, Vinvocation_name,
-                      Vexec_suffixes, &found, make_number (X_OK), false);
+                      Vexec_suffixes, &found, make_fixnum (X_OK), false);
       if (yes == 1)
        {
          /* Add /: to the front of the name
@@ -673,6 +673,38 @@ close_output_streams (void)
     _exit (EXIT_FAILURE);
 }
 
+/* Memory allocation functions for GMP.  */
+
+static void
+check_bignum_size (size_t size)
+{
+  /* Do not create a bignum whose log base 2 could exceed fixnum range.
+     This way, functions like mpz_popcount return values in fixnum range.
+     It may also help to avoid other problems with outlandish bignums.  */
+  if (MOST_POSITIVE_FIXNUM / CHAR_BIT < size)
+    error ("Integer too large to be represented");
+}
+
+static void * ATTRIBUTE_MALLOC
+xmalloc_for_gmp (size_t size)
+{
+  check_bignum_size (size);
+  return xmalloc (size);
+}
+
+static void *
+xrealloc_for_gmp (void *ptr, size_t ignore, size_t size)
+{
+  check_bignum_size (size);
+  return xrealloc (ptr, size);
+}
+
+static void
+xfree_for_gmp (void *ptr, size_t ignore)
+{
+  xfree (ptr);
+}
+
 /* ARGSUSED */
 int
 main (int argc, char **argv)
@@ -771,6 +803,8 @@ main (int argc, char **argv)
   init_standard_fds ();
   atexit (close_output_streams);
 
+  mp_set_memory_functions (xmalloc_for_gmp, xrealloc_for_gmp, xfree_for_gmp);
+
   sort_args (argc, argv);
   argc = 0;
   while (argv[argc]) argc++;
@@ -2052,10 +2086,10 @@ all of which are called before Emacs is actually 
killed.  */
       unlink (SSDATA (listfile));
     }
 
-  if (INTEGERP (arg))
-    exit_code = (XINT (arg) < 0
-                ? XINT (arg) | INT_MIN
-                : XINT (arg) & INT_MAX);
+  if (FIXNUMP (arg))
+    exit_code = (XFIXNUM (arg) < 0
+                ? XFIXNUM (arg) | INT_MIN
+                : XFIXNUM (arg) & INT_MAX);
   else
     exit_code = EXIT_SUCCESS;
   exit (exit_code);
@@ -2416,7 +2450,7 @@ decode_env_path (const char *evarname, const char 
*defalt, bool empty)
               && strncmp (path, emacs_dir_env, emacs_dir_len) == 0)
             element = Fexpand_file_name (Fsubstring
                                          (element,
-                                          make_number (emacs_dir_len),
+                                          make_fixnum (emacs_dir_len),
                                           Qnil),
                                          build_unibyte_string (emacs_dir));
 #endif
diff --git a/src/eval.c b/src/eval.c
index 5964dd1..8745ba9 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -264,8 +264,8 @@ init_eval (void)
 static void
 restore_stack_limits (Lisp_Object data)
 {
-  max_specpdl_size = XINT (XCAR (data));
-  max_lisp_eval_depth = XINT (XCDR (data));
+  max_specpdl_size = XFIXNUM (XCAR (data));
+  max_lisp_eval_depth = XFIXNUM (XCDR (data));
 }
 
 static void grow_specpdl (void);
@@ -303,8 +303,8 @@ call_debugger (Lisp_Object arg)
 
   /* Restore limits after leaving the debugger.  */
   record_unwind_protect (restore_stack_limits,
-                        Fcons (make_number (old_max),
-                               make_number (old_depth)));
+                        Fcons (make_fixnum (old_max),
+                               make_fixnum (old_depth)));
 
 #ifdef HAVE_WINDOW_SYSTEM
   if (display_hourglass_p)
@@ -511,7 +511,7 @@ usage: (setq [SYM VAL]...)  */)
       Lisp_Object sym = XCAR (tail), lex_binding;
       tail = XCDR (tail);
       if (!CONSP (tail))
-       xsignal2 (Qwrong_number_of_arguments, Qsetq, make_number (nargs + 1));
+       xsignal2 (Qwrong_number_of_arguments, Qsetq, make_fixnum (nargs + 1));
       Lisp_Object arg = XCAR (tail);
       tail = XCDR (tail);
       val = eval_sub (arg);
@@ -938,7 +938,7 @@ usage: (let VARLIST BODY...)  */)
   CHECK_LIST (varlist);
 
   /* Make space to hold the values to give the bound variables.  */
-  EMACS_INT varlist_len = XFASTINT (Flength (varlist));
+  EMACS_INT varlist_len = XFIXNAT (Flength (varlist));
   SAFE_ALLOCA_LISP (temps, varlist_len);
   ptrdiff_t nvars = varlist_len;
 
@@ -1991,12 +1991,12 @@ this does nothing and returns nil.  */)
       && !AUTOLOADP (XSYMBOL (function)->u.s.function))
     return Qnil;
 
-  if (!NILP (Vpurify_flag) && EQ (docstring, make_number (0)))
+  if (!NILP (Vpurify_flag) && EQ (docstring, make_fixnum (0)))
     /* `read1' in lread.c has found the docstring starting with "\
        and assumed the docstring will be provided by Snarf-documentation, so it
        passed us 0 instead.  But that leads to accidental sharing in purecopy's
        hash-consing, so we use a (hopefully) unique integer instead.  */
-    docstring = make_number (XHASH (function));
+    docstring = make_fixnum (XHASH (function));
   return Fdefalias (function,
                    list5 (Qautoload, file, docstring, interactive, type),
                    Qnil);
@@ -2016,7 +2016,7 @@ un_autoload (Lisp_Object oldqueue)
       first = XCAR (queue);
       second = Fcdr (first);
       first = Fcar (first);
-      if (EQ (first, make_number (0)))
+      if (EQ (first, make_fixnum (0)))
        Vfeatures = second;
       else
        Ffset (first, second);
@@ -2041,7 +2041,7 @@ it defines a macro.  */)
   if (!CONSP (fundef) || !EQ (Qautoload, XCAR (fundef)))
     return fundef;
 
-  Lisp_Object kind = Fnth (make_number (4), fundef);
+  Lisp_Object kind = Fnth (make_fixnum (4), fundef);
   if (EQ (macro_only, Qmacro)
       && !(EQ (kind, Qt) || EQ (kind, Qmacro)))
     return fundef;
@@ -2230,9 +2230,9 @@ eval_sub (Lisp_Object form)
 
       check_cons_list ();
 
-      if (XINT (numargs) < XSUBR (fun)->min_args
+      if (XFIXNUM (numargs) < XSUBR (fun)->min_args
          || (XSUBR (fun)->max_args >= 0
-             && XSUBR (fun)->max_args < XINT (numargs)))
+             && XSUBR (fun)->max_args < XFIXNUM (numargs)))
        xsignal2 (Qwrong_number_of_arguments, original_fun, numargs);
 
       else if (XSUBR (fun)->max_args == UNEVALLED)
@@ -2244,9 +2244,9 @@ eval_sub (Lisp_Object form)
          ptrdiff_t argnum = 0;
          USE_SAFE_ALLOCA;
 
-         SAFE_ALLOCA_LISP (vals, XINT (numargs));
+         SAFE_ALLOCA_LISP (vals, XFIXNUM (numargs));
 
-         while (CONSP (args_left) && argnum < XINT (numargs))
+         while (CONSP (args_left) && argnum < XFIXNUM (numargs))
            {
              Lisp_Object arg = XCAR (args_left);
              args_left = XCDR (args_left);
@@ -2276,7 +2276,7 @@ eval_sub (Lisp_Object form)
              args_left = Fcdr (args_left);
            }
 
-         set_backtrace_args (specpdl + count, argvals, XINT (numargs));
+         set_backtrace_args (specpdl + count, argvals, XFIXNUM (numargs));
 
          switch (i)
            {
@@ -2389,7 +2389,7 @@ usage: (apply FUNCTION &rest ARGUMENTS)  */)
 
   CHECK_LIST (spread_arg);
 
-  numargs = XINT (Flength (spread_arg));
+  numargs = XFIXNUM (Flength (spread_arg));
 
   if (numargs == 0)
     return Ffuncall (nargs - 1, args);
@@ -2863,7 +2863,7 @@ funcall_subr (struct Lisp_Subr *subr, ptrdiff_t numargs, 
Lisp_Object *args)
     {
       Lisp_Object fun;
       XSETSUBR (fun, subr);
-      xsignal2 (Qwrong_number_of_arguments, fun, make_number (numargs));
+      xsignal2 (Qwrong_number_of_arguments, fun, make_fixnum (numargs));
     }
 
   else if (subr->max_args == UNEVALLED)
@@ -2944,7 +2944,7 @@ apply_lambda (Lisp_Object fun, Lisp_Object args, 
ptrdiff_t count)
   Lisp_Object tem;
   USE_SAFE_ALLOCA;
 
-  numargs = XFASTINT (Flength (args));
+  numargs = XFIXNAT (Flength (args));
   SAFE_ALLOCA_LISP (arg_vector, numargs);
   args_left = args;
 
@@ -3006,7 +3006,7 @@ funcall_lambda (Lisp_Object fun, ptrdiff_t nargs,
       if (size <= COMPILED_STACK_DEPTH)
        xsignal1 (Qinvalid_function, fun);
       syms_left = AREF (fun, COMPILED_ARGLIST);
-      if (INTEGERP (syms_left))
+      if (FIXNUMP (syms_left))
        /* A byte-code object with an integer args template means we
           shouldn't bind any arguments, instead just call the byte-code
           interpreter directly; it will push arguments as necessary.
@@ -3067,7 +3067,7 @@ funcall_lambda (Lisp_Object fun, ptrdiff_t nargs,
          else if (i < nargs)
            arg = arg_vector[i++];
          else if (!optional)
-           xsignal2 (Qwrong_number_of_arguments, fun, make_number (nargs));
+           xsignal2 (Qwrong_number_of_arguments, fun, make_fixnum (nargs));
          else
            arg = Qnil;
 
@@ -3084,7 +3084,7 @@ funcall_lambda (Lisp_Object fun, ptrdiff_t nargs,
   if (!NILP (syms_left))
     xsignal1 (Qinvalid_function, fun);
   else if (i < nargs)
-    xsignal2 (Qwrong_number_of_arguments, fun, make_number (nargs));
+    xsignal2 (Qwrong_number_of_arguments, fun, make_fixnum (nargs));
 
   if (!EQ (lexenv, Vinternal_interpreter_environment))
     /* Instantiate a new lexical environment.  */
@@ -3191,7 +3191,7 @@ lambda_arity (Lisp_Object fun)
       if (size <= COMPILED_STACK_DEPTH)
        xsignal1 (Qinvalid_function, fun);
       syms_left = AREF (fun, COMPILED_ARGLIST);
-      if (INTEGERP (syms_left))
+      if (FIXNUMP (syms_left))
         return get_byte_code_arity (syms_left);
     }
   else
@@ -3206,7 +3206,7 @@ lambda_arity (Lisp_Object fun)
        xsignal1 (Qinvalid_function, fun);
 
       if (EQ (next, Qand_rest))
-       return Fcons (make_number (minargs), Qmany);
+       return Fcons (make_fixnum (minargs), Qmany);
       else if (EQ (next, Qand_optional))
        optional = true;
       else
@@ -3220,7 +3220,7 @@ lambda_arity (Lisp_Object fun)
   if (!NILP (syms_left))
     xsignal1 (Qinvalid_function, fun);
 
-  return Fcons (make_number (minargs), make_number (maxargs));
+  return Fcons (make_fixnum (minargs), make_fixnum (maxargs));
 }
 
 DEFUN ("fetch-bytecode", Ffetch_bytecode, Sfetch_bytecode,
@@ -3647,11 +3647,11 @@ get_backtrace_frame (Lisp_Object nframes, Lisp_Object 
base)
 {
   register EMACS_INT i;
 
-  CHECK_NATNUM (nframes);
+  CHECK_FIXNAT (nframes);
   union specbinding *pdl = get_backtrace_starting_at (base);
 
   /* Find the frame requested.  */
-  for (i = XFASTINT (nframes); i > 0 && backtrace_p (pdl); i--)
+  for (i = XFIXNAT (nframes); i > 0 && backtrace_p (pdl); i--)
     pdl = backtrace_next (pdl);
 
   return pdl;
@@ -3681,7 +3681,7 @@ DEFUN ("backtrace-debug", Fbacktrace_debug, 
Sbacktrace_debug, 2, 2, 0,
 The debugger is entered when that frame exits, if the flag is non-nil.  */)
   (Lisp_Object level, Lisp_Object flag)
 {
-  CHECK_NUMBER (level);
+  CHECK_FIXNUM (level);
   union specbinding *pdl = get_backtrace_frame(level, Qnil);
 
   if (backtrace_p (pdl))
@@ -3852,7 +3852,7 @@ NFRAMES and BASE specify the activation frame to use, as 
in `backtrace-frame'.
 {
   union specbinding *frame = get_backtrace_frame (nframes, base);
   union specbinding *prevframe
-    = get_backtrace_frame (make_number (XFASTINT (nframes) - 1), base);
+    = get_backtrace_frame (make_fixnum (XFIXNAT (nframes) - 1), base);
   ptrdiff_t distance = specpdl_ptr - frame;
   Lisp_Object result = Qnil;
   eassert (distance >= 0);
diff --git a/src/fileio.c b/src/fileio.c
index 2dcfb73..04e763f 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -691,7 +691,7 @@ This function does not grok magic file names.  */)
   memset (data + prefix_len, 'X', nX);
   memcpy (data + prefix_len + nX, SSDATA (encoded_suffix), suffix_len);
   int kind = (NILP (dir_flag) ? GT_FILE
-             : EQ (dir_flag, make_number (0)) ? GT_NOCREATE
+             : EQ (dir_flag, make_fixnum (0)) ? GT_NOCREATE
              : GT_DIR);
   int fd = gen_tempname (data, suffix_len, O_BINARY | O_CLOEXEC, kind);
   bool failed = fd < 0;
@@ -732,7 +732,7 @@ later creating the file, which opens all kinds of security 
holes.
 For that reason, you should normally use `make-temp-file' instead.  */)
   (Lisp_Object prefix)
 {
-  return Fmake_temp_file_internal (prefix, make_number (0),
+  return Fmake_temp_file_internal (prefix, make_fixnum (0),
                                   empty_unibyte_string, Qnil);
 }
 
@@ -1945,9 +1945,9 @@ permissions.  */)
 
 #ifdef WINDOWSNT
   if (NILP (ok_if_already_exists)
-      || INTEGERP (ok_if_already_exists))
+      || FIXNUMP (ok_if_already_exists))
     barf_or_query_if_file_exists (newname, false, "copy to it",
-                                 INTEGERP (ok_if_already_exists), false);
+                                 FIXNUMP (ok_if_already_exists), false);
 
   result = w32_copy_file (SSDATA (encoded_file), SSDATA (encoded_newname),
                          !NILP (keep_time), !NILP (preserve_uid_gid),
@@ -2002,9 +2002,9 @@ permissions.  */)
                    new_mask);
   if (ofd < 0 && errno == EEXIST)
     {
-      if (NILP (ok_if_already_exists) || INTEGERP (ok_if_already_exists))
+      if (NILP (ok_if_already_exists) || FIXNUMP (ok_if_already_exists))
        barf_or_query_if_file_exists (newname, true, "copy to it",
-                                     INTEGERP (ok_if_already_exists), false);
+                                     FIXNUMP (ok_if_already_exists), false);
       already_exists = true;
       ofd = emacs_open (SSDATA (encoded_newname), O_WRONLY, 0);
     }
@@ -2365,7 +2365,7 @@ This is what happens in interactive use with M-x.  */)
 
   bool plain_rename = (case_only_rename
                       || (!NILP (ok_if_already_exists)
-                          && !INTEGERP (ok_if_already_exists)));
+                          && !FIXNUMP (ok_if_already_exists)));
   int rename_errno UNINIT;
   if (!plain_rename)
     {
@@ -2383,7 +2383,7 @@ This is what happens in interactive use with M-x.  */)
 #endif
          barf_or_query_if_file_exists (newname, rename_errno == EEXIST,
                                        "rename to it",
-                                       INTEGERP (ok_if_already_exists),
+                                       FIXNUMP (ok_if_already_exists),
                                        false);
          plain_rename = true;
          break;
@@ -2476,9 +2476,9 @@ This is what happens in interactive use with M-x.  */)
   if (errno == EEXIST)
     {
       if (NILP (ok_if_already_exists)
-         || INTEGERP (ok_if_already_exists))
+         || FIXNUMP (ok_if_already_exists))
        barf_or_query_if_file_exists (newname, true, "make it a new name",
-                                     INTEGERP (ok_if_already_exists), false);
+                                     FIXNUMP (ok_if_already_exists), false);
       unlink (SSDATA (newname));
       if (link (SSDATA (encoded_file), SSDATA (encoded_newname)) == 0)
        return Qnil;
@@ -2504,12 +2504,12 @@ This happens for interactive use with M-x.  */)
   Lisp_Object encoded_target, encoded_linkname;
 
   CHECK_STRING (target);
-  if (INTEGERP (ok_if_already_exists))
+  if (FIXNUMP (ok_if_already_exists))
     {
       if (SREF (target, 0) == '~')
        target = Fexpand_file_name (target, Qnil);
       else if (SREF (target, 0) == '/' && SREF (target, 1) == ':')
-       target = Fsubstring_no_properties (target, make_number (2), Qnil);
+       target = Fsubstring_no_properties (target, make_fixnum (2), Qnil);
     }
   linkname = expand_cp_target (target, linkname);
 
@@ -2533,9 +2533,9 @@ This happens for interactive use with M-x.  */)
   if (errno == EEXIST)
     {
       if (NILP (ok_if_already_exists)
-         || INTEGERP (ok_if_already_exists))
+         || FIXNUMP (ok_if_already_exists))
        barf_or_query_if_file_exists (linkname, true, "make it a link",
-                                     INTEGERP (ok_if_already_exists), false);
+                                     FIXNUMP (ok_if_already_exists), false);
       unlink (SSDATA (encoded_linkname));
       if (symlink (SSDATA (encoded_target), SSDATA (encoded_linkname)) == 0)
        return Qnil;
@@ -3191,7 +3191,7 @@ Return nil, if file does not exist or is not accessible.  
*/)
   if (stat (SSDATA (absname), &st) < 0)
     return Qnil;
 
-  return make_number (st.st_mode & 07777);
+  return make_fixnum (st.st_mode & 07777);
 }
 
 DEFUN ("set-file-modes", Fset_file_modes, Sset_file_modes, 2, 2,
@@ -3208,7 +3208,7 @@ symbolic notation, like the `chmod' command from GNU 
Coreutils.  */)
   Lisp_Object handler;
 
   absname = Fexpand_file_name (filename, BVAR (current_buffer, directory));
-  CHECK_NUMBER (mode);
+  CHECK_FIXNUM (mode);
 
   /* If the file name has special constructs in it,
      call the corresponding file handler.  */
@@ -3218,7 +3218,7 @@ symbolic notation, like the `chmod' command from GNU 
Coreutils.  */)
 
   encoded_absname = ENCODE_FILE (absname);
 
-  if (chmod (SSDATA (encoded_absname), XINT (mode) & 07777) < 0)
+  if (chmod (SSDATA (encoded_absname), XFIXNUM (mode) & 07777) < 0)
     report_file_error ("Doing chmod", absname);
 
   return Qnil;
@@ -3239,9 +3239,9 @@ by having the corresponding bit in the mask reset.  */)
   (Lisp_Object mode)
 {
   mode_t oldrealmask, oldumask, newumask;
-  CHECK_NUMBER (mode);
+  CHECK_FIXNUM (mode);
   oldrealmask = realmask;
-  newumask = ~ XINT (mode) & 0777;
+  newumask = ~ XFIXNUM (mode) & 0777;
 
   block_input ();
   realmask = newumask;
@@ -3401,12 +3401,12 @@ verify (alignof (union read_non_regular) % GCALIGNMENT 
== 0);
 static Lisp_Object
 read_non_regular (Lisp_Object state)
 {
-  union read_non_regular *data = XINTPTR (state);
+  union read_non_regular *data = XFIXNUMPTR (state);
   int nbytes = emacs_read_quit (data->s.fd,
                                ((char *) BEG_ADDR + PT_BYTE - BEG_BYTE
                                 + data->s.inserted),
                                data->s.trytry);
-  return make_number (nbytes);
+  return make_fixnum (nbytes);
 }
 
 
@@ -3424,8 +3424,8 @@ read_non_regular_quit (Lisp_Object ignore)
 static off_t
 file_offset (Lisp_Object val)
 {
-  if (RANGED_INTEGERP (0, val, TYPE_MAXIMUM (off_t)))
-    return XINT (val);
+  if (RANGED_FIXNUMP (0, val, TYPE_MAXIMUM (off_t)))
+    return XFIXNUM (val);
 
   if (FLOATP (val))
     {
@@ -3484,16 +3484,16 @@ restore_window_points (Lisp_Object window_markers, 
ptrdiff_t inserted,
        Lisp_Object car = XCAR (window_markers);
        Lisp_Object marker = XCAR (car);
        Lisp_Object oldpos = XCDR (car);
-       if (MARKERP (marker) && INTEGERP (oldpos)
-           && XINT (oldpos) > same_at_start
-           && XINT (oldpos) < same_at_end)
+       if (MARKERP (marker) && FIXNUMP (oldpos)
+           && XFIXNUM (oldpos) > same_at_start
+           && XFIXNUM (oldpos) < same_at_end)
          {
            ptrdiff_t oldsize = same_at_end - same_at_start;
            ptrdiff_t newsize = inserted;
            double growth = newsize / (double)oldsize;
            ptrdiff_t newpos
-             = same_at_start + growth * (XINT (oldpos) - same_at_start);
-           Fset_marker (marker, make_number (newpos), Qnil);
+             = same_at_start + growth * (XFIXNUM (oldpos) - same_at_start);
+           Fset_marker (marker, make_fixnum (newpos), Qnil);
          }
       }
 }
@@ -3606,8 +3606,8 @@ by calling `format-decode', which see.  */)
       val = call6 (handler, Qinsert_file_contents, filename,
                   visit, beg, end, replace);
       if (CONSP (val) && CONSP (XCDR (val))
-         && RANGED_INTEGERP (0, XCAR (XCDR (val)), ZV - PT))
-       inserted = XINT (XCAR (XCDR (val)));
+         && RANGED_FIXNUMP (0, XCAR (XCDR (val)), ZV - PT))
+       inserted = XFIXNUM (XCAR (XCDR (val)));
       goto handled;
     }
 
@@ -3792,7 +3792,7 @@ by calling `format-decode', which see.  */)
                  insert_1_both ((char *) read_buf, nread, nread, 0, 0, 0);
                  TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
                  coding_system = call2 (Vset_auto_coding_function,
-                                        filename, make_number (nread));
+                                        filename, make_fixnum (nread));
                  set_buffer_internal (prev);
 
                  /* Discard the unwind protect for recovering the
@@ -4271,7 +4271,7 @@ by calling `format-decode', which see.  */)
                break;
              }
 
-           this = XINT (nbytes);
+           this = XFIXNUM (nbytes);
          }
        else
          {
@@ -4367,7 +4367,7 @@ by calling `format-decode', which see.  */)
          if (inserted > 0 && ! NILP (Vset_auto_coding_function))
            {
              coding_system = call2 (Vset_auto_coding_function,
-                                    filename, make_number (inserted));
+                                    filename, make_fixnum (inserted));
            }
 
          if (NILP (coding_system))
@@ -4486,13 +4486,13 @@ by calling `format-decode', which see.  */)
 
   if (! NILP (Ffboundp (Qafter_insert_file_set_coding)))
     {
-      insval = call2 (Qafter_insert_file_set_coding, make_number (inserted),
+      insval = call2 (Qafter_insert_file_set_coding, make_fixnum (inserted),
                      visit);
       if (! NILP (insval))
        {
-         if (! RANGED_INTEGERP (0, insval, ZV - PT))
+         if (! RANGED_FIXNUMP (0, insval, ZV - PT))
            wrong_type_argument (intern ("inserted-chars"), insval);
-         inserted = XFASTINT (insval);
+         inserted = XFIXNAT (insval);
        }
     }
 
@@ -4512,10 +4512,10 @@ by calling `format-decode', which see.  */)
       if (NILP (replace))
        {
          insval = call3 (Qformat_decode,
-                         Qnil, make_number (inserted), visit);
-         if (! RANGED_INTEGERP (0, insval, ZV - PT))
+                         Qnil, make_fixnum (inserted), visit);
+         if (! RANGED_FIXNUMP (0, insval, ZV - PT))
            wrong_type_argument (intern ("inserted-chars"), insval);
-         inserted = XFASTINT (insval);
+         inserted = XFIXNAT (insval);
        }
       else
        {
@@ -4535,8 +4535,8 @@ by calling `format-decode', which see.  */)
 
          TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE);
          insval = call3 (Qformat_decode,
-                         Qnil, make_number (oinserted), visit);
-         if (! RANGED_INTEGERP (0, insval, ZV - PT))
+                         Qnil, make_fixnum (oinserted), visit);
+         if (! RANGED_FIXNUMP (0, insval, ZV - PT))
            wrong_type_argument (intern ("inserted-chars"), insval);
          if (ochars_modiff == CHARS_MODIFF)
            /* format_decode didn't modify buffer's characters => move
@@ -4546,7 +4546,7 @@ by calling `format-decode', which see.  */)
          else
            /* format_decode modified buffer's characters => consider
               entire buffer changed and leave point at point-min.  */
-           inserted = XFASTINT (insval);
+           inserted = XFIXNAT (insval);
        }
 
       /* For consistency with format-decode call these now iff inserted > 0
@@ -4556,12 +4556,12 @@ by calling `format-decode', which see.  */)
        {
          if (NILP (replace))
            {
-             insval = call1 (XCAR (p), make_number (inserted));
+             insval = call1 (XCAR (p), make_fixnum (inserted));
              if (!NILP (insval))
                {
-                 if (! RANGED_INTEGERP (0, insval, ZV - PT))
+                 if (! RANGED_FIXNUMP (0, insval, ZV - PT))
                    wrong_type_argument (intern ("inserted-chars"), insval);
-                 inserted = XFASTINT (insval);
+                 inserted = XFIXNAT (insval);
                }
            }
          else
@@ -4574,10 +4574,10 @@ by calling `format-decode', which see.  */)
              EMACS_INT ochars_modiff = CHARS_MODIFF;
 
              TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE);
-             insval = call1 (XCAR (p), make_number (oinserted));
+             insval = call1 (XCAR (p), make_fixnum (oinserted));
              if (!NILP (insval))
                {
-                 if (! RANGED_INTEGERP (0, insval, ZV - PT))
+                 if (! RANGED_FIXNUMP (0, insval, ZV - PT))
                    wrong_type_argument (intern ("inserted-chars"), insval);
                  if (ochars_modiff == CHARS_MODIFF)
                    /* after_insert_file_functions didn't modify
@@ -4589,7 +4589,7 @@ by calling `format-decode', which see.  */)
                    /* after_insert_file_functions did modify buffer's
                       characters => consider entire buffer changed and
                       leave point at point-min.  */
-                   inserted = XFASTINT (insval);
+                   inserted = XFIXNAT (insval);
                }
            }
 
@@ -4605,10 +4605,10 @@ by calling `format-decode', which see.  */)
              /* Adjust the last undo record for the size change during
                 the format conversion.  */
              Lisp_Object tem = XCAR (old_undo);
-             if (CONSP (tem) && INTEGERP (XCAR (tem))
-                 && INTEGERP (XCDR (tem))
-                 && XFASTINT (XCDR (tem)) == PT + old_inserted)
-               XSETCDR (tem, make_number (PT + inserted));
+             if (CONSP (tem) && FIXNUMP (XCAR (tem))
+                 && FIXNUMP (XCDR (tem))
+                 && XFIXNAT (XCDR (tem)) == PT + old_inserted)
+               XSETCDR (tem, make_fixnum (PT + inserted));
            }
        }
       else
@@ -4643,7 +4643,7 @@ by calling `format-decode', which see.  */)
 
   /* Retval needs to be dealt with in all cases consistently.  */
   if (NILP (val))
-    val = list2 (orig_filename, make_number (inserted));
+    val = list2 (orig_filename, make_fixnum (inserted));
 
   return unbind_to (count, val);
 }
@@ -4946,7 +4946,7 @@ write_region (Lisp_Object start, Lisp_Object end, 
Lisp_Object filename,
   fn = SSDATA (encoded_filename);
   open_flags = O_WRONLY | O_CREAT;
   open_flags |= EQ (mustbenew, Qexcl) ? O_EXCL : !NILP (append) ? 0 : O_TRUNC;
-  if (NUMBERP (append))
+  if (FIXED_OR_FLOATP (append))
     offset = file_offset (append);
   else if (!NILP (append))
     open_flags |= O_APPEND;
@@ -4971,7 +4971,7 @@ write_region (Lisp_Object start, Lisp_Object end, 
Lisp_Object filename,
       record_unwind_protect_int (close_file_unwind, desc);
     }
 
-  if (NUMBERP (append))
+  if (FIXED_OR_FLOATP (append))
     {
       off_t ret = lseek (desc, offset, SEEK_SET);
       if (ret < 0)
@@ -4985,14 +4985,14 @@ write_region (Lisp_Object start, Lisp_Object end, 
Lisp_Object filename,
 
   if (STRINGP (start))
     ok = a_write (desc, start, 0, SCHARS (start), &annotations, &coding);
-  else if (XINT (start) != XINT (end))
-    ok = a_write (desc, Qnil, XINT (start), XINT (end) - XINT (start),
+  else if (XFIXNUM (start) != XFIXNUM (end))
+    ok = a_write (desc, Qnil, XFIXNUM (start), XFIXNUM (end) - XFIXNUM (start),
                  &annotations, &coding);
   else
     {
       /* If file was empty, still need to write the annotations.  */
       coding.mode |= CODING_MODE_LAST_BLOCK;
-      ok = a_write (desc, Qnil, XINT (end), 0, &annotations, &coding);
+      ok = a_write (desc, Qnil, XFIXNUM (end), 0, &annotations, &coding);
     }
   save_errno = errno;
 
@@ -5154,7 +5154,7 @@ write_region (Lisp_Object start, Lisp_Object end, 
Lisp_Object filename,
     }
 
   if (!auto_saving && !noninteractive)
-    message_with_string ((NUMBERP (append)
+    message_with_string ((FIXED_OR_FLOATP (append)
                          ? "Updated %s"
                          : ! NILP (append)
                          ? "Added to %s"
@@ -5239,7 +5239,7 @@ build_annotations (Lisp_Object start, Lisp_Object end)
          has written annotations to a temporary buffer, which is now
          current.  */
       res = call5 (Qformat_annotate_function, XCAR (p), start, end,
-                  original_buffer, make_number (i));
+                  original_buffer, make_fixnum (i));
       if (current_buffer != given_buffer)
        {
          XSETFASTINT (start, BEGV);
@@ -5278,8 +5278,8 @@ a_write (int desc, Lisp_Object string, ptrdiff_t pos,
     {
       tem = Fcar_safe (Fcar (*annot));
       nextpos = pos - 1;
-      if (INTEGERP (tem))
-       nextpos = XFASTINT (tem);
+      if (FIXNUMP (tem))
+       nextpos = XFIXNAT (tem);
 
       /* If there are no more annotations in this range,
         output the rest of the range all at once.  */
@@ -5460,7 +5460,7 @@ See Info node `(elisp)Modification Time' for more 
details.  */)
 {
   int ns = current_buffer->modtime.tv_nsec;
   if (ns < 0)
-    return make_number (UNKNOWN_MODTIME_NSECS - ns);
+    return make_fixnum (UNKNOWN_MODTIME_NSECS - ns);
   return make_lisp_time (current_buffer->modtime);
 }
 
@@ -5478,10 +5478,10 @@ An argument specifies the modification time value to use
   if (!NILP (time_flag))
     {
       struct timespec mtime;
-      if (INTEGERP (time_flag))
+      if (FIXNUMP (time_flag))
        {
          CHECK_RANGED_INTEGER (time_flag, -1, 0);
-         mtime = make_timespec (0, UNKNOWN_MODTIME_NSECS - XINT (time_flag));
+         mtime = make_timespec (0, UNKNOWN_MODTIME_NSECS - XFIXNUM 
(time_flag));
        }
       else
        mtime = lisp_time_argument (time_flag);
@@ -5547,9 +5547,9 @@ auto_save_1 (void)
        /* But make sure we can overwrite it later!  */
        auto_save_mode_bits = (st.st_mode | 0600) & 0777;
       else if (modes = Ffile_modes (BVAR (current_buffer, filename)),
-              INTEGERP (modes))
+              FIXNUMP (modes))
        /* Remote files don't cooperate with stat.  */
-       auto_save_mode_bits = (XINT (modes) | 0600) & 0777;
+       auto_save_mode_bits = (XFIXNUM (modes) | 0600) & 0777;
     }
 
   return
@@ -5716,7 +5716,7 @@ A non-nil CURRENT-ONLY argument means save only current 
buffer.  */)
            && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)
            && BUF_AUTOSAVE_MODIFF (b) < BUF_MODIFF (b)
            /* -1 means we've turned off autosaving for a while--see below.  */
-           && XINT (BVAR (b, save_length)) >= 0
+           && XFIXNUM (BVAR (b, save_length)) >= 0
            && (do_handled_files
                || NILP (Ffind_file_name_handler (BVAR (b, auto_save_file_name),
                                                  Qwrite_region))))
@@ -5731,11 +5731,11 @@ A non-nil CURRENT-ONLY argument means save only current 
buffer.  */)
 
            set_buffer_internal (b);
            if (NILP (Vauto_save_include_big_deletions)
-               && (XFASTINT (BVAR (b, save_length)) * 10
+               && (XFIXNAT (BVAR (b, save_length)) * 10
                    > (BUF_Z (b) - BUF_BEG (b)) * 13)
                /* A short file is likely to change a large fraction;
                   spare the user annoying messages.  */
-               && XFASTINT (BVAR (b, save_length)) > 5000
+               && XFIXNAT (BVAR (b, save_length)) > 5000
                /* These messages are frequent and annoying for `*mail*'.  */
                && !NILP (BVAR (b, filename))
                && NILP (no_message))
@@ -5748,7 +5748,7 @@ A non-nil CURRENT-ONLY argument means save only current 
buffer.  */)
                /* Turn off auto-saving until there's a real save,
                   and prevent any more warnings.  */
                XSETINT (BVAR (b, save_length), -1);
-               Fsleep_for (make_number (1), Qnil);
+               Fsleep_for (make_fixnum (1), Qnil);
                continue;
              }
            if (!auto_saved && NILP (no_message))
@@ -5777,7 +5777,7 @@ A non-nil CURRENT-ONLY argument means save only current 
buffer.  */)
        {
          /* If we are going to restore an old message,
             give time to read ours.  */
-         sit_for (make_number (1), 0, 0);
+         sit_for (make_fixnum (1), 0, 0);
          restore_message ();
        }
       else if (!auto_save_error_occurred)
diff --git a/src/floatfns.c b/src/floatfns.c
index 45e786f..bbf7df4 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -60,7 +60,7 @@ CHECK_FLOAT (Lisp_Object x)
 double
 extract_float (Lisp_Object num)
 {
-  CHECK_NUMBER_OR_FLOAT (num);
+  CHECK_NUMBER (num);
   return XFLOATINT (num);
 }
 
@@ -178,7 +178,7 @@ If X is zero, both parts (SGNFCAND and EXP) are zero.  */)
   double f = extract_float (x);
   int exponent;
   double sgnfcand = frexp (f, &exponent);
-  return Fcons (make_float (sgnfcand), make_number (exponent));
+  return Fcons (make_float (sgnfcand), make_fixnum (exponent));
 }
 
 DEFUN ("ldexp", Fldexp, Sldexp, 2, 2, 0,
@@ -186,8 +186,8 @@ DEFUN ("ldexp", Fldexp, Sldexp, 2, 2, 0,
 EXPONENT must be an integer.   */)
   (Lisp_Object sgnfcand, Lisp_Object exponent)
 {
-  CHECK_NUMBER (exponent);
-  int e = min (max (INT_MIN, XINT (exponent)), INT_MAX);
+  CHECK_FIXNUM (exponent);
+  int e = min (max (INT_MIN, XFIXNUM (exponent)), INT_MAX);
   return make_float (ldexp (extract_float (sgnfcand), e));
 }
 
@@ -204,18 +204,18 @@ DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0,
        doc: /* Return the exponential ARG1 ** ARG2.  */)
   (Lisp_Object arg1, Lisp_Object arg2)
 {
-  CHECK_NUMBER_OR_FLOAT (arg1);
-  CHECK_NUMBER_OR_FLOAT (arg2);
-  if (INTEGERP (arg1)     /* common lisp spec */
-      && INTEGERP (arg2)   /* don't promote, if both are ints, and */
-      && XINT (arg2) >= 0) /* we are sure the result is not fractional */
+  CHECK_FIXNUM_OR_FLOAT (arg1);
+  CHECK_FIXNUM_OR_FLOAT (arg2);
+  if (FIXNUMP (arg1)     /* common lisp spec */
+      && FIXNUMP (arg2)   /* don't promote, if both are ints, and */
+      && XFIXNUM (arg2) >= 0) /* we are sure the result is not fractional */
     {                          /* this can be improved by pre-calculating */
       EMACS_INT y;             /* some binary powers of x then accumulating */
       EMACS_UINT acc, x;  /* Unsigned so that overflow is well defined.  */
       Lisp_Object val;
 
-      x = XINT (arg1);
-      y = XINT (arg2);
+      x = XFIXNUM (arg1);
+      y = XFIXNUM (arg2);
       acc = (y & 1 ? x : 1);
 
       while ((y >>= 1) != 0)
@@ -268,12 +268,28 @@ DEFUN ("abs", Fabs, Sabs, 1, 1, 0,
        doc: /* Return the absolute value of ARG.  */)
   (register Lisp_Object arg)
 {
-  CHECK_NUMBER_OR_FLOAT (arg);
+  CHECK_NUMBER (arg);
 
-  if (FLOATP (arg))
+  if (BIGNUMP (arg))
+    {
+      mpz_t val;
+      mpz_init (val);
+      mpz_abs (val, XBIGNUM (arg)->value);
+      arg = make_number (val);
+      mpz_clear (val);
+    }
+  else if (FIXNUMP (arg) && XFIXNUM (arg) == MOST_NEGATIVE_FIXNUM)
+    {
+      mpz_t val;
+      mpz_init (val);
+      mpz_set_intmax (val, - MOST_NEGATIVE_FIXNUM);
+      arg = make_number (val);
+      mpz_clear (val);
+    }
+  else if (FLOATP (arg))
     arg = make_float (fabs (XFLOAT_DATA (arg)));
-  else if (XINT (arg) < 0)
-    XSETINT (arg, - XINT (arg));
+  else if (XFIXNUM (arg) < 0)
+    XSETINT (arg, - XFIXNUM (arg));
 
   return arg;
 }
@@ -282,10 +298,12 @@ DEFUN ("float", Ffloat, Sfloat, 1, 1, 0,
        doc: /* Return the floating point number equal to ARG.  */)
   (register Lisp_Object arg)
 {
-  CHECK_NUMBER_OR_FLOAT (arg);
+  CHECK_NUMBER (arg);
 
-  if (INTEGERP (arg))
-    return make_float ((double) XINT (arg));
+  if (BIGNUMP (arg))
+    return make_float (mpz_get_d (XBIGNUM (arg)->value));
+  if (FIXNUMP (arg))
+    return make_float ((double) XFIXNUM (arg));
   else                         /* give 'em the same float back */
     return arg;
 }
@@ -304,7 +322,7 @@ This is the same as the exponent of a float.  */)
   (Lisp_Object arg)
 {
   EMACS_INT value;
-  CHECK_NUMBER_OR_FLOAT (arg);
+  CHECK_NUMBER (arg);
 
   if (FLOATP (arg))
     {
@@ -321,15 +339,18 @@ This is the same as the exponent of a float.  */)
       else
        value = MOST_POSITIVE_FIXNUM;
     }
+  else if (BIGNUMP (arg))
+    value = mpz_sizeinbase (XBIGNUM (arg)->value, 2) - 1;
   else
     {
-      EMACS_INT i = eabs (XINT (arg));
+      eassert (FIXNUMP (arg));
+      EMACS_INT i = eabs (XFIXNUM (arg));
       value = (i == 0
               ? MOST_NEGATIVE_FIXNUM
               : EMACS_UINT_WIDTH - 1 - ecount_leading_zeros (i));
     }
 
-  return make_number (value);
+  return make_fixnum (value);
 }
 
 
@@ -341,7 +362,7 @@ rounding_driver (Lisp_Object arg, Lisp_Object divisor,
                 EMACS_INT (*int_round2) (EMACS_INT, EMACS_INT),
                 const char *name)
 {
-  CHECK_NUMBER_OR_FLOAT (arg);
+  CHECK_FIXNUM_OR_FLOAT (arg);
 
   double d;
   if (NILP (divisor))
@@ -352,16 +373,16 @@ rounding_driver (Lisp_Object arg, Lisp_Object divisor,
     }
   else
     {
-      CHECK_NUMBER_OR_FLOAT (divisor);
+      CHECK_FIXNUM_OR_FLOAT (divisor);
       if (!FLOATP (arg) && !FLOATP (divisor))
        {
-         if (XINT (divisor) == 0)
+         if (XFIXNUM (divisor) == 0)
            xsignal0 (Qarith_error);
-         return make_number (int_round2 (XINT (arg), XINT (divisor)));
+         return make_fixnum (int_round2 (XFIXNUM (arg), XFIXNUM (divisor)));
        }
 
-      double f1 = FLOATP (arg) ? XFLOAT_DATA (arg) : XINT (arg);
-      double f2 = FLOATP (divisor) ? XFLOAT_DATA (divisor) : XINT (divisor);
+      double f1 = FLOATP (arg) ? XFLOAT_DATA (arg) : XFIXNUM (arg);
+      double f2 = FLOATP (divisor) ? XFLOAT_DATA (divisor) : XFIXNUM (divisor);
       if (! IEEE_FLOATING_POINT && f2 == 0)
        xsignal0 (Qarith_error);
       d = f1 / f2;
@@ -376,7 +397,7 @@ rounding_driver (Lisp_Object arg, Lisp_Object divisor,
     {
       EMACS_INT ir = dr;
       if (! FIXNUM_OVERFLOW_P (ir))
-       return make_number (ir);
+       return make_fixnum (ir);
     }
   xsignal2 (Qrange_error, build_string (name), arg);
 }
@@ -482,8 +503,8 @@ fmod_float (Lisp_Object x, Lisp_Object y)
 {
   double f1, f2;
 
-  f1 = FLOATP (x) ? XFLOAT_DATA (x) : XINT (x);
-  f2 = FLOATP (y) ? XFLOAT_DATA (y) : XINT (y);
+  f1 = FLOATP (x) ? XFLOAT_DATA (x) : XFIXNUM (x);
+  f2 = FLOATP (y) ? XFLOAT_DATA (y) : XFIXNUM (y);
 
   f1 = fmod (f1, f2);
 
diff --git a/src/fns.c b/src/fns.c
index 5247140..f6e6803 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -77,18 +77,18 @@ See Info node `(elisp)Random Numbers' for more details.  */)
     seed_random (SSDATA (limit), SBYTES (limit));
 
   val = get_random ();
-  if (INTEGERP (limit) && 0 < XINT (limit))
+  if (FIXNUMP (limit) && 0 < XFIXNUM (limit))
     while (true)
       {
        /* Return the remainder, except reject the rare case where
           get_random returns a number so close to INTMASK that the
           remainder isn't random.  */
-       EMACS_INT remainder = val % XINT (limit);
-       if (val - remainder <= INTMASK - XINT (limit) + 1)
-         return make_number (remainder);
+       EMACS_INT remainder = val % XFIXNUM (limit);
+       if (val - remainder <= INTMASK - XFIXNUM (limit) + 1)
+         return make_fixnum (remainder);
        val = get_random ();
       }
-  return make_number (val);
+  return make_fixnum (val);
 }
 
 /* Random data-structure functions.  */
@@ -121,7 +121,7 @@ To get the number of bytes, use `string-bytes'.  */)
       CHECK_LIST_END (sequence, sequence);
       if (MOST_POSITIVE_FIXNUM < i)
        error ("List too long");
-      val = make_number (i);
+      val = make_fixnum (i);
     }
   else if (NILP (sequence))
     XSETFASTINT (val, 0);
@@ -163,7 +163,7 @@ A proper list is neither circular nor dotted (i.e., its 
last cdr is nil).  */
     return Qnil;
   if (MOST_POSITIVE_FIXNUM < len)
     xsignal0 (Qoverflow_error);
-  return make_number (len);
+  return make_fixnum (len);
 }
 
 DEFUN ("string-bytes", Fstring_bytes, Sstring_bytes, 1, 1, 0,
@@ -172,7 +172,7 @@ If STRING is multibyte, this may be greater than the length 
of STRING.  */)
   (Lisp_Object string)
 {
   CHECK_STRING (string);
-  return make_number (SBYTES (string));
+  return make_fixnum (SBYTES (string));
 }
 
 DEFUN ("string-distance", Fstring_distance, Sstring_distance, 2, 3, 0,
@@ -238,7 +238,7 @@ Letter-case is significant, but text properties are 
ignored. */)
     }
 
   SAFE_FREE ();
-  return make_number (column[len1]);
+  return make_fixnum (column[len1]);
 }
 
 DEFUN ("string-equal", Fstring_equal, Sstring_equal, 2, 2, 0,
@@ -292,10 +292,10 @@ If string STR1 is greater, the value is a positive number 
N;
 
   /* For backward compatibility, silently bring too-large positive end
      values into range.  */
-  if (INTEGERP (end1) && SCHARS (str1) < XINT (end1))
-    end1 = make_number (SCHARS (str1));
-  if (INTEGERP (end2) && SCHARS (str2) < XINT (end2))
-    end2 = make_number (SCHARS (str2));
+  if (FIXNUMP (end1) && SCHARS (str1) < XFIXNUM (end1))
+    end1 = make_fixnum (SCHARS (str1));
+  if (FIXNUMP (end2) && SCHARS (str2) < XFIXNUM (end2))
+    end2 = make_fixnum (SCHARS (str2));
 
   validate_subarray (str1, start1, end1, SCHARS (str1), &from1, &to1);
   validate_subarray (str2, start2, end2, SCHARS (str2), &from2, &to2);
@@ -320,8 +320,8 @@ If string STR1 is greater, the value is a positive number N;
 
       if (! NILP (ignore_case))
        {
-         c1 = XINT (Fupcase (make_number (c1)));
-         c2 = XINT (Fupcase (make_number (c2)));
+         c1 = XFIXNUM (Fupcase (make_fixnum (c1)));
+         c2 = XFIXNUM (Fupcase (make_fixnum (c2)));
        }
 
       if (c1 == c2)
@@ -331,15 +331,15 @@ If string STR1 is greater, the value is a positive number 
N;
         past the character that we are comparing;
         hence we don't add or subtract 1 here.  */
       if (c1 < c2)
-       return make_number (- i1 + from1);
+       return make_fixnum (- i1 + from1);
       else
-       return make_number (i1 - from1);
+       return make_fixnum (i1 - from1);
     }
 
   if (i1 < to1)
-    return make_number (i1 - from1 + 1);
+    return make_fixnum (i1 - from1 + 1);
   if (i2 < to2)
-    return make_number (- i1 + from1 - 1);
+    return make_fixnum (- i1 + from1 - 1);
 
   return Qt;
 }
@@ -667,7 +667,7 @@ concat (ptrdiff_t nargs, Lisp_Object *args,
     {
       EMACS_INT len;
       this = args[argnum];
-      len = XFASTINT (Flength (this));
+      len = XFIXNAT (Flength (this));
       if (target_type == Lisp_String)
        {
          /* We must count the number of bytes needed in the string
@@ -682,7 +682,7 @@ concat (ptrdiff_t nargs, Lisp_Object *args,
              {
                ch = AREF (this, i);
                CHECK_CHARACTER (ch);
-               c = XFASTINT (ch);
+               c = XFIXNAT (ch);
                this_len_byte = CHAR_BYTES (c);
                if (STRING_BYTES_BOUND - result_len_byte < this_len_byte)
                  string_overflow ();
@@ -691,13 +691,13 @@ concat (ptrdiff_t nargs, Lisp_Object *args,
                  some_multibyte = 1;
              }
          else if (BOOL_VECTOR_P (this) && bool_vector_size (this) > 0)
-           wrong_type_argument (Qintegerp, Faref (this, make_number (0)));
+           wrong_type_argument (Qintegerp, Faref (this, make_fixnum (0)));
          else if (CONSP (this))
            for (; CONSP (this); this = XCDR (this))
              {
                ch = XCAR (this);
                CHECK_CHARACTER (ch);
-               c = XFASTINT (ch);
+               c = XFIXNAT (ch);
                this_len_byte = CHAR_BYTES (c);
                if (STRING_BYTES_BOUND - result_len_byte < this_len_byte)
                  string_overflow ();
@@ -731,9 +731,9 @@ concat (ptrdiff_t nargs, Lisp_Object *args,
 
   /* Create the output object.  */
   if (target_type == Lisp_Cons)
-    val = Fmake_list (make_number (result_len), Qnil);
+    val = Fmake_list (make_fixnum (result_len), Qnil);
   else if (target_type == Lisp_Vectorlike)
-    val = Fmake_vector (make_number (result_len), Qnil);
+    val = Fmake_vector (make_fixnum (result_len), Qnil);
   else if (some_multibyte)
     val = make_uninit_multibyte_string (result_len, result_len_byte);
   else
@@ -762,7 +762,7 @@ concat (ptrdiff_t nargs, Lisp_Object *args,
 
       this = args[argnum];
       if (!CONSP (this))
-       thislen = Flength (this), thisleni = XINT (thislen);
+       thislen = Flength (this), thisleni = XFIXNUM (thislen);
 
       /* Between strings of the same kind, copy fast.  */
       if (STRINGP (this) && STRINGP (val)
@@ -849,7 +849,7 @@ concat (ptrdiff_t nargs, Lisp_Object *args,
              {
                int c;
                CHECK_CHARACTER (elt);
-               c = XFASTINT (elt);
+               c = XFIXNAT (elt);
                if (some_multibyte)
                  toindex_byte += CHAR_STRING (c, SDATA (val) + toindex_byte);
                else
@@ -870,15 +870,15 @@ concat (ptrdiff_t nargs, Lisp_Object *args,
        {
          this = args[textprops[argnum].argnum];
          props = text_property_list (this,
-                                     make_number (0),
-                                     make_number (SCHARS (this)),
+                                     make_fixnum (0),
+                                     make_fixnum (SCHARS (this)),
                                      Qnil);
          /* If successive arguments have properties, be sure that the
             value of `composition' property be the copy.  */
          if (last_to_end == textprops[argnum].to)
            make_composition_value_copy (props);
          add_text_properties_from_list (val, props,
-                                        make_number (textprops[argnum].to));
+                                        make_fixnum (textprops[argnum].to));
          last_to_end = textprops[argnum].to + SCHARS (this);
        }
     }
@@ -1280,9 +1280,9 @@ validate_subarray (Lisp_Object array, Lisp_Object from, 
Lisp_Object to,
 {
   EMACS_INT f, t;
 
-  if (INTEGERP (from))
+  if (FIXNUMP (from))
     {
-      f = XINT (from);
+      f = XFIXNUM (from);
       if (f < 0)
        f += size;
     }
@@ -1291,9 +1291,9 @@ validate_subarray (Lisp_Object array, Lisp_Object from, 
Lisp_Object to,
   else
     wrong_type_argument (Qintegerp, from);
 
-  if (INTEGERP (to))
+  if (FIXNUMP (to))
     {
-      t = XINT (to);
+      t = XFIXNUM (to);
       if (t < 0)
        t += size;
     }
@@ -1339,8 +1339,8 @@ With one argument, just copy STRING (with properties, if 
any).  */)
       res = make_specified_string (SSDATA (string) + from_byte,
                                   ito - ifrom, to_byte - from_byte,
                                   STRING_MULTIBYTE (string));
-      copy_text_properties (make_number (ifrom), make_number (ito),
-                           string, make_number (0), res, Qnil);
+      copy_text_properties (make_fixnum (ifrom), make_fixnum (ito),
+                           string, make_fixnum (0), res, Qnil);
     }
   else
     res = Fvector (ito - ifrom, aref_addr (string, ifrom));
@@ -1385,15 +1385,15 @@ substring_both (Lisp_Object string, ptrdiff_t from, 
ptrdiff_t from_byte,
   ptrdiff_t size = CHECK_VECTOR_OR_STRING (string);
 
   if (!(0 <= from && from <= to && to <= size))
-    args_out_of_range_3 (string, make_number (from), make_number (to));
+    args_out_of_range_3 (string, make_fixnum (from), make_fixnum (to));
 
   if (STRINGP (string))
     {
       res = make_specified_string (SSDATA (string) + from_byte,
                                   to - from, to_byte - from_byte,
                                   STRING_MULTIBYTE (string));
-      copy_text_properties (make_number (from), make_number (to),
-                           string, make_number (0), res, Qnil);
+      copy_text_properties (make_fixnum (from), make_fixnum (to),
+                           string, make_fixnum (0), res, Qnil);
     }
   else
     res = Fvector (to - from, aref_addr (string, from));
@@ -1405,9 +1405,9 @@ DEFUN ("nthcdr", Fnthcdr, Snthcdr, 2, 2, 0,
        doc: /* Take cdr N times on LIST, return the result.  */)
   (Lisp_Object n, Lisp_Object list)
 {
-  CHECK_NUMBER (n);
+  CHECK_FIXNUM (n);
   Lisp_Object tail = list;
-  for (EMACS_INT num = XINT (n); 0 < num; num--)
+  for (EMACS_INT num = XFIXNUM (n); 0 < num; num--)
     {
       if (! CONSP (tail))
        {
@@ -1432,7 +1432,7 @@ DEFUN ("elt", Felt, Selt, 2, 2, 0,
        doc: /* Return element of SEQUENCE at index N.  */)
   (register Lisp_Object sequence, Lisp_Object n)
 {
-  CHECK_NUMBER (n);
+  CHECK_FIXNUM (n);
   if (CONSP (sequence) || NILP (sequence))
     return Fcar (Fnthcdr (n, sequence));
 
@@ -1690,7 +1690,7 @@ changing the value of a sequence `foo'.  */)
              cbytes = 1;
            }
 
-         if (!INTEGERP (elt) || c != XINT (elt))
+         if (!FIXNUMP (elt) || c != XFIXNUM (elt))
            {
              ++nchars;
              nbytes += cbytes;
@@ -1720,7 +1720,7 @@ changing the value of a sequence `foo'.  */)
                  cbytes = 1;
                }
 
-             if (!INTEGERP (elt) || c != XINT (elt))
+             if (!FIXNUMP (elt) || c != XFIXNUM (elt))
                {
                  unsigned char *from = SDATA (seq) + ibyte;
                  unsigned char *to   = SDATA (tem) + nbytes;
@@ -1891,7 +1891,7 @@ sort_list (Lisp_Object list, Lisp_Object predicate)
 
   front = list;
   len = Flength (list);
-  length = XINT (len);
+  length = XFIXNUM (len);
   if (length < 2)
     return list;
 
@@ -2000,7 +2000,7 @@ sort_vector (Lisp_Object vector, Lisp_Object predicate)
   USE_SAFE_ALLOCA;
   SAFE_ALLOCA_LISP (tmp, halflen);
   for (ptrdiff_t i = 0; i < halflen; i++)
-    tmp[i] = make_number (0);
+    tmp[i] = make_fixnum (0);
   sort_vector_inplace (predicate, len, XVECTOR (vector)->contents, tmp);
   SAFE_FREE ();
 }
@@ -2223,6 +2223,8 @@ This differs from numeric comparison: (eql 0.0 -0.0) 
returns nil and
 {
   if (FLOATP (obj1))
     return FLOATP (obj2) && same_float (obj1, obj2) ? Qt : Qnil;
+  else if (BIGNUMP (obj1))
+    return equal_no_quit (obj1, obj2) ? Qt : Qnil;
   else
     return EQ (obj1, obj2) ? Qt : Qnil;
 }
@@ -2285,7 +2287,7 @@ internal_equal (Lisp_Object o1, Lisp_Object o2, enum 
equal_kind equal_kind,
        ht = CALLN (Fmake_hash_table, QCtest, Qeq);
       switch (XTYPE (o1))
        {
-       case Lisp_Cons: case Lisp_Misc: case Lisp_Vectorlike:
+       case Lisp_Cons: case Lisp_Vectorlike:
          {
            struct Lisp_Hash_Table *h = XHASH_TABLE (ht);
            EMACS_UINT hash;
@@ -2342,29 +2344,6 @@ internal_equal (Lisp_Object o1, Lisp_Object o2, enum 
equal_kind equal_kind,
       depth++;
       goto tail_recurse;
 
-    case Lisp_Misc:
-      if (XMISCTYPE (o1) != XMISCTYPE (o2))
-       return false;
-      if (OVERLAYP (o1))
-       {
-         if (!internal_equal (OVERLAY_START (o1), OVERLAY_START (o2),
-                              equal_kind, depth + 1, ht)
-             || !internal_equal (OVERLAY_END (o1), OVERLAY_END (o2),
-                                 equal_kind, depth + 1, ht))
-           return false;
-         o1 = XOVERLAY (o1)->plist;
-         o2 = XOVERLAY (o2)->plist;
-         depth++;
-         goto tail_recurse;
-       }
-      if (MARKERP (o1))
-       {
-         return (XMARKER (o1)->buffer == XMARKER (o2)->buffer
-                 && (XMARKER (o1)->buffer == 0
-                     || XMARKER (o1)->bytepos == XMARKER (o2)->bytepos));
-       }
-      break;
-
     case Lisp_Vectorlike:
       {
        register int i;
@@ -2374,6 +2353,26 @@ internal_equal (Lisp_Object o1, Lisp_Object o2, enum 
equal_kind equal_kind,
           same size.  */
        if (ASIZE (o2) != size)
          return false;
+       if (BIGNUMP (o1))
+         return mpz_cmp (XBIGNUM (o1)->value, XBIGNUM (o2)->value) == 0;
+       if (OVERLAYP (o1))
+         {
+           if (!internal_equal (OVERLAY_START (o1), OVERLAY_START (o2),
+                                equal_kind, depth + 1, ht)
+               || !internal_equal (OVERLAY_END (o1), OVERLAY_END (o2),
+                                   equal_kind, depth + 1, ht))
+             return false;
+           o1 = XOVERLAY (o1)->plist;
+           o2 = XOVERLAY (o2)->plist;
+           depth++;
+           goto tail_recurse;
+         }
+       if (MARKERP (o1))
+         {
+           return (XMARKER (o1)->buffer == XMARKER (o2)->buffer
+                   && (XMARKER (o1)->buffer == 0
+                       || XMARKER (o1)->bytepos == XMARKER (o2)->bytepos));
+         }
        /* Boolvectors are compared much like strings.  */
        if (BOOL_VECTOR_P (o1))
          {
@@ -2456,7 +2455,7 @@ ARRAY is a vector, string, char-table, or bool-vector.  
*/)
       register unsigned char *p = SDATA (array);
       int charval;
       CHECK_CHARACTER (item);
-      charval = XFASTINT (item);
+      charval = XFIXNAT (item);
       size = SCHARS (array);
       if (STRING_MULTIBYTE (array))
        {
@@ -2523,7 +2522,7 @@ usage: (nconc &rest LISTS)  */)
 
       CHECK_CONS (tem);
 
-      Lisp_Object tail;
+      Lisp_Object tail UNINIT;
       FOR_EACH_TAIL (tem)
        tail = tem;
 
@@ -2608,7 +2607,7 @@ SEQUENCE may be a list, a vector, a bool-vector, or a 
string.  */)
   (Lisp_Object function, Lisp_Object sequence, Lisp_Object separator)
 {
   USE_SAFE_ALLOCA;
-  EMACS_INT leni = XFASTINT (Flength (sequence));
+  EMACS_INT leni = XFIXNAT (Flength (sequence));
   if (CHAR_TABLE_P (sequence))
     wrong_type_argument (Qlistp, sequence);
   EMACS_INT args_alloc = 2 * leni - 1;
@@ -2637,7 +2636,7 @@ SEQUENCE may be a list, a vector, a bool-vector, or a 
string.  */)
   (Lisp_Object function, Lisp_Object sequence)
 {
   USE_SAFE_ALLOCA;
-  EMACS_INT leni = XFASTINT (Flength (sequence));
+  EMACS_INT leni = XFIXNAT (Flength (sequence));
   if (CHAR_TABLE_P (sequence))
     wrong_type_argument (Qlistp, sequence);
   Lisp_Object *args;
@@ -2656,7 +2655,7 @@ SEQUENCE may be a list, a vector, a bool-vector, or a 
string.  */)
 {
   register EMACS_INT leni;
 
-  leni = XFASTINT (Flength (sequence));
+  leni = XFIXNAT (Flength (sequence));
   if (CHAR_TABLE_P (sequence))
     wrong_type_argument (Qlistp, sequence);
   mapcar1 (leni, 0, function, sequence);
@@ -2671,7 +2670,7 @@ SEQUENCE may be a list, a vector, a bool-vector, or a 
string. */)
      (Lisp_Object function, Lisp_Object sequence)
 {
   USE_SAFE_ALLOCA;
-  EMACS_INT leni = XFASTINT (Flength (sequence));
+  EMACS_INT leni = XFIXNAT (Flength (sequence));
   if (CHAR_TABLE_P (sequence))
     wrong_type_argument (Qlistp, sequence);
   Lisp_Object *args;
@@ -2736,7 +2735,7 @@ if `last-nonmenu-event' is nil, and `use-dialog-box' is 
non-nil.  */)
       Fding (Qnil);
       Fdiscard_input ();
       message1 ("Please answer yes or no.");
-      Fsleep_for (make_number (2), Qnil);
+      Fsleep_for (make_fixnum (2), Qnil);
     }
 }
 
@@ -2768,7 +2767,7 @@ advisable.  */)
   while (loads-- > 0)
     {
       Lisp_Object load = (NILP (use_floats)
-                         ? make_number (100.0 * load_ave[loads])
+                         ? make_fixnum (100.0 * load_ave[loads])
                          : make_float (load_ave[loads]));
       ret = Fcons (load, ret);
     }
@@ -2804,7 +2803,7 @@ particular subfeatures supported in this version of 
FEATURE.  */)
   CHECK_SYMBOL (feature);
   CHECK_LIST (subfeatures);
   if (!NILP (Vautoload_queue))
-    Vautoload_queue = Fcons (Fcons (make_number (0), Vfeatures),
+    Vautoload_queue = Fcons (Fcons (make_fixnum (0), Vfeatures),
                             Vautoload_queue);
   tem = Fmemq (feature, Vfeatures);
   if (NILP (tem))
@@ -3056,7 +3055,7 @@ The data read from the system are decoded using 
`locale-coding-system'.  */)
 #ifdef DAY_1
   else if (EQ (item, Qdays))   /* e.g. for calendar-day-name-array */
     {
-      Lisp_Object v = Fmake_vector (make_number (7), Qnil);
+      Lisp_Object v = Fmake_vector (make_fixnum (7), Qnil);
       const int days[7] = {DAY_1, DAY_2, DAY_3, DAY_4, DAY_5, DAY_6, DAY_7};
       int i;
       synchronize_system_time_locale ();
@@ -3075,7 +3074,7 @@ The data read from the system are decoded using 
`locale-coding-system'.  */)
 #ifdef MON_1
   else if (EQ (item, Qmonths)) /* e.g. for calendar-month-name-array */
     {
-      Lisp_Object v = Fmake_vector (make_number (12), Qnil);
+      Lisp_Object v = Fmake_vector (make_fixnum (12), Qnil);
       const int months[12] = {MON_1, MON_2, MON_3, MON_4, MON_5, MON_6, MON_7,
                              MON_8, MON_9, MON_10, MON_11, MON_12};
       int i;
@@ -3198,9 +3197,9 @@ into shorter lines.  */)
 
   validate_region (&beg, &end);
 
-  ibeg = CHAR_TO_BYTE (XFASTINT (beg));
-  iend = CHAR_TO_BYTE (XFASTINT (end));
-  move_gap_both (XFASTINT (beg), ibeg);
+  ibeg = CHAR_TO_BYTE (XFIXNAT (beg));
+  iend = CHAR_TO_BYTE (XFIXNAT (end));
+  move_gap_both (XFIXNAT (beg), ibeg);
 
   /* We need to allocate enough room for encoding the text.
      We need 33 1/3% more space, plus a newline every 76
@@ -3225,21 +3224,21 @@ into shorter lines.  */)
 
   /* Now we have encoded the region, so we insert the new contents
      and delete the old.  (Insert first in order to preserve markers.)  */
-  SET_PT_BOTH (XFASTINT (beg), ibeg);
+  SET_PT_BOTH (XFIXNAT (beg), ibeg);
   insert (encoded, encoded_length);
   SAFE_FREE ();
   del_range_byte (ibeg + encoded_length, iend + encoded_length);
 
   /* If point was outside of the region, restore it exactly; else just
      move to the beginning of the region.  */
-  if (old_pos >= XFASTINT (end))
-    old_pos += encoded_length - (XFASTINT (end) - XFASTINT (beg));
-  else if (old_pos > XFASTINT (beg))
-    old_pos = XFASTINT (beg);
+  if (old_pos >= XFIXNAT (end))
+    old_pos += encoded_length - (XFIXNAT (end) - XFIXNAT (beg));
+  else if (old_pos > XFIXNAT (beg))
+    old_pos = XFIXNAT (beg);
   SET_PT (old_pos);
 
   /* We return the length of the encoded text. */
-  return make_number (encoded_length);
+  return make_fixnum (encoded_length);
 }
 
 DEFUN ("base64-encode-string", Fbase64_encode_string, Sbase64_encode_string,
@@ -3398,8 +3397,8 @@ If the region can't be decoded, signal an error and don't 
modify the buffer.  */
 
   validate_region (&beg, &end);
 
-  ibeg = CHAR_TO_BYTE (XFASTINT (beg));
-  iend = CHAR_TO_BYTE (XFASTINT (end));
+  ibeg = CHAR_TO_BYTE (XFIXNAT (beg));
+  iend = CHAR_TO_BYTE (XFIXNAT (end));
 
   length = iend - ibeg;
 
@@ -3409,7 +3408,7 @@ If the region can't be decoded, signal an error and don't 
modify the buffer.  */
   allength = multibyte ? length * 2 : length;
   decoded = SAFE_ALLOCA (allength);
 
-  move_gap_both (XFASTINT (beg), ibeg);
+  move_gap_both (XFIXNAT (beg), ibeg);
   decoded_length = base64_decode_1 ((char *) BYTE_POS_ADDR (ibeg),
                                    decoded, length,
                                    multibyte, &inserted_chars);
@@ -3424,24 +3423,24 @@ If the region can't be decoded, signal an error and 
don't modify the buffer.  */
 
   /* Now we have decoded the region, so we insert the new contents
      and delete the old.  (Insert first in order to preserve markers.)  */
-  TEMP_SET_PT_BOTH (XFASTINT (beg), ibeg);
+  TEMP_SET_PT_BOTH (XFIXNAT (beg), ibeg);
   insert_1_both (decoded, inserted_chars, decoded_length, 0, 1, 0);
-  signal_after_change (XFASTINT (beg), 0, inserted_chars);
+  signal_after_change (XFIXNAT (beg), 0, inserted_chars);
   SAFE_FREE ();
 
   /* Delete the original text.  */
-  del_range_both (PT, PT_BYTE, XFASTINT (end) + inserted_chars,
+  del_range_both (PT, PT_BYTE, XFIXNAT (end) + inserted_chars,
                  iend + decoded_length, 1);
 
   /* If point was outside of the region, restore it exactly; else just
      move to the beginning of the region.  */
-  if (old_pos >= XFASTINT (end))
-    old_pos += inserted_chars - (XFASTINT (end) - XFASTINT (beg));
-  else if (old_pos > XFASTINT (beg))
-    old_pos = XFASTINT (beg);
+  if (old_pos >= XFIXNAT (end))
+    old_pos += inserted_chars - (XFIXNAT (end) - XFIXNAT (beg));
+  else if (old_pos > XFIXNAT (beg))
+    old_pos = XFIXNAT (beg);
   SET_PT (old_pos > ZV ? ZV : old_pos);
 
-  return make_number (inserted_chars);
+  return make_fixnum (inserted_chars);
 }
 
 DEFUN ("base64-decode-string", Fbase64_decode_string, Sbase64_decode_string,
@@ -3612,7 +3611,7 @@ set_hash_next (struct Lisp_Hash_Table *h, Lisp_Object 
next)
 static void
 set_hash_next_slot (struct Lisp_Hash_Table *h, ptrdiff_t idx, ptrdiff_t val)
 {
-  gc_aset (h->next, idx, make_number (val));
+  gc_aset (h->next, idx, make_fixnum (val));
 }
 static void
 set_hash_hash (struct Lisp_Hash_Table *h, Lisp_Object hash)
@@ -3632,7 +3631,7 @@ set_hash_index (struct Lisp_Hash_Table *h, Lisp_Object 
index)
 static void
 set_hash_index_slot (struct Lisp_Hash_Table *h, ptrdiff_t idx, ptrdiff_t val)
 {
-  gc_aset (h->index, idx, make_number (val));
+  gc_aset (h->index, idx, make_fixnum (val));
 }
 
 /* If OBJ is a Lisp hash table, return a pointer to its struct
@@ -3735,7 +3734,7 @@ larger_vector (Lisp_Object vec, ptrdiff_t incr_min, 
ptrdiff_t nitems_max)
 static ptrdiff_t
 HASH_NEXT (struct Lisp_Hash_Table *h, ptrdiff_t idx)
 {
-  return XINT (AREF (h->next, idx));
+  return XFIXNUM (AREF (h->next, idx));
 }
 
 /* Return the index of the element in hash table H that is the start
@@ -3744,7 +3743,7 @@ HASH_NEXT (struct Lisp_Hash_Table *h, ptrdiff_t idx)
 static ptrdiff_t
 HASH_INDEX (struct Lisp_Hash_Table *h, ptrdiff_t idx)
 {
-  return XINT (AREF (h->index, idx));
+  return XFIXNUM (AREF (h->index, idx));
 }
 
 /* Compare KEY1 and KEY2 in hash table HT using `eql'.  Value is true
@@ -3755,7 +3754,13 @@ cmpfn_eql (struct hash_table_test *ht,
           Lisp_Object key1,
           Lisp_Object key2)
 {
-  return FLOATP (key1) && FLOATP (key2) && same_float (key1, key2);
+  if (FLOATP (key1)
+      && FLOATP (key2)
+      && same_float (key1, key2))
+    return true;
+  return (BIGNUMP (key1)
+         && BIGNUMP (key2)
+         && mpz_cmp (XBIGNUM (key1)->value, XBIGNUM (key2)->value) == 0);
 }
 
 
@@ -3809,7 +3814,9 @@ hashfn_equal (struct hash_table_test *ht, Lisp_Object key)
 static EMACS_UINT
 hashfn_eql (struct hash_table_test *ht, Lisp_Object key)
 {
-  return FLOATP (key) ? hashfn_equal (ht, key) : hashfn_eq (ht, key);
+  return ((FLOATP (key) || BIGNUMP (key))
+         ? hashfn_equal (ht, key)
+         : hashfn_eq (ht, key));
 }
 
 /* Value is a hash code for KEY for use in hash table H which uses as
@@ -3908,10 +3915,10 @@ make_hash_table (struct hash_table_test test, EMACS_INT 
size,
   h->rehash_threshold = rehash_threshold;
   h->rehash_size = rehash_size;
   h->count = 0;
-  h->key_and_value = Fmake_vector (make_number (2 * size), Qnil);
-  h->hash = Fmake_vector (make_number (size), Qnil);
-  h->next = Fmake_vector (make_number (size), make_number (-1));
-  h->index = Fmake_vector (make_number (index_size), make_number (-1));
+  h->key_and_value = Fmake_vector (make_fixnum (2 * size), Qnil);
+  h->hash = Fmake_vector (make_fixnum (size), Qnil);
+  h->next = Fmake_vector (make_fixnum (size), make_fixnum (-1));
+  h->index = Fmake_vector (make_fixnum (index_size), make_fixnum (-1));
   h->pure = pure;
 
   /* Set up the free list.  */
@@ -4006,8 +4013,8 @@ maybe_resize_hash_table (struct Lisp_Hash_Table *h)
       set_hash_key_and_value (h, larger_vector (h->key_and_value,
                                                2 * (new_size - old_size), -1));
       set_hash_hash (h, larger_vector (h->hash, new_size - old_size, -1));
-      set_hash_index (h, Fmake_vector (make_number (index_size),
-                                      make_number (-1)));
+      set_hash_index (h, Fmake_vector (make_fixnum (index_size),
+                                      make_fixnum (-1)));
       set_hash_next (h, larger_vecalloc (h->next, new_size - old_size, -1));
 
       /* Update the free list.  Do it so that new entries are added at
@@ -4036,7 +4043,7 @@ maybe_resize_hash_table (struct Lisp_Hash_Table *h)
       for (i = 0; i < old_size; ++i)
        if (!NILP (HASH_HASH (h, i)))
          {
-           EMACS_UINT hash_code = XUINT (HASH_HASH (h, i));
+           EMACS_UINT hash_code = XUFIXNUM (HASH_HASH (h, i));
            ptrdiff_t start_of_bucket = hash_code % ASIZE (h->index);
            set_hash_next_slot (h, i, HASH_INDEX (h, start_of_bucket));
            set_hash_index_slot (h, start_of_bucket, i);
@@ -4065,7 +4072,7 @@ hash_lookup (struct Lisp_Hash_Table *h, Lisp_Object key, 
EMACS_UINT *hash)
   for (i = HASH_INDEX (h, start_of_bucket); 0 <= i; i = HASH_NEXT (h, i))
     if (EQ (key, HASH_KEY (h, i))
        || (h->test.cmpfn
-           && hash_code == XUINT (HASH_HASH (h, i))
+           && hash_code == XUFIXNUM (HASH_HASH (h, i))
            && h->test.cmpfn (&h->test, key, HASH_KEY (h, i))))
       break;
 
@@ -4096,7 +4103,7 @@ hash_put (struct Lisp_Hash_Table *h, Lisp_Object key, 
Lisp_Object value,
   set_hash_value_slot (h, i, value);
 
   /* Remember its hash code.  */
-  set_hash_hash_slot (h, i, make_number (hash));
+  set_hash_hash_slot (h, i, make_fixnum (hash));
 
   /* Add new entry to its collision chain.  */
   start_of_bucket = hash % ASIZE (h->index);
@@ -4122,7 +4129,7 @@ hash_remove_from_table (struct Lisp_Hash_Table *h, 
Lisp_Object key)
     {
       if (EQ (key, HASH_KEY (h, i))
          || (h->test.cmpfn
-             && hash_code == XUINT (HASH_HASH (h, i))
+             && hash_code == XUFIXNUM (HASH_HASH (h, i))
              && h->test.cmpfn (&h->test, key, HASH_KEY (h, i))))
        {
          /* Take entry out of collision chain.  */
@@ -4166,7 +4173,7 @@ hash_clear (struct Lisp_Hash_Table *h)
        }
 
       for (i = 0; i < ASIZE (h->index); ++i)
-       ASET (h->index, i, make_number (-1));
+       ASET (h->index, i, make_fixnum (-1));
 
       h->next_free = 0;
       h->count = 0;
@@ -4433,6 +4440,20 @@ sxhash_bool_vector (Lisp_Object vec)
   return SXHASH_REDUCE (hash);
 }
 
+/* Return a hash for a bignum.  */
+
+static EMACS_UINT
+sxhash_bignum (struct Lisp_Bignum *bignum)
+{
+  size_t i, nlimbs = mpz_size (bignum->value);
+  EMACS_UINT hash = 0;
+
+  for (i = 0; i < nlimbs; ++i)
+    hash = sxhash_combine (hash, mpz_getlimbn (bignum->value, i));
+
+  return SXHASH_REDUCE (hash);
+}
+
 
 /* Return a hash code for OBJ.  DEPTH is the current depth in the Lisp
    structure.  Value is an unsigned integer clipped to INTMASK.  */
@@ -4448,10 +4469,9 @@ sxhash (Lisp_Object obj, int depth)
   switch (XTYPE (obj))
     {
     case_Lisp_Int:
-      hash = XUINT (obj);
+      hash = XUFIXNUM (obj);
       break;
 
-    case Lisp_Misc:
     case Lisp_Symbol:
       hash = XHASH (obj);
       break;
@@ -4462,7 +4482,9 @@ sxhash (Lisp_Object obj, int depth)
 
       /* This can be everything from a vector to an overlay.  */
     case Lisp_Vectorlike:
-      if (VECTORP (obj) || RECORDP (obj))
+      if (BIGNUMP (obj))
+       hash = sxhash_bignum (XBIGNUM (obj));
+      else if (VECTORP (obj) || RECORDP (obj))
        /* According to the CL HyperSpec, two arrays are equal only if
           they are `eq', except for strings and bit-vectors.  In
           Emacs, this works differently.  We have to compare element
@@ -4502,7 +4524,7 @@ DEFUN ("sxhash-eq", Fsxhash_eq, Ssxhash_eq, 1, 1, 0,
 If (eq A B), then (= (sxhash-eq A) (sxhash-eq B)).  */)
   (Lisp_Object obj)
 {
-  return make_number (hashfn_eq (NULL, obj));
+  return make_fixnum (hashfn_eq (NULL, obj));
 }
 
 DEFUN ("sxhash-eql", Fsxhash_eql, Ssxhash_eql, 1, 1, 0,
@@ -4510,7 +4532,7 @@ DEFUN ("sxhash-eql", Fsxhash_eql, Ssxhash_eql, 1, 1, 0,
 If (eql A B), then (= (sxhash-eql A) (sxhash-eql B)).  */)
   (Lisp_Object obj)
 {
-  return make_number (hashfn_eql (NULL, obj));
+  return make_fixnum (hashfn_eql (NULL, obj));
 }
 
 DEFUN ("sxhash-equal", Fsxhash_equal, Ssxhash_equal, 1, 1, 0,
@@ -4518,7 +4540,7 @@ DEFUN ("sxhash-equal", Fsxhash_equal, Ssxhash_equal, 1, 
1, 0,
 If (equal A B), then (= (sxhash-equal A) (sxhash-equal B)).  */)
   (Lisp_Object obj)
 {
-  return make_number (hashfn_equal (NULL, obj));
+  return make_fixnum (hashfn_equal (NULL, obj));
 }
 
 DEFUN ("make-hash-table", Fmake_hash_table, Smake_hash_table, 0, MANY, 0,
@@ -4604,8 +4626,8 @@ usage: (make-hash-table &rest KEYWORD-ARGS)  */)
   EMACS_INT size;
   if (NILP (size_arg))
     size = DEFAULT_HASH_SIZE;
-  else if (NATNUMP (size_arg))
-    size = XFASTINT (size_arg);
+  else if (FIXNATP (size_arg))
+    size = XFIXNAT (size_arg);
   else
     signal_error ("Invalid hash table size", size_arg);
 
@@ -4614,8 +4636,8 @@ usage: (make-hash-table &rest KEYWORD-ARGS)  */)
   i = get_key_arg (QCrehash_size, nargs, args, used);
   if (!i)
     rehash_size = DEFAULT_REHASH_SIZE;
-  else if (INTEGERP (args[i]) && 0 < XINT (args[i]))
-    rehash_size = - XINT (args[i]);
+  else if (FIXNUMP (args[i]) && 0 < XFIXNUM (args[i]))
+    rehash_size = - XFIXNUM (args[i]);
   else if (FLOATP (args[i]) && 0 < (float) (XFLOAT_DATA (args[i]) - 1))
     rehash_size = (float) (XFLOAT_DATA (args[i]) - 1);
   else
@@ -4664,7 +4686,7 @@ DEFUN ("hash-table-count", Fhash_table_count, 
Shash_table_count, 1, 1, 0,
        doc: /* Return the number of elements in TABLE.  */)
   (Lisp_Object table)
 {
-  return make_number (check_hash_table (table)->count);
+  return make_fixnum (check_hash_table (table)->count);
 }
 
 
@@ -4677,7 +4699,7 @@ DEFUN ("hash-table-rehash-size", Fhash_table_rehash_size,
   if (rehash_size < 0)
     {
       EMACS_INT s = -rehash_size;
-      return make_number (min (s, MOST_POSITIVE_FIXNUM));
+      return make_fixnum (min (s, MOST_POSITIVE_FIXNUM));
     }
   else
     return make_float (rehash_size + 1);
@@ -4701,7 +4723,7 @@ without need for resizing.  */)
   (Lisp_Object table)
 {
   struct Lisp_Hash_Table *h = check_hash_table (table);
-  return make_number (HASH_TABLE_SIZE (h));
+  return make_fixnum (HASH_TABLE_SIZE (h));
 }
 
 
@@ -4929,16 +4951,16 @@ extract_data_from_object (Lisp_Object spec,
        b = BEGV;
       else
        {
-         CHECK_NUMBER_COERCE_MARKER (start);
-         b = XINT (start);
+         CHECK_FIXNUM_COERCE_MARKER (start);
+         b = XFIXNUM (start);
        }
 
       if (NILP (end))
        e = ZV;
       else
        {
-         CHECK_NUMBER_COERCE_MARKER (end);
-         e = XINT (end);
+         CHECK_FIXNUM_COERCE_MARKER (end);
+         e = XFIXNUM (end);
        }
 
       if (b > e)
@@ -4993,7 +5015,7 @@ extract_data_from_object (Lisp_Object spec,
                  && !NILP (Ffboundp (Vselect_safe_coding_system_function)))
                /* Confirm that VAL can surely encode the current region.  */
                coding_system = call4 (Vselect_safe_coding_system_function,
-                                      make_number (b), make_number (e),
+                                      make_fixnum (b), make_fixnum (e),
                                       coding_system, Qnil);
 
              if (force_raw_text)
@@ -5027,11 +5049,11 @@ extract_data_from_object (Lisp_Object spec,
 #ifdef HAVE_GNUTLS3
       /* Format: (iv-auto REQUIRED-LENGTH).  */
 
-      if (! NATNUMP (start))
+      if (! FIXNATP (start))
         error ("Without a length, `iv-auto' can't be used; see ELisp manual");
       else
         {
-         EMACS_INT start_hold = XFASTINT (start);
+         EMACS_INT start_hold = XFIXNAT (start);
           object = make_uninit_string (start_hold);
           gnutls_rnd (GNUTLS_RND_NONCE, SSDATA (object), start_hold);
 
diff --git a/src/font.c b/src/font.c
index 3a82e50..920ec1e 100644
--- a/src/font.c
+++ b/src/font.c
@@ -201,7 +201,7 @@ font_make_object (int size, Lisp_Object entity, int 
pixelsize)
          = Fcopy_alist (AREF (entity, FONT_EXTRA_INDEX));
     }
   if (size > 0)
-    font->props[FONT_SIZE_INDEX] = make_number (pixelsize);
+    font->props[FONT_SIZE_INDEX] = make_fixnum (pixelsize);
   return font_object;
 }
 
@@ -270,7 +270,7 @@ font_intern_prop (const char *str, ptrdiff_t len, bool 
force_symbol)
               (n += str[i++] - '0') <= MOST_POSITIVE_FIXNUM; )
            {
              if (i == len)
-               return make_number (n);
+               return make_fixnum (n);
              if (INT_MULTIPLY_WRAPV (n, 10, &n))
                break;
            }
@@ -302,8 +302,8 @@ font_pixel_size (struct frame *f, Lisp_Object spec)
   int dpi, pixel_size;
   Lisp_Object val;
 
-  if (INTEGERP (size))
-    return XINT (size);
+  if (FIXNUMP (size))
+    return XFIXNUM (size);
   if (NILP (size))
     return 0;
   if (FRAME_WINDOW_P (f))
@@ -311,8 +311,8 @@ font_pixel_size (struct frame *f, Lisp_Object spec)
       eassert (FLOATP (size));
       point_size = XFLOAT_DATA (size);
       val = AREF (spec, FONT_DPI_INDEX);
-      if (INTEGERP (val))
-       dpi = XINT (val);
+      if (FIXNUMP (val))
+       dpi = XFIXNUM (val);
       else
        dpi = FRAME_RES_Y (f);
       pixel_size = POINT_TO_PIXEL (point_size, dpi);
@@ -353,8 +353,8 @@ font_style_to_value (enum font_property_index prop, 
Lisp_Object val,
          for (j = 1; j < ASIZE (AREF (table, i)); j++)
            if (EQ (val, AREF (AREF (table, i), j)))
              {
-               CHECK_NUMBER (AREF (AREF (table, i), 0));
-               return ((XINT (AREF (AREF (table, i), 0)) << 8)
+               CHECK_FIXNUM (AREF (AREF (table, i), 0));
+               return ((XFIXNUM (AREF (AREF (table, i), 0)) << 8)
                        | (i << 4) | (j - 1));
              }
        }
@@ -366,32 +366,32 @@ font_style_to_value (enum font_property_index prop, 
Lisp_Object val,
            elt = AREF (AREF (table, i), j);
            if (xstrcasecmp (s, SSDATA (SYMBOL_NAME (elt))) == 0)
              {
-               CHECK_NUMBER (AREF (AREF (table, i), 0));
-               return ((XINT (AREF (AREF (table, i), 0)) << 8)
+               CHECK_FIXNUM (AREF (AREF (table, i), 0));
+               return ((XFIXNUM (AREF (AREF (table, i), 0)) << 8)
                        | (i << 4) | (j - 1));
              }
          }
       if (! noerror)
        return -1;
       eassert (len < 255);
-      elt = Fmake_vector (make_number (2), make_number (100));
+      elt = Fmake_vector (make_fixnum (2), make_fixnum (100));
       ASET (elt, 1, val);
       ASET (font_style_table, prop - FONT_WEIGHT_INDEX,
-           CALLN (Fvconcat, table, Fmake_vector (make_number (1), elt)));
+           CALLN (Fvconcat, table, Fmake_vector (make_fixnum (1), elt)));
       return (100 << 8) | (i << 4);
     }
   else
     {
       int i, last_n;
-      EMACS_INT numeric = XINT (val);
+      EMACS_INT numeric = XFIXNUM (val);
 
       for (i = 0, last_n = -1; i < len; i++)
        {
          int n;
 
          CHECK_VECTOR (AREF (table, i));
-         CHECK_NUMBER (AREF (AREF (table, i), 0));
-         n = XINT (AREF (AREF (table, i), 0));
+         CHECK_FIXNUM (AREF (AREF (table, i), 0));
+         n = XFIXNUM (AREF (AREF (table, i), 0));
          if (numeric == n)
            return (n << 8) | (i << 4);
          if (numeric < n)
@@ -421,7 +421,7 @@ font_style_symbolic (Lisp_Object font, enum 
font_property_index prop,
     return Qnil;
   table = AREF (font_style_table, prop - FONT_WEIGHT_INDEX);
   CHECK_VECTOR (table);
-  i = XINT (val) & 0xFF;
+  i = XFIXNUM (val) & 0xFF;
   eassert (((i >> 4) & 0xF) < ASIZE (table));
   elt = AREF (table, ((i >> 4) & 0xF));
   CHECK_VECTOR (elt);
@@ -470,33 +470,33 @@ font_registry_charsets (Lisp_Object registry, struct 
charset **encoding, struct
       val = XCDR (val);
       if (NILP (val))
        return -1;
-      encoding_id = XINT (XCAR (val));
-      repertory_id = XINT (XCDR (val));
+      encoding_id = XFIXNUM (XCAR (val));
+      repertory_id = XFIXNUM (XCDR (val));
     }
   else
     {
       val = find_font_encoding (SYMBOL_NAME (registry));
       if (SYMBOLP (val) && CHARSETP (val))
        {
-         encoding_id = repertory_id = XINT (CHARSET_SYMBOL_ID (val));
+         encoding_id = repertory_id = XFIXNUM (CHARSET_SYMBOL_ID (val));
        }
       else if (CONSP (val))
        {
          if (! CHARSETP (XCAR (val)))
            goto invalid_entry;
-         encoding_id = XINT (CHARSET_SYMBOL_ID (XCAR (val)));
+         encoding_id = XFIXNUM (CHARSET_SYMBOL_ID (XCAR (val)));
          if (NILP (XCDR (val)))
            repertory_id = -1;
          else
            {
              if (! CHARSETP (XCDR (val)))
                goto invalid_entry;
-             repertory_id = XINT (CHARSET_SYMBOL_ID (XCDR (val)));
+             repertory_id = XFIXNUM (CHARSET_SYMBOL_ID (XCDR (val)));
            }
        }
       else
        goto invalid_entry;
-      val = Fcons (make_number (encoding_id), make_number (repertory_id));
+      val = Fcons (make_fixnum (encoding_id), make_fixnum (repertory_id));
       font_charset_alist
        = nconc2 (font_charset_alist, list1 (Fcons (registry, val)));
     }
@@ -543,9 +543,9 @@ font_prop_validate_style (Lisp_Object style, Lisp_Object 
val)
   enum font_property_index prop = (EQ (style, QCweight) ? FONT_WEIGHT_INDEX
                                   : EQ (style, QCslant) ? FONT_SLANT_INDEX
                                   : FONT_WIDTH_INDEX);
-  if (INTEGERP (val))
+  if (FIXNUMP (val))
     {
-      EMACS_INT n = XINT (val);
+      EMACS_INT n = XFIXNUM (val);
       CHECK_VECTOR (AREF (font_style_table, prop - FONT_WEIGHT_INDEX));
       if (((n >> 4) & 0xF)
          >= ASIZE (AREF (font_style_table, prop - FONT_WEIGHT_INDEX)))
@@ -559,8 +559,8 @@ font_prop_validate_style (Lisp_Object style, Lisp_Object 
val)
            val = Qerror;
          else
            {
-             CHECK_NUMBER (AREF (elt, 0));
-             if (XINT (AREF (elt, 0)) != (n >> 8))
+             CHECK_FIXNUM (AREF (elt, 0));
+             if (XFIXNUM (AREF (elt, 0)) != (n >> 8))
                val = Qerror;
            }
        }
@@ -569,7 +569,7 @@ font_prop_validate_style (Lisp_Object style, Lisp_Object 
val)
     {
       int n = font_style_to_value (prop, val, 0);
 
-      val = n >= 0 ? make_number (n) : Qerror;
+      val = n >= 0 ? make_fixnum (n) : Qerror;
     }
   else
     val = Qerror;
@@ -579,27 +579,27 @@ font_prop_validate_style (Lisp_Object style, Lisp_Object 
val)
 static Lisp_Object
 font_prop_validate_non_neg (Lisp_Object prop, Lisp_Object val)
 {
-  return (NATNUMP (val) || (FLOATP (val) && XFLOAT_DATA (val) >= 0)
+  return (FIXNATP (val) || (FLOATP (val) && XFLOAT_DATA (val) >= 0)
          ? val : Qerror);
 }
 
 static Lisp_Object
 font_prop_validate_spacing (Lisp_Object prop, Lisp_Object val)
 {
-  if (NILP (val) || (NATNUMP (val) && XINT (val) <= FONT_SPACING_CHARCELL))
+  if (NILP (val) || (FIXNATP (val) && XFIXNUM (val) <= FONT_SPACING_CHARCELL))
     return val;
   if (SYMBOLP (val) && SBYTES (SYMBOL_NAME (val)) == 1)
     {
       char spacing = SDATA (SYMBOL_NAME (val))[0];
 
       if (spacing == 'c' || spacing == 'C')
-       return make_number (FONT_SPACING_CHARCELL);
+       return make_fixnum (FONT_SPACING_CHARCELL);
       if (spacing == 'm' || spacing == 'M')
-       return make_number (FONT_SPACING_MONO);
+       return make_fixnum (FONT_SPACING_MONO);
       if (spacing == 'p' || spacing == 'P')
-       return make_number (FONT_SPACING_PROPORTIONAL);
+       return make_fixnum (FONT_SPACING_PROPORTIONAL);
       if (spacing == 'd' || spacing == 'D')
-       return make_number (FONT_SPACING_DUAL);
+       return make_fixnum (FONT_SPACING_DUAL);
     }
   return Qerror;
 }
@@ -875,9 +875,9 @@ font_expand_wildcards (Lisp_Object *field, int n)
          int from, to;
          unsigned mask;
 
-         if (INTEGERP (val))
+         if (FIXNUMP (val))
            {
-             EMACS_INT numeric = XINT (val);
+             EMACS_INT numeric = XFIXNUM (val);
 
              if (i + 1 == n)
                from = to = XLFD_ENCODING_INDEX,
@@ -999,7 +999,7 @@ font_expand_wildcards (Lisp_Object *field, int n)
   if (! NILP (tmp[n - 1]) && j < XLFD_REGISTRY_INDEX)
     return -1;
   memclear (field + j, (XLFD_LAST_INDEX - j) * word_size);
-  if (INTEGERP (field[XLFD_ENCODING_INDEX]))
+  if (FIXNUMP (field[XLFD_ENCODING_INDEX]))
     field[XLFD_ENCODING_INDEX]
       = Fintern (Fnumber_to_string (field[XLFD_ENCODING_INDEX]), Qnil);
   return 0;
@@ -1064,7 +1064,7 @@ font_parse_xlfd (char *name, ptrdiff_t len, Lisp_Object 
font)
            {
              if ((n = font_style_to_value (j, INTERN_FIELD_SYM (i), 0)) < 0)
                return -1;
-             ASET (font, j, make_number (n));
+             ASET (font, j, make_fixnum (n));
            }
        }
       ASET (font, FONT_ADSTYLE_INDEX, INTERN_FIELD_SYM (XLFD_ADSTYLE_INDEX));
@@ -1077,11 +1077,11 @@ font_parse_xlfd (char *name, ptrdiff_t len, Lisp_Object 
font)
                                1));
       p = f[XLFD_PIXEL_INDEX];
       if (*p == '[' && (pixel_size = parse_matrix (p)) >= 0)
-       ASET (font, FONT_SIZE_INDEX, make_number (pixel_size));
+       ASET (font, FONT_SIZE_INDEX, make_fixnum (pixel_size));
       else
        {
          val = INTERN_FIELD (XLFD_PIXEL_INDEX);
-         if (INTEGERP (val))
+         if (FIXNUMP (val))
            ASET (font, FONT_SIZE_INDEX, val);
          else if (FONT_ENTITY_P (font))
            return -1;
@@ -1101,14 +1101,14 @@ font_parse_xlfd (char *name, ptrdiff_t len, Lisp_Object 
font)
        }
 
       val = INTERN_FIELD (XLFD_RESY_INDEX);
-      if (! NILP (val) && ! INTEGERP (val))
+      if (! NILP (val) && ! FIXNUMP (val))
        return -1;
       ASET (font, FONT_DPI_INDEX, val);
       val = INTERN_FIELD (XLFD_SPACING_INDEX);
       if (! NILP (val))
        {
          val = font_prop_validate_spacing (QCspacing, val);
-         if (! INTEGERP (val))
+         if (! FIXNUMP (val))
            return -1;
          ASET (font, FONT_SPACING_INDEX, val);
        }
@@ -1116,7 +1116,7 @@ font_parse_xlfd (char *name, ptrdiff_t len, Lisp_Object 
font)
       if (*p == '~')
        p++;
       val = font_intern_prop (p, f[XLFD_REGISTRY_INDEX] - 1 - p, 0);
-      if (! NILP (val) && ! INTEGERP (val))
+      if (! NILP (val) && ! FIXNUMP (val))
        return -1;
       ASET (font, FONT_AVGWIDTH_INDEX, val);
     }
@@ -1154,7 +1154,7 @@ font_parse_xlfd (char *name, ptrdiff_t len, Lisp_Object 
font)
          {
            if ((n = font_style_to_value (j, prop[i], 1)) < 0)
              return -1;
-           ASET (font, j, make_number (n));
+           ASET (font, j, make_fixnum (n));
          }
       ASET (font, FONT_ADSTYLE_INDEX, prop[XLFD_ADSTYLE_INDEX]);
       val = prop[XLFD_REGISTRY_INDEX];
@@ -1181,26 +1181,26 @@ font_parse_xlfd (char *name, ptrdiff_t len, Lisp_Object 
font)
       if (! NILP (val))
        ASET (font, FONT_REGISTRY_INDEX, Fintern (val, Qnil));
 
-      if (INTEGERP (prop[XLFD_PIXEL_INDEX]))
+      if (FIXNUMP (prop[XLFD_PIXEL_INDEX]))
        ASET (font, FONT_SIZE_INDEX, prop[XLFD_PIXEL_INDEX]);
-      else if (INTEGERP (prop[XLFD_POINT_INDEX]))
+      else if (FIXNUMP (prop[XLFD_POINT_INDEX]))
        {
-         double point_size = XINT (prop[XLFD_POINT_INDEX]);
+         double point_size = XFIXNUM (prop[XLFD_POINT_INDEX]);
 
          ASET (font, FONT_SIZE_INDEX, make_float (point_size / 10));
        }
 
-      if (INTEGERP (prop[XLFD_RESX_INDEX]))
+      if (FIXNUMP (prop[XLFD_RESX_INDEX]))
        ASET (font, FONT_DPI_INDEX, prop[XLFD_RESY_INDEX]);
       if (! NILP (prop[XLFD_SPACING_INDEX]))
        {
          val = font_prop_validate_spacing (QCspacing,
                                            prop[XLFD_SPACING_INDEX]);
-         if (! INTEGERP (val))
+         if (! FIXNUMP (val))
            return -1;
          ASET (font, FONT_SPACING_INDEX, val);
        }
-      if (INTEGERP (prop[XLFD_AVGWIDTH_INDEX]))
+      if (FIXNUMP (prop[XLFD_AVGWIDTH_INDEX]))
        ASET (font, FONT_AVGWIDTH_INDEX, prop[XLFD_AVGWIDTH_INDEX]);
     }
 
@@ -1283,13 +1283,13 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, 
char *name, int nbytes)
     }
 
   val = AREF (font, FONT_SIZE_INDEX);
-  eassert (NUMBERP (val) || NILP (val));
+  eassert (FIXED_OR_FLOATP (val) || NILP (val));
   char font_size_index_buf[sizeof "-*"
                           + max (INT_STRLEN_BOUND (EMACS_INT),
                                  1 + DBL_MAX_10_EXP + 1)];
-  if (INTEGERP (val))
+  if (FIXNUMP (val))
     {
-      EMACS_INT v = XINT (val);
+      EMACS_INT v = XFIXNUM (val);
       if (v <= 0)
        v = pixel_size;
       if (v > 0)
@@ -1310,18 +1310,18 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, 
char *name, int nbytes)
     f[XLFD_PIXEL_INDEX] = "*-*";
 
   char dpi_index_buf[sizeof "-" + 2 * INT_STRLEN_BOUND (EMACS_INT)];
-  if (INTEGERP (AREF (font, FONT_DPI_INDEX)))
+  if (FIXNUMP (AREF (font, FONT_DPI_INDEX)))
     {
-      EMACS_INT v = XINT (AREF (font, FONT_DPI_INDEX));
+      EMACS_INT v = XFIXNUM (AREF (font, FONT_DPI_INDEX));
       f[XLFD_RESX_INDEX] = p = dpi_index_buf;
       sprintf (p, "%"pI"d-%"pI"d", v, v);
     }
   else
     f[XLFD_RESX_INDEX] = "*-*";
 
-  if (INTEGERP (AREF (font, FONT_SPACING_INDEX)))
+  if (FIXNUMP (AREF (font, FONT_SPACING_INDEX)))
     {
-      EMACS_INT spacing = XINT (AREF (font, FONT_SPACING_INDEX));
+      EMACS_INT spacing = XFIXNUM (AREF (font, FONT_SPACING_INDEX));
 
       f[XLFD_SPACING_INDEX] = (spacing <= FONT_SPACING_PROPORTIONAL ? "p"
                               : spacing <= FONT_SPACING_DUAL ? "d"
@@ -1332,10 +1332,10 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, 
char *name, int nbytes)
     f[XLFD_SPACING_INDEX] = "*";
 
   char avgwidth_index_buf[INT_BUFSIZE_BOUND (EMACS_INT)];
-  if (INTEGERP (AREF (font,  FONT_AVGWIDTH_INDEX)))
+  if (FIXNUMP (AREF (font,  FONT_AVGWIDTH_INDEX)))
     {
       f[XLFD_AVGWIDTH_INDEX] = p = avgwidth_index_buf;
-      sprintf (p, "%"pI"d", XINT (AREF (font, FONT_AVGWIDTH_INDEX)));
+      sprintf (p, "%"pI"d", XFIXNUM (AREF (font, FONT_AVGWIDTH_INDEX)));
     }
   else
     f[XLFD_AVGWIDTH_INDEX] = "*";
@@ -1456,19 +1456,19 @@ font_parse_fcname (char *name, ptrdiff_t len, 
Lisp_Object font)
                    FONT_SET_STYLE (font, FONT_SLANT_INDEX, val);
                  else if (PROP_MATCH ("charcell"))
                    ASET (font, FONT_SPACING_INDEX,
-                         make_number (FONT_SPACING_CHARCELL));
+                         make_fixnum (FONT_SPACING_CHARCELL));
                  else if (PROP_MATCH ("mono"))
                    ASET (font, FONT_SPACING_INDEX,
-                         make_number (FONT_SPACING_MONO));
+                         make_fixnum (FONT_SPACING_MONO));
                  else if (PROP_MATCH ("proportional"))
                    ASET (font, FONT_SPACING_INDEX,
-                         make_number (FONT_SPACING_PROPORTIONAL));
+                         make_fixnum (FONT_SPACING_PROPORTIONAL));
 #undef PROP_MATCH
                }
              else
                {
                  /* KEY=VAL pairs  */
-                 Lisp_Object key;
+                 Lisp_Object key UNINIT;
                  int prop;
 
                  if (q - p == 10 && memcmp (p + 1, "pixelsize", 9) == 0)
@@ -1621,10 +1621,10 @@ font_unparse_fcname (Lisp_Object font, int pixel_size, 
char *name, int nbytes)
     }
 
   val = AREF (font, FONT_SIZE_INDEX);
-  if (INTEGERP (val))
+  if (FIXNUMP (val))
     {
-      if (XINT (val) != 0)
-       pixel_size = XINT (val);
+      if (XFIXNUM (val) != 0)
+       pixel_size = XFIXNUM (val);
       point_size = -1;
     }
   else
@@ -1688,28 +1688,28 @@ font_unparse_fcname (Lisp_Object font, int pixel_size, 
char *name, int nbytes)
        p += len;
       }
 
-  if (INTEGERP (AREF (font, FONT_DPI_INDEX)))
+  if (FIXNUMP (AREF (font, FONT_DPI_INDEX)))
     {
       int len = snprintf (p, lim - p, ":dpi=%"pI"d",
-                         XINT (AREF (font, FONT_DPI_INDEX)));
+                         XFIXNUM (AREF (font, FONT_DPI_INDEX)));
       if (! (0 <= len && len < lim - p))
        return -1;
       p += len;
     }
 
-  if (INTEGERP (AREF (font, FONT_SPACING_INDEX)))
+  if (FIXNUMP (AREF (font, FONT_SPACING_INDEX)))
     {
       int len = snprintf (p, lim - p, ":spacing=%"pI"d",
-                         XINT (AREF (font, FONT_SPACING_INDEX)));
+                         XFIXNUM (AREF (font, FONT_SPACING_INDEX)));
       if (! (0 <= len && len < lim - p))
        return -1;
       p += len;
     }
 
-  if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX)))
+  if (FIXNUMP (AREF (font, FONT_AVGWIDTH_INDEX)))
     {
       int len = snprintf (p, lim - p,
-                         (XINT (AREF (font, FONT_AVGWIDTH_INDEX)) == 0
+                         (XFIXNUM (AREF (font, FONT_AVGWIDTH_INDEX)) == 0
                           ? ":scalable=true"
                           : ":scalable=false"));
       if (! (0 <= len && len < lim - p))
@@ -1807,15 +1807,15 @@ check_gstring (Lisp_Object gstring)
     goto err;
   CHECK_FONT_OBJECT (LGSTRING_FONT (gstring));
   if (!NILP (LGSTRING_SLOT (gstring, LGSTRING_IX_LBEARING)))
-    CHECK_NUMBER (LGSTRING_SLOT (gstring, LGSTRING_IX_LBEARING));
+    CHECK_FIXNUM (LGSTRING_SLOT (gstring, LGSTRING_IX_LBEARING));
   if (!NILP (LGSTRING_SLOT (gstring, LGSTRING_IX_RBEARING)))
-    CHECK_NUMBER (LGSTRING_SLOT (gstring, LGSTRING_IX_RBEARING));
+    CHECK_FIXNUM (LGSTRING_SLOT (gstring, LGSTRING_IX_RBEARING));
   if (!NILP (LGSTRING_SLOT (gstring, LGSTRING_IX_WIDTH)))
-    CHECK_NATNUM (LGSTRING_SLOT (gstring, LGSTRING_IX_WIDTH));
+    CHECK_FIXNAT (LGSTRING_SLOT (gstring, LGSTRING_IX_WIDTH));
   if (!NILP (LGSTRING_SLOT (gstring, LGSTRING_IX_ASCENT)))
-    CHECK_NUMBER (LGSTRING_SLOT (gstring, LGSTRING_IX_ASCENT));
+    CHECK_FIXNUM (LGSTRING_SLOT (gstring, LGSTRING_IX_ASCENT));
   if (!NILP (LGSTRING_SLOT (gstring, LGSTRING_IX_ASCENT)))
-    CHECK_NUMBER (LGSTRING_SLOT (gstring, LGSTRING_IX_ASCENT));
+    CHECK_FIXNUM (LGSTRING_SLOT (gstring, LGSTRING_IX_ASCENT));
 
   for (i = 0; i < LGSTRING_GLYPH_LEN (gstring); i++)
     {
@@ -1825,13 +1825,13 @@ check_gstring (Lisp_Object gstring)
        goto err;
       if (NILP (AREF (val, LGLYPH_IX_CHAR)))
        break;
-      CHECK_NATNUM (AREF (val, LGLYPH_IX_FROM));
-      CHECK_NATNUM (AREF (val, LGLYPH_IX_TO));
+      CHECK_FIXNAT (AREF (val, LGLYPH_IX_FROM));
+      CHECK_FIXNAT (AREF (val, LGLYPH_IX_TO));
       CHECK_CHARACTER (AREF (val, LGLYPH_IX_CHAR));
       if (!NILP (AREF (val, LGLYPH_IX_CODE)))
-       CHECK_NATNUM (AREF (val, LGLYPH_IX_CODE));
+       CHECK_FIXNAT (AREF (val, LGLYPH_IX_CODE));
       if (!NILP (AREF (val, LGLYPH_IX_WIDTH)))
-       CHECK_NATNUM (AREF (val, LGLYPH_IX_WIDTH));
+       CHECK_FIXNAT (AREF (val, LGLYPH_IX_WIDTH));
       if (!NILP (AREF (val, LGLYPH_IX_ADJUSTMENT)))
        {
          val = AREF (val, LGLYPH_IX_ADJUSTMENT);
@@ -1839,7 +1839,7 @@ check_gstring (Lisp_Object gstring)
          if (ASIZE (val) < 3)
            goto err;
          for (j = 0; j < 3; j++)
-           CHECK_NUMBER (AREF (val, j));
+           CHECK_FIXNUM (AREF (val, j));
        }
     }
   return i;
@@ -2026,23 +2026,23 @@ font_otf_DeviceTable (OTF_DeviceTable *device_table)
 {
   int len = device_table->StartSize - device_table->EndSize + 1;
 
-  return Fcons (make_number (len),
+  return Fcons (make_fixnum (len),
                make_unibyte_string (device_table->DeltaValue, len));
 }
 
 Lisp_Object
 font_otf_ValueRecord (int value_format, OTF_ValueRecord *value_record)
 {
-  Lisp_Object val = Fmake_vector (make_number (8), Qnil);
+  Lisp_Object val = Fmake_vector (make_fixnum (8), Qnil);
 
   if (value_format & OTF_XPlacement)
-    ASET (val, 0, make_number (value_record->XPlacement));
+    ASET (val, 0, make_fixnum (value_record->XPlacement));
   if (value_format & OTF_YPlacement)
-    ASET (val, 1, make_number (value_record->YPlacement));
+    ASET (val, 1, make_fixnum (value_record->YPlacement));
   if (value_format & OTF_XAdvance)
-    ASET (val, 2, make_number (value_record->XAdvance));
+    ASET (val, 2, make_fixnum (value_record->XAdvance));
   if (value_format & OTF_YAdvance)
-    ASET (val, 3, make_number (value_record->YAdvance));
+    ASET (val, 3, make_fixnum (value_record->YAdvance));
   if (value_format & OTF_XPlaDevice)
     ASET (val, 4, font_otf_DeviceTable (&value_record->XPlaDevice));
   if (value_format & OTF_YPlaDevice)
@@ -2059,11 +2059,11 @@ font_otf_Anchor (OTF_Anchor *anchor)
 {
   Lisp_Object val;
 
-  val = Fmake_vector (make_number (anchor->AnchorFormat + 1), Qnil);
-  ASET (val, 0, make_number (anchor->XCoordinate));
-  ASET (val, 1, make_number (anchor->YCoordinate));
+  val = Fmake_vector (make_fixnum (anchor->AnchorFormat + 1), Qnil);
+  ASET (val, 0, make_fixnum (anchor->XCoordinate));
+  ASET (val, 1, make_fixnum (anchor->YCoordinate));
   if (anchor->AnchorFormat == 2)
-    ASET (val, 2, make_number (anchor->f.f1.AnchorPoint));
+    ASET (val, 2, make_fixnum (anchor->f.f1.AnchorPoint));
   else
     {
       ASET (val, 3, font_otf_DeviceTable (&anchor->f.f2.XDeviceTable));
@@ -2134,20 +2134,20 @@ font_score (Lisp_Object entity, Lisp_Object *spec_prop)
   for (i = FONT_WEIGHT_INDEX; i <= FONT_WIDTH_INDEX; i++)
     if (! NILP (spec_prop[i]) && ! EQ (AREF (entity, i), spec_prop[i]))
       {
-       EMACS_INT diff = ((XINT (AREF (entity, i)) >> 8)
-                         - (XINT (spec_prop[i]) >> 8));
+       EMACS_INT diff = ((XFIXNUM (AREF (entity, i)) >> 8)
+                         - (XFIXNUM (spec_prop[i]) >> 8));
        score |= min (eabs (diff), 127) << sort_shift_bits[i];
       }
 
   /* Score the size.  Maximum difference is 127.  */
   if (! NILP (spec_prop[FONT_SIZE_INDEX])
-      && XINT (AREF (entity, FONT_SIZE_INDEX)) > 0)
+      && XFIXNUM (AREF (entity, FONT_SIZE_INDEX)) > 0)
     {
       /* We use the higher 6-bit for the actual size difference.  The
         lowest bit is set if the DPI is different.  */
       EMACS_INT diff;
-      EMACS_INT pixel_size = XINT (spec_prop[FONT_SIZE_INDEX]);
-      EMACS_INT entity_size = XINT (AREF (entity, FONT_SIZE_INDEX));
+      EMACS_INT pixel_size = XFIXNUM (spec_prop[FONT_SIZE_INDEX]);
+      EMACS_INT entity_size = XFIXNUM (AREF (entity, FONT_SIZE_INDEX));
 
       if (CONSP (Vface_font_rescale_alist))
        pixel_size *= font_rescale_ratio (entity);
@@ -2174,7 +2174,7 @@ font_score (Lisp_Object entity, Lisp_Object *spec_prop)
 static Lisp_Object
 font_vconcat_entity_vectors (Lisp_Object list)
 {
-  EMACS_INT nargs = XFASTINT (Flength (list));
+  EMACS_INT nargs = XFIXNAT (Flength (list));
   Lisp_Object *args;
   USE_SAFE_ALLOCA;
   SAFE_ALLOCA_LISP (args, nargs);
@@ -2244,7 +2244,7 @@ font_sort_entities (Lisp_Object list, Lisp_Object prefer,
     prefer_prop[i] = AREF (prefer, i);
   if (FLOATP (prefer_prop[FONT_SIZE_INDEX]))
     prefer_prop[FONT_SIZE_INDEX]
-      = make_number (font_pixel_size (f, prefer));
+      = make_fixnum (font_pixel_size (f, prefer));
 
   if (NILP (XCDR (list)))
     {
@@ -2446,7 +2446,7 @@ font_match_p (Lisp_Object spec, Lisp_Object font)
       for (i = FONT_FOUNDRY_INDEX; i < FONT_SIZE_INDEX; i++)
        prop[i] = AREF (spec, i);
       prop[FONT_SIZE_INDEX]
-       = make_number (font_pixel_size (XFRAME (selected_frame), spec));
+       = make_fixnum (font_pixel_size (XFRAME (selected_frame), spec));
       props = prop;
     }
 
@@ -2492,7 +2492,7 @@ font_match_p (Lisp_Object spec, Lisp_Object font)
                    {
                      if (! CHARACTERP (XCAR (val2)))
                        continue;
-                     if (font_encode_char (font, XFASTINT (XCAR (val2)))
+                     if (font_encode_char (font, XFIXNAT (XCAR (val2)))
                          == FONT_INVALID_CODE)
                        return 0;
                    }
@@ -2504,7 +2504,7 @@ font_match_p (Lisp_Object spec, Lisp_Object font)
                    {
                      if (! CHARACTERP (AREF (val2, i)))
                        continue;
-                     if (font_encode_char (font, XFASTINT (AREF (val2, i)))
+                     if (font_encode_char (font, XFIXNAT (AREF (val2, i)))
                          != FONT_INVALID_CODE)
                        break;
                    }
@@ -2559,13 +2559,13 @@ font_prepare_cache (struct frame *f, struct font_driver 
const *driver)
     val = XCDR (val);
   if (NILP (val))
     {
-      val = list2 (driver->type, make_number (1));
+      val = list2 (driver->type, make_fixnum (1));
       XSETCDR (cache, Fcons (val, XCDR (cache)));
     }
   else
     {
       val = XCDR (XCAR (val));
-      XSETCAR (val, make_number (XINT (XCAR (val)) + 1));
+      XSETCAR (val, make_fixnum (XFIXNUM (XCAR (val)) + 1));
     }
 }
 
@@ -2582,8 +2582,8 @@ font_finish_cache (struct frame *f, struct font_driver 
const *driver)
     cache = val, val = XCDR (val);
   eassert (! NILP (val));
   tmp = XCDR (XCAR (val));
-  XSETCAR (tmp, make_number (XINT (XCAR (tmp)) - 1));
-  if (XINT (XCAR (tmp)) == 0)
+  XSETCAR (tmp, make_fixnum (XFIXNUM (XCAR (tmp)) - 1));
+  if (XFIXNUM (XCAR (tmp)) == 0)
     {
       font_clear_cache (f, XCAR (val), driver);
       XSETCDR (cache, XCDR (val));
@@ -2698,29 +2698,29 @@ font_delete_unmatched (Lisp_Object vec, Lisp_Object 
spec, int size)
          continue;
        }
       for (prop = FONT_WEIGHT_INDEX; prop < FONT_SIZE_INDEX; prop++)
-       if (INTEGERP (AREF (spec, prop))
-           && ((XINT (AREF (spec, prop)) >> 8)
-               != (XINT (AREF (entity, prop)) >> 8)))
+       if (FIXNUMP (AREF (spec, prop))
+           && ((XFIXNUM (AREF (spec, prop)) >> 8)
+               != (XFIXNUM (AREF (entity, prop)) >> 8)))
          prop = FONT_SPEC_MAX;
       if (prop < FONT_SPEC_MAX
          && size
-         && XINT (AREF (entity, FONT_SIZE_INDEX)) > 0)
+         && XFIXNUM (AREF (entity, FONT_SIZE_INDEX)) > 0)
        {
-         int diff = XINT (AREF (entity, FONT_SIZE_INDEX)) - size;
+         int diff = XFIXNUM (AREF (entity, FONT_SIZE_INDEX)) - size;
 
          if (eabs (diff) > FONT_PIXEL_SIZE_QUANTUM)
            prop = FONT_SPEC_MAX;
        }
       if (prop < FONT_SPEC_MAX
-         && INTEGERP (AREF (spec, FONT_DPI_INDEX))
-         && INTEGERP (AREF (entity, FONT_DPI_INDEX))
-         && XINT (AREF (entity, FONT_DPI_INDEX)) != 0
+         && FIXNUMP (AREF (spec, FONT_DPI_INDEX))
+         && FIXNUMP (AREF (entity, FONT_DPI_INDEX))
+         && XFIXNUM (AREF (entity, FONT_DPI_INDEX)) != 0
          && ! EQ (AREF (spec, FONT_DPI_INDEX), AREF (entity, FONT_DPI_INDEX)))
        prop = FONT_SPEC_MAX;
       if (prop < FONT_SPEC_MAX
-         && INTEGERP (AREF (spec, FONT_AVGWIDTH_INDEX))
-         && INTEGERP (AREF (entity, FONT_AVGWIDTH_INDEX))
-         && XINT (AREF (entity, FONT_AVGWIDTH_INDEX)) != 0
+         && FIXNUMP (AREF (spec, FONT_AVGWIDTH_INDEX))
+         && FIXNUMP (AREF (entity, FONT_AVGWIDTH_INDEX))
+         && XFIXNUM (AREF (entity, FONT_AVGWIDTH_INDEX)) != 0
          && ! EQ (AREF (spec, FONT_AVGWIDTH_INDEX),
                   AREF (entity, FONT_AVGWIDTH_INDEX)))
        prop = FONT_SPEC_MAX;
@@ -2747,8 +2747,8 @@ font_list_entities (struct frame *f, Lisp_Object spec)
 
   eassert (FONT_SPEC_P (spec));
 
-  if (INTEGERP (AREF (spec, FONT_SIZE_INDEX)))
-    size = XINT (AREF (spec, FONT_SIZE_INDEX));
+  if (FIXNUMP (AREF (spec, FONT_SIZE_INDEX)))
+    size = XFIXNUM (AREF (spec, FONT_SIZE_INDEX));
   else if (FLOATP (AREF (spec, FONT_SIZE_INDEX)))
     size = font_pixel_size (f, spec);
   else
@@ -2824,7 +2824,7 @@ font_matching_entity (struct frame *f, Lisp_Object 
*attrs, Lisp_Object spec)
   size = AREF (spec, FONT_SIZE_INDEX);
 
   if (FLOATP (size))
-    ASET (work, FONT_SIZE_INDEX, make_number (font_pixel_size (f, spec)));
+    ASET (work, FONT_SIZE_INDEX, make_fixnum (font_pixel_size (f, spec)));
   FONT_SET_STYLE (work, FONT_WEIGHT_INDEX, attrs[LFACE_WEIGHT_INDEX]);
   FONT_SET_STYLE (work, FONT_SLANT_INDEX, attrs[LFACE_SLANT_INDEX]);
   FONT_SET_STYLE (work, FONT_WIDTH_INDEX, attrs[LFACE_SWIDTH_INDEX]);
@@ -2873,8 +2873,8 @@ font_open_entity (struct frame *f, Lisp_Object entity, 
int pixel_size)
 
   eassert (FONT_ENTITY_P (entity));
   size = AREF (entity, FONT_SIZE_INDEX);
-  if (XINT (size) != 0)
-    pixel_size = XINT (size);
+  if (XFIXNUM (size) != 0)
+    pixel_size = XFIXNUM (size);
 
   val = AREF (entity, FONT_TYPE_INDEX);
   for (driver_list = f->font_driver_list;
@@ -2910,7 +2910,7 @@ font_open_entity (struct frame *f, Lisp_Object entity, 
int pixel_size)
       if (psize > pixel_size + 15)
        return Qnil;
     }
-  ASET (font_object, FONT_SIZE_INDEX, make_number (pixel_size));
+  ASET (font_object, FONT_SIZE_INDEX, make_fixnum (pixel_size));
   FONT_ADD_LOG ("open", entity, font_object);
   ASET (entity, FONT_OBJLIST_INDEX,
        Fcons (font_object, AREF (entity, FONT_OBJLIST_INDEX)));
@@ -3133,7 +3133,7 @@ font_select_entity (struct frame *f, Lisp_Object entities,
     FONT_SET_STYLE (prefer, FONT_SLANT_INDEX, attrs[LFACE_SLANT_INDEX]);
   if (NILP (AREF (prefer, FONT_WIDTH_INDEX)))
     FONT_SET_STYLE (prefer, FONT_WIDTH_INDEX, attrs[LFACE_SWIDTH_INDEX]);
-  ASET (prefer, FONT_SIZE_INDEX, make_number (pixel_size));
+  ASET (prefer, FONT_SIZE_INDEX, make_fixnum (pixel_size));
 
   return font_sort_entities (entities, prefer, f, c);
 }
@@ -3179,9 +3179,9 @@ font_find_for_lface (struct frame *f, Lisp_Object *attrs, 
Lisp_Object spec, int
   work = copy_font_spec (spec);
   ASET (work, FONT_TYPE_INDEX, AREF (spec, FONT_TYPE_INDEX));
   pixel_size = font_pixel_size (f, spec);
-  if (pixel_size == 0 && INTEGERP (attrs[LFACE_HEIGHT_INDEX]))
+  if (pixel_size == 0 && FIXNUMP (attrs[LFACE_HEIGHT_INDEX]))
     {
-      double pt = XINT (attrs[LFACE_HEIGHT_INDEX]);
+      double pt = XFIXNUM (attrs[LFACE_HEIGHT_INDEX]);
 
       pixel_size = POINT_TO_PIXEL (pt / 10, FRAME_RES_Y (f));
       if (pixel_size < 1)
@@ -3241,7 +3241,7 @@ font_find_for_lface (struct frame *f, Lisp_Object *attrs, 
Lisp_Object spec, int
 
       if (! NILP (alters))
        {
-         EMACS_INT alterslen = XFASTINT (Flength (alters));
+         EMACS_INT alterslen = XFIXNAT (Flength (alters));
          SAFE_ALLOCA_LISP (family, alterslen + 2);
          for (i = 0; CONSP (alters); i++, alters = XCDR (alters))
            family[i] = XCAR (alters);
@@ -3298,9 +3298,9 @@ font_open_for_lface (struct frame *f, Lisp_Object entity, 
Lisp_Object *attrs, Li
 {
   int size;
 
-  if (INTEGERP (AREF (entity, FONT_SIZE_INDEX))
-      && XINT (AREF (entity, FONT_SIZE_INDEX)) > 0)
-    size = XINT (AREF (entity, FONT_SIZE_INDEX));
+  if (FIXNUMP (AREF (entity, FONT_SIZE_INDEX))
+      && XFIXNUM (AREF (entity, FONT_SIZE_INDEX)) > 0)
+    size = XFIXNUM (AREF (entity, FONT_SIZE_INDEX));
   else
     {
       if (FONT_SPEC_P (spec) && ! NILP (AREF (spec, FONT_SIZE_INDEX)))
@@ -3308,14 +3308,14 @@ font_open_for_lface (struct frame *f, Lisp_Object 
entity, Lisp_Object *attrs, Li
       else
        {
          double pt;
-         if (INTEGERP (attrs[LFACE_HEIGHT_INDEX]))
-           pt = XINT (attrs[LFACE_HEIGHT_INDEX]);
+         if (FIXNUMP (attrs[LFACE_HEIGHT_INDEX]))
+           pt = XFIXNUM (attrs[LFACE_HEIGHT_INDEX]);
          else
            {
              struct face *def = FACE_FROM_ID (f, DEFAULT_FACE_ID);
              Lisp_Object height = def->lface[LFACE_HEIGHT_INDEX];
-             eassert (INTEGERP (height));
-             pt = XINT (height);
+             eassert (FIXNUMP (height));
+             pt = XFIXNUM (height);
            }
 
          pt /= 10;
@@ -3324,8 +3324,8 @@ font_open_for_lface (struct frame *f, Lisp_Object entity, 
Lisp_Object *attrs, Li
          if (size == 0)
            {
              Lisp_Object ffsize = get_frame_param (f, Qfontsize);
-             size = (NUMBERP (ffsize)
-                     ? POINT_TO_PIXEL (XINT (ffsize), FRAME_RES_Y (f)) : 0);
+             size = (FIXED_OR_FLOATP (ffsize)
+                     ? POINT_TO_PIXEL (XFIXNUM (ffsize), FRAME_RES_Y (f)) : 0);
            }
 #endif
        }
@@ -3372,7 +3372,7 @@ font_load_for_lface (struct frame *f, Lisp_Object *attrs, 
Lisp_Object spec)
                      Lisp_Object lsize = Ffont_get (spec, QCsize);
 
                      if ((FLOATP (lsize) && XFLOAT_DATA (lsize) == font_size)
-                         || (INTEGERP (lsize) && XINT (lsize) == font_size))
+                         || (FIXNUMP (lsize) && XFIXNUM (lsize) == font_size))
                        {
                          ASET (spec, FONT_FAMILY_INDEX,
                                font_intern_prop (p, tail - p, 1));
@@ -3433,9 +3433,9 @@ font_open_by_spec (struct frame *f, Lisp_Object spec)
   attrs[LFACE_SWIDTH_INDEX] = attrs[LFACE_WEIGHT_INDEX]
     = attrs[LFACE_SLANT_INDEX] = Qnormal;
 #ifndef HAVE_NS
-  attrs[LFACE_HEIGHT_INDEX] = make_number (120);
+  attrs[LFACE_HEIGHT_INDEX] = make_fixnum (120);
 #else
-  attrs[LFACE_HEIGHT_INDEX] = make_number (0);
+  attrs[LFACE_HEIGHT_INDEX] = make_fixnum (0);
 #endif
   attrs[LFACE_FONT_INDEX] = Qnil;
 
@@ -3673,7 +3673,7 @@ font_filter_properties (Lisp_Object font,
 
         if (strcmp (boolean_properties[i], keystr) == 0)
           {
-            const char *str = INTEGERP (val) ? (XINT (val) ? "true" : "false")
+            const char *str = FIXNUMP (val) ? (XFIXNUM (val) ? "true" : 
"false")
              : SYMBOLP (val) ? SSDATA (SYMBOL_NAME (val))
              : "true";
 
@@ -3827,8 +3827,8 @@ font_range (ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t 
*limit,
       else
        FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, string, pos, pos_byte);
       category = CHAR_TABLE_REF (Vunicode_category_table, c);
-      if (INTEGERP (category)
-         && (XINT (category) == UNICODE_CATEGORY_Cf
+      if (FIXNUMP (category)
+         && (XFIXNUM (category) == UNICODE_CATEGORY_Cf
              || CHAR_VARIATION_SELECTOR_P (c)))
        continue;
       if (NILP (font_object))
@@ -4142,17 +4142,17 @@ are to be displayed on.  If omitted, the selected frame 
is used.  */)
     }
 
   val = AREF (font, FONT_SIZE_INDEX);
-  if (INTEGERP (val))
+  if (FIXNUMP (val))
     {
       Lisp_Object font_dpi = AREF (font, FONT_DPI_INDEX);
-      int dpi = INTEGERP (font_dpi) ? XINT (font_dpi) : FRAME_RES_Y (f);
+      int dpi = FIXNUMP (font_dpi) ? XFIXNUM (font_dpi) : FRAME_RES_Y (f);
       plist[n++] = QCheight;
-      plist[n++] = make_number (PIXEL_TO_POINT (XINT (val) * 10, dpi));
+      plist[n++] = make_fixnum (PIXEL_TO_POINT (XFIXNUM (val) * 10, dpi));
     }
   else if (FLOATP (val))
     {
       plist[n++] = QCheight;
-      plist[n++] = make_number (10 * (int) XFLOAT_DATA (val));
+      plist[n++] = make_fixnum (10 * (int) XFLOAT_DATA (val));
     }
 
   val = FONT_WEIGHT_FOR_FACE (font);
@@ -4231,8 +4231,8 @@ how close they are to PREFER.  */)
   CHECK_FONT_SPEC (font_spec);
   if (! NILP (num))
     {
-      CHECK_NUMBER (num);
-      n = XINT (num);
+      CHECK_FIXNUM (num);
+      n = XFIXNUM (num);
       if (n <= 0)
        return Qnil;
     }
@@ -4289,7 +4289,7 @@ DEFUN ("find-font", Ffind_font, Sfind_font, 1, 2, 0,
 Optional 2nd argument FRAME, if non-nil, specifies the target frame.  */)
   (Lisp_Object font_spec, Lisp_Object frame)
 {
-  Lisp_Object val = Flist_fonts (font_spec, frame, make_number (1), Qnil);
+  Lisp_Object val = Flist_fonts (font_spec, frame, make_fixnum (1), Qnil);
 
   if (CONSP (val))
     val = XCAR (val);
@@ -4358,7 +4358,7 @@ clear_font_cache (struct frame *f)
               ! EQ (XCAR (XCAR (val)), driver_list->driver->type))
          val = XCDR (val);
        tmp = XCDR (XCAR (val));
-       if (XINT (XCAR (tmp)) == 0)
+       if (XFIXNUM (XCAR (tmp)) == 0)
          {
            font_clear_cache (f, XCAR (val), driver_list->driver);
            XSETCDR (cache, XCDR (val));
@@ -4427,15 +4427,15 @@ GSTRING.  */)
   for (i = 0; i < 3; i++)
     {
       n = font->driver->shape (gstring);
-      if (INTEGERP (n))
+      if (FIXNUMP (n))
        break;
       gstring = larger_vector (gstring,
                               LGSTRING_GLYPH_LEN (gstring), -1);
     }
-  if (i == 3 || XINT (n) == 0)
+  if (i == 3 || XFIXNUM (n) == 0)
     return Qnil;
-  if (XINT (n) < LGSTRING_GLYPH_LEN (gstring))
-    LGSTRING_SET_GLYPH (gstring, XINT (n), Qnil);
+  if (XFIXNUM (n) < LGSTRING_GLYPH_LEN (gstring))
+    LGSTRING_SET_GLYPH (gstring, XFIXNUM (n), Qnil);
 
   /* Check FROM_IDX and TO_IDX of each GLYPH in GSTRING to assure that
      GLYPHS covers all characters (except for the last few ones) in
@@ -4469,7 +4469,7 @@ GSTRING.  */)
       from = LGLYPH_FROM (glyph);
       to = LGLYPH_TO (glyph);
     }
-  return composition_gstring_put_cache (gstring, XINT (n));
+  return composition_gstring_put_cache (gstring, XFIXNUM (n));
 
  shaper_error:
   return Qnil;
@@ -4495,7 +4495,7 @@ where
   font = XFONT_OBJECT (font_object);
   if (! font->driver->get_variation_glyphs)
     return Qnil;
-  n = font->driver->get_variation_glyphs (font, XINT (character), variations);
+  n = font->driver->get_variation_glyphs (font, XFIXNUM (character), 
variations);
   if (! n)
     return Qnil;
   val = Qnil;
@@ -4504,7 +4504,7 @@ where
       {
        int vs = (i < 16 ? 0xFE00 + i : 0xE0100 + (i - 16));
        Lisp_Object code = INTEGER_TO_CONS (variations[i]);
-       val = Fcons (Fcons (make_number (vs), code), val);
+       val = Fcons (Fcons (make_fixnum (vs), code), val);
       }
   return val;
 }
@@ -4556,7 +4556,7 @@ DEFUN ("internal-char-font", Finternal_char_font, 
Sinternal_char_font, 1, 2, 0,
   if (NILP (position))
     {
       CHECK_CHARACTER (ch);
-      c = XINT (ch);
+      c = XFIXNUM (ch);
       f = XFRAME (selected_frame);
       face_id = lookup_basic_face (NULL, f, DEFAULT_FACE_ID);
       pos = -1;
@@ -4566,17 +4566,17 @@ DEFUN ("internal-char-font", Finternal_char_font, 
Sinternal_char_font, 1, 2, 0,
       Lisp_Object window;
       struct window *w;
 
-      CHECK_NUMBER_COERCE_MARKER (position);
-      if (! (BEGV <= XINT (position) && XINT (position) < ZV))
-       args_out_of_range_3 (position, make_number (BEGV), make_number (ZV));
-      pos = XINT (position);
+      CHECK_FIXNUM_COERCE_MARKER (position);
+      if (! (BEGV <= XFIXNUM (position) && XFIXNUM (position) < ZV))
+       args_out_of_range_3 (position, make_fixnum (BEGV), make_fixnum (ZV));
+      pos = XFIXNUM (position);
       pos_byte = CHAR_TO_BYTE (pos);
       if (NILP (ch))
        c = FETCH_CHAR (pos_byte);
       else
        {
-         CHECK_NATNUM (ch);
-         c = XINT (ch);
+         CHECK_FIXNAT (ch);
+         c = XFIXNUM (ch);
        }
       window = Fget_buffer_window (Fcurrent_buffer (), Qnil);
       if (NILP (window))
@@ -4665,20 +4665,20 @@ glyph-string.  */)
     CHECK_CONS (val);
   len = check_gstring (gstring_in);
   CHECK_VECTOR (gstring_out);
-  CHECK_NATNUM (from);
-  CHECK_NATNUM (to);
-  CHECK_NATNUM (index);
-
-  if (XINT (from) >= XINT (to) || XINT (to) > len)
-    args_out_of_range_3 (from, to, make_number (len));
-  if (XINT (index) >= ASIZE (gstring_out))
-    args_out_of_range (index, make_number (ASIZE (gstring_out)));
+  CHECK_FIXNAT (from);
+  CHECK_FIXNAT (to);
+  CHECK_FIXNAT (index);
+
+  if (XFIXNUM (from) >= XFIXNUM (to) || XFIXNUM (to) > len)
+    args_out_of_range_3 (from, to, make_fixnum (len));
+  if (XFIXNUM (index) >= ASIZE (gstring_out))
+    args_out_of_range (index, make_fixnum (ASIZE (gstring_out)));
   num = font->driver->otf_drive (font, otf_features,
-                                gstring_in, XINT (from), XINT (to),
-                                gstring_out, XINT (index), 0);
+                                gstring_in, XFIXNUM (from), XFIXNUM (to),
+                                gstring_out, XFIXNUM (index), 0);
   if (num < 0)
     return Qnil;
-  return make_number (num);
+  return make_fixnum (num);
 }
 
 DEFUN ("font-otf-alternates", Ffont_otf_alternates, Sfont_otf_alternates,
@@ -4706,14 +4706,14 @@ corresponding character.  */)
   CHECK_CHARACTER (character);
   CHECK_CONS (otf_features);
 
-  gstring_in = Ffont_make_gstring (font_object, make_number (1));
+  gstring_in = Ffont_make_gstring (font_object, make_fixnum (1));
   g = LGSTRING_GLYPH (gstring_in, 0);
-  LGLYPH_SET_CHAR (g, XINT (character));
-  gstring_out = Ffont_make_gstring (font_object, make_number (10));
+  LGLYPH_SET_CHAR (g, XFIXNUM (character));
+  gstring_out = Ffont_make_gstring (font_object, make_fixnum (10));
   while ((num = font->driver->otf_drive (font, otf_features, gstring_in, 0, 1,
                                         gstring_out, 0, 1)) < 0)
     gstring_out = Ffont_make_gstring (font_object,
-                                     make_number (ASIZE (gstring_out) * 2));
+                                     make_fixnum (ASIZE (gstring_out) * 2));
   alternates = Qnil;
   for (i = 0; i < num; i++)
     {
@@ -4721,8 +4721,8 @@ corresponding character.  */)
       int c = LGLYPH_CHAR (g);
       unsigned code = LGLYPH_CODE (g);
 
-      alternates = Fcons (Fcons (make_number (code),
-                                c > 0 ? make_number (c) : Qnil),
+      alternates = Fcons (Fcons (make_fixnum (code),
+                                c > 0 ? make_fixnum (c) : Qnil),
                          alternates);
     }
   return Fnreverse (alternates);
@@ -4741,14 +4741,14 @@ DEFUN ("open-font", Fopen_font, Sopen_font, 1, 3, 0,
   CHECK_FONT_ENTITY (font_entity);
 
   if (NILP (size))
-    isize = XINT (AREF (font_entity, FONT_SIZE_INDEX));
+    isize = XFIXNUM (AREF (font_entity, FONT_SIZE_INDEX));
   else
     {
-      CHECK_NUMBER_OR_FLOAT (size);
+      CHECK_FIXNUM_OR_FLOAT (size);
       if (FLOATP (size))
        isize = POINT_TO_PIXEL (XFLOAT_DATA (size), FRAME_RES_Y (f));
       else
-       isize = XINT (size);
+       isize = XFIXNUM (size);
       if (! (INT_MIN <= isize && isize <= INT_MAX))
        args_out_of_range (font_entity, size);
       if (isize == 0)
@@ -4814,12 +4814,12 @@ If the font is not OpenType font, CAPABILITY is nil.  
*/)
 
   ASET (val, 0, AREF (font_object, FONT_NAME_INDEX));
   ASET (val, 1, AREF (font_object, FONT_FILE_INDEX));
-  ASET (val, 2, make_number (font->pixel_size));
-  ASET (val, 3, make_number (font->max_width));
-  ASET (val, 4, make_number (font->ascent));
-  ASET (val, 5, make_number (font->descent));
-  ASET (val, 6, make_number (font->space_width));
-  ASET (val, 7, make_number (font->average_width));
+  ASET (val, 2, make_fixnum (font->pixel_size));
+  ASET (val, 3, make_fixnum (font->max_width));
+  ASET (val, 4, make_fixnum (font->ascent));
+  ASET (val, 5, make_fixnum (font->descent));
+  ASET (val, 6, make_fixnum (font->space_width));
+  ASET (val, 7, make_fixnum (font->average_width));
   if (font->driver->otf_capability)
     ASET (val, 8, Fcons (Qopentype, font->driver->otf_capability (font)));
   else
@@ -4862,15 +4862,15 @@ the corresponding element is nil.  */)
       validate_region (&from, &to);
       if (EQ (from, to))
        return Qnil;
-      len = XFASTINT (to) - XFASTINT (from);
+      len = XFIXNAT (to) - XFIXNAT (from);
       SAFE_ALLOCA_LISP (chars, len);
-      charpos = XFASTINT (from);
+      charpos = XFIXNAT (from);
       bytepos = CHAR_TO_BYTE (charpos);
-      for (i = 0; charpos < XFASTINT (to); i++)
+      for (i = 0; charpos < XFIXNAT (to); i++)
        {
          int c;
          FETCH_CHAR_ADVANCE (c, charpos, bytepos);
-         chars[i] = make_number (c);
+         chars[i] = make_fixnum (c);
        }
     }
   else if (STRINGP (object))
@@ -4896,12 +4896,12 @@ the corresponding element is nil.  */)
          for (i = 0; i < len; i++)
          {
            c = STRING_CHAR_ADVANCE (p);
-           chars[i] = make_number (c);
+           chars[i] = make_fixnum (c);
          }
        }
       else
        for (i = 0; i < len; i++)
-         chars[i] = make_number (p[ifrom + i]);
+         chars[i] = make_fixnum (p[ifrom + i]);
     }
   else if (VECTORP (object))
     {
@@ -4925,7 +4925,7 @@ the corresponding element is nil.  */)
   for (i = 0; i < len; i++)
     {
       Lisp_Object g;
-      int c = XFASTINT (chars[i]);
+      int c = XFIXNAT (chars[i]);
       unsigned code;
       struct font_metrics metrics;
 
@@ -4978,19 +4978,19 @@ character at index specified by POSITION.  */)
     {
       if (XBUFFER (w->contents) != current_buffer)
        error ("Specified window is not displaying the current buffer");
-      CHECK_NUMBER_COERCE_MARKER (position);
-      if (! (BEGV <= XINT (position) && XINT (position) < ZV))
-       args_out_of_range_3 (position, make_number (BEGV), make_number (ZV));
+      CHECK_FIXNUM_COERCE_MARKER (position);
+      if (! (BEGV <= XFIXNUM (position) && XFIXNUM (position) < ZV))
+       args_out_of_range_3 (position, make_fixnum (BEGV), make_fixnum (ZV));
     }
   else
     {
-      CHECK_NUMBER (position);
+      CHECK_FIXNUM (position);
       CHECK_STRING (string);
-      if (! (0 <= XINT (position) && XINT (position) < SCHARS (string)))
+      if (! (0 <= XFIXNUM (position) && XFIXNUM (position) < SCHARS (string)))
        args_out_of_range (string, position);
     }
 
-  return font_at (-1, XINT (position), NULL, w, string);
+  return font_at (-1, XFIXNUM (position), NULL, w, string);
 }
 
 #if 0
@@ -5013,9 +5013,9 @@ Type C-l to recover what previously shown.  */)
   code = alloca (sizeof (unsigned) * len);
   for (i = 0; i < len; i++)
     {
-      Lisp_Object ch = Faref (string, make_number (i));
+      Lisp_Object ch = Faref (string, make_fixnum (i));
       Lisp_Object val;
-      int c = XINT (ch);
+      int c = XFIXNUM (ch);
 
       code[i] = font->driver->encode_char (font, c);
       if (code[i] == FONT_INVALID_CODE)
@@ -5030,7 +5030,7 @@ Type C-l to recover what previously shown.  */)
   if (font->driver->done_face)
     font->driver->done_face (f, face);
   face->fontp = NULL;
-  return make_number (len);
+  return make_fixnum (len);
 }
 #endif
 
@@ -5133,16 +5133,16 @@ If the named font is not yet loaded, return nil.  */)
   info = make_uninit_vector (14);
   ASET (info, 0, AREF (font_object, FONT_NAME_INDEX));
   ASET (info, 1, AREF (font_object, FONT_FULLNAME_INDEX));
-  ASET (info, 2, make_number (font->pixel_size));
-  ASET (info, 3, make_number (font->height));
-  ASET (info, 4, make_number (font->baseline_offset));
-  ASET (info, 5, make_number (font->relative_compose));
-  ASET (info, 6, make_number (font->default_ascent));
-  ASET (info, 7, make_number (font->max_width));
-  ASET (info, 8, make_number (font->ascent));
-  ASET (info, 9, make_number (font->descent));
-  ASET (info, 10, make_number (font->space_width));
-  ASET (info, 11, make_number (font->average_width));
+  ASET (info, 2, make_fixnum (font->pixel_size));
+  ASET (info, 3, make_fixnum (font->height));
+  ASET (info, 4, make_fixnum (font->baseline_offset));
+  ASET (info, 5, make_fixnum (font->relative_compose));
+  ASET (info, 6, make_fixnum (font->default_ascent));
+  ASET (info, 7, make_fixnum (font->max_width));
+  ASET (info, 8, make_fixnum (font->ascent));
+  ASET (info, 9, make_fixnum (font->descent));
+  ASET (info, 10, make_fixnum (font->space_width));
+  ASET (info, 11, make_fixnum (font->average_width));
   ASET (info, 12, AREF (font_object, FONT_FILE_INDEX));
   if (font->driver->otf_capability)
     ASET (info, 13, Fcons (Qopentype, font->driver->otf_capability (font)));
@@ -5172,8 +5172,8 @@ build_style_table (const struct table_entry *entry, int 
nelement)
   for (i = 0; i < nelement; i++)
     {
       for (j = 0; entry[i].names[j]; j++);
-      elt = Fmake_vector (make_number (j + 1), Qnil);
-      ASET (elt, 0, make_number (entry[i].numeric));
+      elt = Fmake_vector (make_fixnum (j + 1), Qnil);
+      ASET (elt, 0, make_fixnum (entry[i].numeric));
       for (j = 0; entry[i].names[j]; j++)
        ASET (elt, j + 1, intern_c_string (entry[i].names[j]));
       ASET (table, i, elt);
@@ -5354,7 +5354,7 @@ syms_of_font (void)
   scratch_font_prefer = Ffont_spec (0, NULL);
 
   staticpro (&Vfont_log_deferred);
-  Vfont_log_deferred = Fmake_vector (make_number (3), Qnil);
+  Vfont_log_deferred = Fmake_vector (make_fixnum (3), Qnil);
 
 #if 0
 #ifdef HAVE_LIBOTF
diff --git a/src/font.h b/src/font.h
index e84c6f3..1741b3f 100644
--- a/src/font.h
+++ b/src/font.h
@@ -185,16 +185,16 @@ enum font_property_index
 
 /* Return the numeric weight value of FONT.  */
 #define FONT_WEIGHT_NUMERIC(font)              \
-  (INTEGERP (AREF ((font), FONT_WEIGHT_INDEX)) \
-   ? (XINT (AREF ((font), FONT_WEIGHT_INDEX)) >> 8) : -1)
+  (FIXNUMP (AREF ((font), FONT_WEIGHT_INDEX))  \
+   ? (XFIXNUM (AREF ((font), FONT_WEIGHT_INDEX)) >> 8) : -1)
 /* Return the numeric slant value of FONT.  */
 #define FONT_SLANT_NUMERIC(font)               \
-  (INTEGERP (AREF ((font), FONT_SLANT_INDEX))  \
-   ? (XINT (AREF ((font), FONT_SLANT_INDEX)) >> 8) : -1)
+  (FIXNUMP (AREF ((font), FONT_SLANT_INDEX))   \
+   ? (XFIXNUM (AREF ((font), FONT_SLANT_INDEX)) >> 8) : -1)
 /* Return the numeric width value of FONT.  */
 #define FONT_WIDTH_NUMERIC(font)               \
-  (INTEGERP (AREF ((font), FONT_WIDTH_INDEX))  \
-   ? (XINT (AREF ((font), FONT_WIDTH_INDEX)) >> 8) : -1)
+  (FIXNUMP (AREF ((font), FONT_WIDTH_INDEX))   \
+   ? (XFIXNUM (AREF ((font), FONT_WIDTH_INDEX)) >> 8) : -1)
 /* Return the symbolic weight value of FONT.  */
 #define FONT_WEIGHT_SYMBOLIC(font)     \
   font_style_symbolic (font, FONT_WEIGHT_INDEX, false)
@@ -228,7 +228,7 @@ enum font_property_index
    style-related font property index (FONT_WEIGHT/SLANT/WIDTH_INDEX).
    VAL (integer or symbol) is the numeric or symbolic style value.  */
 #define FONT_SET_STYLE(font, prop, val)        \
-  ASET ((font), prop, make_number (font_style_to_value (prop, val, true)))
+  ASET ((font), prop, make_fixnum (font_style_to_value (prop, val, true)))
 
 #ifndef MSDOS
 #define FONT_WIDTH(f) ((f)->max_width)
diff --git a/src/fontset.c b/src/fontset.c
index 6ca6406..1f877eb 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -266,7 +266,7 @@ set_fontset_fallback (Lisp_Object fontset, Lisp_Object 
fallback)
 
 #define RFONT_DEF_FACE(rfont_def) AREF (rfont_def, 0)
 #define RFONT_DEF_SET_FACE(rfont_def, face_id) \
-  ASET ((rfont_def), 0, make_number (face_id))
+  ASET ((rfont_def), 0, make_fixnum (face_id))
 #define RFONT_DEF_FONT_DEF(rfont_def) AREF (rfont_def, 1)
 #define RFONT_DEF_SPEC(rfont_def) FONT_DEF_SPEC (AREF (rfont_def, 1))
 #define RFONT_DEF_OBJECT(rfont_def) AREF (rfont_def, 2)
@@ -276,12 +276,12 @@ set_fontset_fallback (Lisp_Object fontset, Lisp_Object 
fallback)
    the order of listing by font backends, the higher bits represents
    the order given by charset priority list.  The smaller value is
    preferable.  */
-#define RFONT_DEF_SCORE(rfont_def) XINT (AREF (rfont_def, 3))
+#define RFONT_DEF_SCORE(rfont_def) XFIXNUM (AREF (rfont_def, 3))
 #define RFONT_DEF_SET_SCORE(rfont_def, score) \
-  ASET ((rfont_def), 3, make_number (score))
+  ASET ((rfont_def), 3, make_fixnum (score))
 #define RFONT_DEF_NEW(rfont_def, font_def)             \
   do {                                                 \
-    (rfont_def) = Fmake_vector (make_number (4), Qnil);        \
+    (rfont_def) = Fmake_vector (make_fixnum (4), Qnil);        \
     ASET ((rfont_def), 1, (font_def));                 \
     RFONT_DEF_SET_SCORE ((rfont_def), 0);              \
   } while (0)
@@ -328,10 +328,10 @@ fontset_ref (Lisp_Object fontset, int c)
   (NILP (add)                                                          \
    ? (NILP (range)                                                     \
       ? (set_fontset_fallback                                          \
-        (fontset, Fmake_vector (make_number (1), (elt))))              \
+        (fontset, Fmake_vector (make_fixnum (1), (elt))))              \
       : ((void)                                                                
\
         Fset_char_table_range (fontset, range,                         \
-                               Fmake_vector (make_number (1), elt))))  \
+                               Fmake_vector (make_fixnum (1), elt))))  \
    : fontset_add ((fontset), (range), (elt), (add)))
 
 static void
@@ -340,12 +340,12 @@ fontset_add (Lisp_Object fontset, Lisp_Object range, 
Lisp_Object elt, Lisp_Objec
   Lisp_Object args[2];
   int idx = (EQ (add, Qappend) ? 0 : 1);
 
-  args[1 - idx] = Fmake_vector (make_number (1), elt);
+  args[1 - idx] = Fmake_vector (make_fixnum (1), elt);
 
   if (CONSP (range))
     {
-      int from = XINT (XCAR (range));
-      int to = XINT (XCDR (range));
+      int from = XFIXNUM (XCAR (range));
+      int to = XFIXNUM (XCDR (range));
       int from1, to1;
 
       do {
@@ -456,7 +456,7 @@ reorder_font_vector (Lisp_Object font_group, struct font 
*font)
     qsort (XVECTOR (vec)->contents, size, word_size,
           fontset_compare_rfontdef);
   EMACS_INT low_tick_bits = charset_ordered_list_tick & MOST_POSITIVE_FIXNUM;
-  XSETCAR (font_group, make_number (low_tick_bits));
+  XSETCAR (font_group, make_fixnum (low_tick_bits));
 }
 
 /* Return a font-group (actually a cons (CHARSET_ORDERED_LIST_TICK
@@ -496,7 +496,7 @@ fontset_get_font_group (Lisp_Object fontset, int c)
      for C, or the fontset does not have fallback fonts.  */
   if (NILP (font_group))
     {
-      font_group = make_number (0);
+      font_group = make_fixnum (0);
       if (c >= 0)
        /* Record that FONTSET does not specify fonts for C.  As
           there's a possibility that a font is found in a fallback
@@ -520,7 +520,7 @@ fontset_get_font_group (Lisp_Object fontset, int c)
        RFONT_DEF_SET_SCORE (rfont_def, i);
        ASET (font_group, i, rfont_def);
       }
-  font_group = Fcons (make_number (-1), font_group);
+  font_group = Fcons (make_fixnum (-1), font_group);
   if (c >= 0)
     char_table_set_range (fontset, from, to, font_group);
   else
@@ -561,7 +561,7 @@ fontset_find_font (Lisp_Object fontset, int c, struct face 
*face,
 
   if (ASIZE (vec) > 1)
     {
-      if (XINT (XCAR (font_group)) != charset_ordered_list_tick)
+      if (XFIXNUM (XCAR (font_group)) != charset_ordered_list_tick)
        /* We have just created the font-group,
           or the charset priorities were changed.  */
        reorder_font_vector (font_group, face->ascii_face->font);
@@ -577,7 +577,7 @@ fontset_find_font (Lisp_Object fontset, int c, struct face 
*face,
              break;
            repertory = FONT_DEF_REPERTORY (RFONT_DEF_FONT_DEF (rfont_def));
 
-           if (XINT (repertory) == charset_id)
+           if (XFIXNUM (repertory) == charset_id)
              {
                charset_matched = i;
                break;
@@ -633,8 +633,8 @@ fontset_find_font (Lisp_Object fontset, int c, struct face 
*face,
          /* This is a sign of not to try the other fonts.  */
          return Qt;
        }
-      if (INTEGERP (RFONT_DEF_FACE (rfont_def))
-         && XINT (RFONT_DEF_FACE (rfont_def)) < 0)
+      if (FIXNUMP (RFONT_DEF_FACE (rfont_def))
+         && XFIXNUM (RFONT_DEF_FACE (rfont_def)) < 0)
        /* We couldn't open this font last time.  */
        continue;
 
@@ -711,7 +711,7 @@ fontset_find_font (Lisp_Object fontset, int c, struct face 
*face,
          RFONT_DEF_NEW (rfont_def, font_def);
          RFONT_DEF_SET_OBJECT (rfont_def, font_object);
          RFONT_DEF_SET_SCORE (rfont_def, RFONT_DEF_SCORE (rfont_def));
-         new_vec = Fmake_vector (make_number (ASIZE (vec) + 1), Qnil);
+         new_vec = Fmake_vector (make_fixnum (ASIZE (vec) + 1), Qnil);
          found_index++;
          for (j = 0; j < found_index; j++)
            ASET (new_vec, j, AREF (vec, j));
@@ -727,7 +727,7 @@ fontset_find_font (Lisp_Object fontset, int c, struct face 
*face,
     }
 
   /* Record that no font in this font group supports C.  */
-  FONTSET_SET (fontset, make_number (c), make_number (0));
+  FONTSET_SET (fontset, make_fixnum (c), make_fixnum (0));
   return Qnil;
 
  found:
@@ -756,12 +756,12 @@ fontset_font (Lisp_Object fontset, int c, struct face 
*face, int id)
   Lisp_Object base_fontset;
 
   /* Try a font-group of FONTSET. */
-  FONT_DEFERRED_LOG ("current fontset: font for", make_number (c), Qnil);
+  FONT_DEFERRED_LOG ("current fontset: font for", make_fixnum (c), Qnil);
   rfont_def = fontset_find_font (fontset, c, face, id, 0);
   if (VECTORP (rfont_def))
     return rfont_def;
   if (NILP (rfont_def))
-    FONTSET_SET (fontset, make_number (c), make_number (0));
+    FONTSET_SET (fontset, make_fixnum (c), make_fixnum (0));
 
   /* Try a font-group of the default fontset. */
   base_fontset = FONTSET_BASE (fontset);
@@ -771,37 +771,37 @@ fontset_font (Lisp_Object fontset, int c, struct face 
*face, int id)
        set_fontset_default
          (fontset,
           make_fontset (FONTSET_FRAME (fontset), Qnil, Vdefault_fontset));
-      FONT_DEFERRED_LOG ("default fontset: font for", make_number (c), Qnil);
+      FONT_DEFERRED_LOG ("default fontset: font for", make_fixnum (c), Qnil);
       default_rfont_def
        = fontset_find_font (FONTSET_DEFAULT (fontset), c, face, id, 0);
       if (VECTORP (default_rfont_def))
        return default_rfont_def;
       if (NILP (default_rfont_def))
-       FONTSET_SET (FONTSET_DEFAULT (fontset), make_number (c),
-                    make_number (0));
+       FONTSET_SET (FONTSET_DEFAULT (fontset), make_fixnum (c),
+                    make_fixnum (0));
     }
 
   /* Try a fallback font-group of FONTSET. */
   if (! EQ (rfont_def, Qt))
     {
-      FONT_DEFERRED_LOG ("current fallback: font for", make_number (c), Qnil);
+      FONT_DEFERRED_LOG ("current fallback: font for", make_fixnum (c), Qnil);
       rfont_def = fontset_find_font (fontset, c, face, id, 1);
       if (VECTORP (rfont_def))
        return rfont_def;
       /* Remember that FONTSET has no font for C.  */
-      FONTSET_SET (fontset, make_number (c), Qt);
+      FONTSET_SET (fontset, make_fixnum (c), Qt);
     }
 
   /* Try a fallback font-group of the default fontset. */
   if (! EQ (base_fontset, Vdefault_fontset)
       && ! EQ (default_rfont_def, Qt))
     {
-      FONT_DEFERRED_LOG ("default fallback: font for", make_number (c), Qnil);
+      FONT_DEFERRED_LOG ("default fallback: font for", make_fixnum (c), Qnil);
       rfont_def = fontset_find_font (FONTSET_DEFAULT (fontset), c, face, id, 
1);
       if (VECTORP (rfont_def))
        return rfont_def;
       /* Remember that the default fontset has no font for C.  */
-      FONTSET_SET (FONTSET_DEFAULT (fontset), make_number (c), Qt);
+      FONTSET_SET (FONTSET_DEFAULT (fontset), make_fixnum (c), Qt);
     }
 
   return Qnil;
@@ -830,7 +830,7 @@ make_fontset (Lisp_Object frame, Lisp_Object name, 
Lisp_Object base)
 
   fontset = Fmake_char_table (Qfontset, Qnil);
 
-  set_fontset_id (fontset, make_number (id));
+  set_fontset_id (fontset, make_fixnum (id));
   if (NILP (base))
     set_fontset_name (fontset, name);
   else
@@ -892,7 +892,7 @@ free_face_fontset (struct frame *f, struct face *face)
     next_fontset_id = face->fontset;
   if (! NILP (FONTSET_DEFAULT (fontset)))
     {
-      int id = XINT (FONTSET_ID (FONTSET_DEFAULT (fontset)));
+      int id = XFIXNUM (FONTSET_ID (FONTSET_DEFAULT (fontset)));
 
       fontset = AREF (Vfontset_table, id);
       eassert (!NILP (fontset) && ! BASE_FONTSET_P (fontset));
@@ -973,7 +973,7 @@ face_for_char (struct frame *f, struct face *face, int c,
     }
   else
     {
-      charset = Fget_char_property (make_number (pos), Qcharset, object);
+      charset = Fget_char_property (make_fixnum (pos), Qcharset, object);
       if (CHARSETP (charset))
        {
          Lisp_Object val;
@@ -981,7 +981,7 @@ face_for_char (struct frame *f, struct face *face, int c,
          val = assq_no_quit (charset, Vfont_encoding_charset_alist);
          if (CONSP (val) && CHARSETP (XCDR (val)))
            charset = XCDR (val);
-         id = XINT (CHARSET_SYMBOL_ID (charset));
+         id = XFIXNUM (CHARSET_SYMBOL_ID (charset));
        }
       else
        id = -1;
@@ -990,8 +990,8 @@ face_for_char (struct frame *f, struct face *face, int c,
   rfont_def = fontset_font (fontset, c, face, id);
   if (VECTORP (rfont_def))
     {
-      if (INTEGERP (RFONT_DEF_FACE (rfont_def)))
-       face_id = XINT (RFONT_DEF_FACE (rfont_def));
+      if (FIXNUMP (RFONT_DEF_FACE (rfont_def)))
+       face_id = XFIXNUM (RFONT_DEF_FACE (rfont_def));
       else
        {
          Lisp_Object font_object;
@@ -1003,12 +1003,12 @@ face_for_char (struct frame *f, struct face *face, int 
c,
     }
   else
     {
-      if (INTEGERP (FONTSET_NOFONT_FACE (fontset)))
-       face_id = XINT (FONTSET_NOFONT_FACE (fontset));
+      if (FIXNUMP (FONTSET_NOFONT_FACE (fontset)))
+       face_id = XFIXNUM (FONTSET_NOFONT_FACE (fontset));
       else
        {
          face_id = face_for_font (f, Qnil, face);
-         set_fontset_nofont_face (fontset, make_number (face_id));
+         set_fontset_nofont_face (fontset, make_fixnum (face_id));
        }
     }
   eassert (face_id >= 0);
@@ -1040,7 +1040,7 @@ font_for_char (struct face *face, int c, ptrdiff_t pos, 
Lisp_Object object)
     }
   else
     {
-      charset = Fget_char_property (make_number (pos), Qcharset, object);
+      charset = Fget_char_property (make_fixnum (pos), Qcharset, object);
       if (CHARSETP (charset))
        {
          Lisp_Object val;
@@ -1048,7 +1048,7 @@ font_for_char (struct face *face, int c, ptrdiff_t pos, 
Lisp_Object object)
          val = assq_no_quit (charset, Vfont_encoding_charset_alist);
          if (CONSP (val) && CHARSETP (XCDR (val)))
            charset = XCDR (val);
-         id = XINT (CHARSET_SYMBOL_ID (charset));
+         id = XFIXNUM (CHARSET_SYMBOL_ID (charset));
        }
       else
        id = -1;
@@ -1083,7 +1083,7 @@ make_fontset_for_ascii_face (struct frame *f, int 
base_fontset_id, struct face *
     base_fontset = Vdefault_fontset;
 
   fontset = make_fontset (frame, Qnil, base_fontset);
-  return XINT (FONTSET_ID (fontset));
+  return XFIXNUM (FONTSET_ID (fontset));
 }
 
 
@@ -1306,7 +1306,7 @@ free_realized_fontsets (Lisp_Object base)
               tail = XCDR (tail))
            {
              struct frame *f = XFRAME (FONTSET_FRAME (this));
-             int face_id = XINT (XCDR (XCAR (tail)));
+             int face_id = XFIXNUM (XCDR (XCAR (tail)));
              struct face *face = FACE_FROM_ID_OR_NULL (f, face_id);
 
              /* Face THIS itself is also freed by the following call.  */
@@ -1399,7 +1399,7 @@ static void
 set_fontset_font (Lisp_Object arg, Lisp_Object range)
 {
   Lisp_Object fontset, font_def, add, ascii, script_range_list;
-  int from = XINT (XCAR (range)), to = XINT (XCDR (range));
+  int from = XFIXNUM (XCAR (range)), to = XFIXNUM (XCDR (range));
 
   fontset = AREF (arg, 0);
   font_def = AREF (arg, 1);
@@ -1412,11 +1412,11 @@ set_fontset_font (Lisp_Object arg, Lisp_Object range)
       if (to < 0x80)
        return;
       from = 0x80;
-      range = Fcons (make_number (0x80), XCDR (range));
+      range = Fcons (make_fixnum (0x80), XCDR (range));
     }
 
-#define SCRIPT_FROM XINT (XCAR (XCAR (script_range_list)))
-#define SCRIPT_TO XINT (XCDR (XCAR (script_range_list)))
+#define SCRIPT_FROM XFIXNUM (XCAR (XCAR (script_range_list)))
+#define SCRIPT_TO XFIXNUM (XCDR (XCAR (script_range_list)))
 #define POP_SCRIPT_RANGE() script_range_list = XCDR (script_range_list)
 
   for (; CONSP (script_range_list) && SCRIPT_TO < from; POP_SCRIPT_RANGE ())
@@ -1424,11 +1424,11 @@ set_fontset_font (Lisp_Object arg, Lisp_Object range)
   if (CONSP (script_range_list))
     {
       if (SCRIPT_FROM < from)
-       range = Fcons (make_number (SCRIPT_FROM), XCDR (range));
+       range = Fcons (make_fixnum (SCRIPT_FROM), XCDR (range));
       while (CONSP (script_range_list) && SCRIPT_TO <= to)
        POP_SCRIPT_RANGE ();
       if (CONSP (script_range_list) && SCRIPT_FROM <= to)
-       XSETCAR (XCAR (script_range_list), make_number (to + 1));
+       XSETCAR (XCAR (script_range_list), make_fixnum (to + 1));
     }
 
   FONTSET_ADD (fontset, range, font_def, add);
@@ -1442,23 +1442,26 @@ DEFUN ("set-fontset-font", Fset_fontset_font, 
Sset_fontset_font, 3, 5, 0,
        doc: /*
 Modify fontset NAME to use FONT-SPEC for TARGET characters.
 
-NAME is a fontset name string, nil for the fontset of FRAME, or t for
-the default fontset.
+NAME is a fontset name (a string), nil for the fontset of FRAME,
+or t for the default fontset.
 
 TARGET may be a single character to use FONT-SPEC for.
 
 Target may be a cons (FROM . TO), where FROM and TO are characters.
-In that case, use FONT-SPEC for all characters in the range FROM
-and TO (inclusive).
+In that case, use FONT-SPEC for all the characters in the range
+between FROM and TO (inclusive).
 
-TARGET may be a script name symbol.  In that case, use FONT-SPEC for
-all characters that belong to the script.
+TARGET may be a script symbol.  In that case, use FONT-SPEC for
+all the characters that belong to the script.  See the variable
+`script-representative-chars' for the list of known scripts.
 
 TARGET may be a charset.  In that case, use FONT-SPEC for all
-characters in the charset.
+the characters in the charset.  See `list-character-sets' and
+`list-charset-chars' for the list of character sets and their
+characters.
 
-TARGET may be nil.  In that case, use FONT-SPEC for any characters for
-that no FONT-SPEC is specified.
+TARGET may be nil.  In that case, use FONT-SPEC for any character for
+which no font-spec is specified.
 
 FONT-SPEC may one of these:
  * A font-spec object made by the function `font-spec' (which see).
@@ -1468,11 +1471,11 @@ FONT-SPEC may one of these:
  * A font name string.
  * nil, which explicitly specifies that there's no font for TARGET.
 
-Optional 4th argument FRAME is a frame or nil for the selected frame
-that is concerned in the case that NAME is nil.
+Optional 4th argument FRAME is a frame, or nil for the selected frame,
+to be considered in the case that NAME is nil.
 
 Optional 5th argument ADD, if non-nil, specifies how to add FONT-SPEC
-to the font specifications for TARGET previously set.  If it is
+to the previously set font specifications for TARGET.  If it is
 `prepend', FONT-SPEC is prepended.  If it is `append', FONT-SPEC is
 appended.  By default, FONT-SPEC overrides the previous settings.  */)
   (Lisp_Object name, Lisp_Object target, Lisp_Object font_spec, Lisp_Object 
frame, Lisp_Object add)
@@ -1544,7 +1547,7 @@ appended.  By default, FONT-SPEC overrides the previous 
settings.  */)
 
   if (CHARACTERP (target))
     {
-      if (XFASTINT (target) < 0x80)
+      if (XFIXNAT (target) < 0x80)
        error ("Can't set a font for partial ASCII range");
       range_list = list1 (Fcons (target, target));
     }
@@ -1556,9 +1559,9 @@ appended.  By default, FONT-SPEC overrides the previous 
settings.  */)
       to = Fcdr (target);
       CHECK_CHARACTER (from);
       CHECK_CHARACTER (to);
-      if (XFASTINT (from) < 0x80)
+      if (XFIXNAT (from) < 0x80)
        {
-         if (XFASTINT (from) != 0 || XFASTINT (to) < 0x7F)
+         if (XFIXNAT (from) != 0 || XFIXNAT (to) < 0x7F)
            error ("Can't set a font for partial ASCII range");
          ascii_changed = 1;
        }
@@ -1629,7 +1632,7 @@ appended.  By default, FONT-SPEC overrides the previous 
settings.  */)
   if (ascii_changed)
     {
       Lisp_Object tail, fr;
-      int fontset_id = XINT (FONTSET_ID (fontset));
+      int fontset_id = XFIXNUM (FONTSET_ID (fontset));
 
       set_fontset_ascii (fontset, fontname);
       name = FONTSET_NAME (fontset);
@@ -1762,7 +1765,7 @@ fontset_from_font (Lisp_Object font_object)
 
   val = assoc_no_quit (font_spec, auto_fontset_alist);
   if (CONSP (val))
-    return XINT (FONTSET_ID (XCDR (val)));
+    return XFIXNUM (FONTSET_ID (XCDR (val)));
   if (num_auto_fontsets++ == 0)
     alias = intern ("fontset-startup");
   else
@@ -1797,7 +1800,7 @@ fontset_from_font (Lisp_Object font_object)
 
   set_fontset_ascii (fontset, font_name);
 
-  return XINT (FONTSET_ID (fontset));
+  return XFIXNUM (FONTSET_ID (fontset));
 }
 
 
@@ -1985,7 +1988,7 @@ patterns.  */)
   fontset = check_fontset_name (name, &frame);
 
   CHECK_CHARACTER (ch);
-  c = XINT (ch);
+  c = XFIXNUM (ch);
   list = Qnil;
   while (1)
     {
@@ -2000,9 +2003,9 @@ patterns.  */)
              if (NILP (val))
                return Qnil;
              repertory = AREF (val, 1);
-             if (INTEGERP (repertory))
+             if (FIXNUMP (repertory))
                {
-                 struct charset *charset = CHARSET_FROM_ID (XINT (repertory));
+                 struct charset *charset = CHARSET_FROM_ID (XFIXNUM 
(repertory));
 
                  if (! CHAR_CHARSET_P (c, charset))
                    continue;
@@ -2061,7 +2064,7 @@ dump_fontset (Lisp_Object fontset)
 {
   Lisp_Object vec;
 
-  vec = Fmake_vector (make_number (3), Qnil);
+  vec = Fmake_vector (make_fixnum (3), Qnil);
   ASET (vec, 0, FONTSET_ID (fontset));
 
   if (BASE_FONTSET_P (fontset))
@@ -2109,9 +2112,9 @@ void
 syms_of_fontset (void)
 {
   DEFSYM (Qfontset, "fontset");
-  Fput (Qfontset, Qchar_table_extra_slots, make_number (8));
+  Fput (Qfontset, Qchar_table_extra_slots, make_fixnum (8));
   DEFSYM (Qfontset_info, "fontset-info");
-  Fput (Qfontset_info, Qchar_table_extra_slots, make_number (1));
+  Fput (Qfontset_info, Qchar_table_extra_slots, make_fixnum (1));
 
   DEFSYM (Qappend, "append");
   DEFSYM (Qlatin, "latin");
@@ -2119,12 +2122,12 @@ syms_of_fontset (void)
   Vcached_fontset_data = Qnil;
   staticpro (&Vcached_fontset_data);
 
-  Vfontset_table = Fmake_vector (make_number (32), Qnil);
+  Vfontset_table = Fmake_vector (make_fixnum (32), Qnil);
   staticpro (&Vfontset_table);
 
   Vdefault_fontset = Fmake_char_table (Qfontset, Qnil);
   staticpro (&Vdefault_fontset);
-  set_fontset_id (Vdefault_fontset, make_number (0));
+  set_fontset_id (Vdefault_fontset, make_fixnum (0));
   set_fontset_name
     (Vdefault_fontset,
      build_pure_c_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default"));
diff --git a/src/frame.c b/src/frame.c
index 85ec740..ece8971 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -153,17 +153,17 @@ frame_size_history_add (struct frame *f, Lisp_Object 
fun_symbol,
 
   XSETFRAME (frame, f);
   if (CONSP (frame_size_history)
-      && INTEGERP (XCAR (frame_size_history))
-      && 0 < XINT (XCAR (frame_size_history)))
+      && FIXNUMP (XCAR (frame_size_history))
+      && 0 < XFIXNUM (XCAR (frame_size_history)))
     frame_size_history =
-      Fcons (make_number (XINT (XCAR (frame_size_history)) - 1),
+      Fcons (make_fixnum (XFIXNUM (XCAR (frame_size_history)) - 1),
             Fcons (list4
                    (frame, fun_symbol,
                     ((width > 0)
-                     ? list4 (make_number (FRAME_TEXT_WIDTH (f)),
-                              make_number (FRAME_TEXT_HEIGHT (f)),
-                              make_number (width),
-                              make_number (height))
+                     ? list4 (make_fixnum (FRAME_TEXT_WIDTH (f)),
+                              make_fixnum (FRAME_TEXT_HEIGHT (f)),
+                              make_fixnum (width),
+                              make_fixnum (height))
                      : Qnil),
                     rest),
                    XCDR (frame_size_history)));
@@ -214,8 +214,8 @@ set_menu_bar_lines (struct frame *f, Lisp_Object value, 
Lisp_Object oldval)
   if (FRAME_MINIBUF_ONLY_P (f))
     return;
 
-  if (TYPE_RANGED_INTEGERP (int, value))
-    nlines = XINT (value);
+  if (TYPE_RANGED_FIXNUMP (int, value))
+    nlines = XFIXNUM (value);
   else
     nlines = 0;
 
@@ -317,7 +317,7 @@ DEFUN ("frame-windows-min-size", Fframe_windows_min_size,
      (Lisp_Object frame, Lisp_Object horizontal,
       Lisp_Object ignore, Lisp_Object pixelwise)
 {
-  return make_number (0);
+  return make_fixnum (0);
 }
 
 /**
@@ -350,11 +350,11 @@ frame_windows_min_size (Lisp_Object frame, Lisp_Object 
horizontal,
   int retval;
 
   if ((!NILP (horizontal)
-       && NUMBERP (par_size = get_frame_param (f, Qmin_width)))
+       && FIXED_OR_FLOATP (par_size = get_frame_param (f, Qmin_width)))
       || (NILP (horizontal)
-         && NUMBERP (par_size = get_frame_param (f, Qmin_height))))
+         && FIXED_OR_FLOATP (par_size = get_frame_param (f, Qmin_height))))
     {
-      int min_size = XINT (par_size);
+      int min_size = XFIXNUM (par_size);
 
       /* Don't allow phantom frames.  */
       if (min_size < 1)
@@ -367,7 +367,7 @@ frame_windows_min_size (Lisp_Object frame, Lisp_Object 
horizontal,
                              : FRAME_COLUMN_WIDTH (f)));
     }
   else
-    retval = XINT (call4 (Qframe_windows_min_size, frame, horizontal,
+    retval = XFIXNUM (call4 (Qframe_windows_min_size, frame, horizontal,
                          ignore, pixelwise));
   /* Don't allow too small height of text-mode frames, or else cm.c
      might abort in cmcheckmagic.  */
@@ -591,7 +591,7 @@ adjust_frame_size (struct frame *f, int new_width, int 
new_height, int inhibit,
 
   frame_size_history_add
     (f, Qadjust_frame_size_1, new_text_width, new_text_height,
-     list2 (parameter, make_number (inhibit)));
+     list2 (parameter, make_fixnum (inhibit)));
 
   /* The following two values are calculated from the old window body
      sizes and any "new" settings for scroll bars, dividers, fringes and
@@ -737,8 +737,8 @@ adjust_frame_size (struct frame *f, int new_width, int 
new_height, int inhibit,
 
   frame_size_history_add
     (f, Qadjust_frame_size_3, new_text_width, new_text_height,
-     list4 (make_number (old_pixel_width), make_number (old_pixel_height),
-           make_number (new_pixel_width), make_number (new_pixel_height)));
+     list4 (make_fixnum (old_pixel_width), make_fixnum (old_pixel_height),
+           make_fixnum (new_pixel_width), make_fixnum (new_pixel_height)));
 
   /* Assign new sizes.  */
   FRAME_TEXT_WIDTH (f) = new_text_width;
@@ -1075,7 +1075,7 @@ make_initial_frame (void)
 #endif
 
   /* The default value of menu-bar-mode is t.  */
-  set_menu_bar_lines (f, make_number (1), Qnil);
+  set_menu_bar_lines (f, make_fixnum (1), Qnil);
 
   /* Allocate glyph matrices.  */
   adjust_frame_glyphs (f);
@@ -1593,7 +1593,7 @@ candidate_frame (Lisp_Object candidate, Lisp_Object 
frame, Lisp_Object minibuf)
                     FRAME_FOCUS_FRAME (c)))
            return candidate;
        }
-      else if (INTEGERP (minibuf) && XINT (minibuf) == 0)
+      else if (FIXNUMP (minibuf) && XFIXNUM (minibuf) == 0)
        {
          if (FRAME_VISIBLE_P (c) || FRAME_ICONIFIED_P (c))
            return candidate;
@@ -1785,7 +1785,7 @@ check_minibuf_window (Lisp_Object frame, int select)
 
   if (WINDOWP (minibuf_window) && EQ (f->minibuffer_window, minibuf_window))
     {
-      Lisp_Object frames, this, window = make_number (0);
+      Lisp_Object frames, this, window = make_fixnum (0);
 
       if (!EQ (frame, selected_frame)
          && FRAME_HAS_MINIBUF_P (XFRAME (selected_frame)))
@@ -2315,8 +2315,8 @@ and returns whatever that function returns.  */)
 
   if (! NILP (x))
     {
-      int col = XINT (x);
-      int row = XINT (y);
+      int col = XFIXNUM (x);
+      int row = XFIXNUM (y);
       pixel_to_glyph_coords (f, col, row, &col, &row, NULL, 1);
       XSETINT (x, col);
       XSETINT (y, row);
@@ -2425,19 +2425,19 @@ before calling this function on it, like this.
 #ifdef HAVE_WINDOW_SYSTEM
   if (FRAME_WINDOW_P (XFRAME (frame)))
     /* Warping the mouse will cause enternotify and focus events.  */
-    frame_set_mouse_position (XFRAME (frame), XINT (x), XINT (y));
+    frame_set_mouse_position (XFRAME (frame), XFIXNUM (x), XFIXNUM (y));
 #else
 #if defined (MSDOS)
   if (FRAME_MSDOS_P (XFRAME (frame)))
     {
       Fselect_frame (frame, Qnil);
-      mouse_moveto (XINT (x), XINT (y));
+      mouse_moveto (XFIXNUM (x), XFIXNUM (y));
     }
 #else
 #ifdef HAVE_GPM
     {
       Fselect_frame (frame, Qnil);
-      term_mouse_moveto (XINT (x), XINT (y));
+      term_mouse_moveto (XFIXNUM (x), XFIXNUM (y));
     }
 #endif
 #endif
@@ -2466,19 +2466,19 @@ before calling this function on it, like this.
 #ifdef HAVE_WINDOW_SYSTEM
   if (FRAME_WINDOW_P (XFRAME (frame)))
     /* Warping the mouse will cause enternotify and focus events.  */
-    frame_set_mouse_pixel_position (XFRAME (frame), XINT (x), XINT (y));
+    frame_set_mouse_pixel_position (XFRAME (frame), XFIXNUM (x), XFIXNUM (y));
 #else
 #if defined (MSDOS)
   if (FRAME_MSDOS_P (XFRAME (frame)))
     {
       Fselect_frame (frame, Qnil);
-      mouse_moveto (XINT (x), XINT (y));
+      mouse_moveto (XFIXNUM (x), XFIXNUM (y));
     }
 #else
 #ifdef HAVE_GPM
     {
       Fselect_frame (frame, Qnil);
-      term_mouse_moveto (XINT (x), XINT (y));
+      term_mouse_moveto (XFIXNUM (x), XFIXNUM (y));
     }
 #endif
 #endif
@@ -2982,7 +2982,7 @@ store_frame_param (struct frame *f, Lisp_Object prop, 
Lisp_Object val)
   if (! FRAME_WINDOW_P (f))
     {
       if (EQ (prop, Qmenu_bar_lines))
-       set_menu_bar_lines (f, val, make_number (FRAME_MENU_BAR_LINES (f)));
+       set_menu_bar_lines (f, val, make_fixnum (FRAME_MENU_BAR_LINES (f)));
       else if (EQ (prop, Qname))
        set_term_frame_name (f, val);
     }
@@ -3055,13 +3055,13 @@ If FRAME is omitted or nil, return information on the 
currently selected frame.
               ? (f->new_height / FRAME_LINE_HEIGHT (f))
               : f->new_height)
            : FRAME_LINES (f));
-  store_in_alist (&alist, Qheight, make_number (height));
+  store_in_alist (&alist, Qheight, make_fixnum (height));
   width = (f->new_width
           ? (f->new_pixelwise
              ? (f->new_width / FRAME_COLUMN_WIDTH (f))
              : f->new_width)
           : FRAME_COLS (f));
-  store_in_alist (&alist, Qwidth, make_number (width));
+  store_in_alist (&alist, Qwidth, make_fixnum (width));
   store_in_alist (&alist, Qmodeline, (FRAME_WANTS_MODELINE_P (f) ? Qt : Qnil));
   store_in_alist (&alist, Qunsplittable, (FRAME_NO_SPLIT_P (f) ? Qt : Qnil));
   store_in_alist (&alist, Qbuffer_list, f->buffer_list);
@@ -3113,7 +3113,7 @@ If FRAME is nil, describe the currently selected frame.  
*/)
       else if (EQ (parameter, Qline_spacing) && f->extra_line_spacing == 0)
        /* If this is non-zero, we can't determine whether the user specified
           an integer or float value without looking through 'param_alist'.  */
-       value = make_number (0);
+       value = make_fixnum (0);
       else if (EQ (parameter, Qfont) && FRAME_X_P (f))
        value = FRAME_FONT (f)->props[FONT_NAME_INDEX];
 #endif /* HAVE_WINDOW_SYSTEM */
@@ -3186,7 +3186,7 @@ list, but are otherwise ignored.  */)
 #endif
 
     {
-      EMACS_INT length = XFASTINT (Flength (alist));
+      EMACS_INT length = XFIXNAT (Flength (alist));
       ptrdiff_t i;
       Lisp_Object *parms;
       Lisp_Object *values;
@@ -3234,10 +3234,10 @@ For a terminal frame, the value is always 1.  */)
   struct frame *f = decode_any_frame (frame);
 
   if (FRAME_WINDOW_P (f))
-    return make_number (FRAME_LINE_HEIGHT (f));
+    return make_fixnum (FRAME_LINE_HEIGHT (f));
   else
 #endif
-    return make_number (1);
+    return make_fixnum (1);
 }
 
 
@@ -3253,10 +3253,10 @@ For a terminal screen, the value is always 1.  */)
   struct frame *f = decode_any_frame (frame);
 
   if (FRAME_WINDOW_P (f))
-    return make_number (FRAME_COLUMN_WIDTH (f));
+    return make_fixnum (FRAME_COLUMN_WIDTH (f));
   else
 #endif
-    return make_number (1);
+    return make_fixnum (1);
 }
 
 DEFUN ("frame-native-width", Fframe_native_width,
@@ -3270,10 +3270,10 @@ If FRAME is omitted or nil, the selected frame is used. 
 */)
 
 #ifdef HAVE_WINDOW_SYSTEM
   if (FRAME_WINDOW_P (f))
-    return make_number (FRAME_PIXEL_WIDTH (f));
+    return make_fixnum (FRAME_PIXEL_WIDTH (f));
   else
 #endif
-    return make_number (FRAME_TOTAL_COLS (f));
+    return make_fixnum (FRAME_TOTAL_COLS (f));
 }
 
 DEFUN ("frame-native-height", Fframe_native_height,
@@ -3296,10 +3296,10 @@ to `frame-height'). */)
 
 #ifdef HAVE_WINDOW_SYSTEM
   if (FRAME_WINDOW_P (f))
-    return make_number (FRAME_PIXEL_HEIGHT (f));
+    return make_fixnum (FRAME_PIXEL_HEIGHT (f));
   else
 #endif
-    return make_number (FRAME_TOTAL_LINES (f));
+    return make_fixnum (FRAME_TOTAL_LINES (f));
 }
 
 DEFUN ("tool-bar-pixel-width", Ftool_bar_pixel_width,
@@ -3314,93 +3314,93 @@ is used.  */)
   struct frame *f = decode_any_frame (frame);
 
   if (FRAME_WINDOW_P (f))
-    return make_number (FRAME_TOOLBAR_WIDTH (f));
+    return make_fixnum (FRAME_TOOLBAR_WIDTH (f));
 #endif
-  return make_number (0);
+  return make_fixnum (0);
 }
 
 DEFUN ("frame-text-cols", Fframe_text_cols, Sframe_text_cols, 0, 1, 0,
        doc: /* Return width in columns of FRAME's text area.  */)
   (Lisp_Object frame)
 {
-  return make_number (FRAME_COLS (decode_any_frame (frame)));
+  return make_fixnum (FRAME_COLS (decode_any_frame (frame)));
 }
 
 DEFUN ("frame-text-lines", Fframe_text_lines, Sframe_text_lines, 0, 1, 0,
        doc: /* Return height in lines of FRAME's text area.  */)
   (Lisp_Object frame)
 {
-  return make_number (FRAME_LINES (decode_any_frame (frame)));
+  return make_fixnum (FRAME_LINES (decode_any_frame (frame)));
 }
 
 DEFUN ("frame-total-cols", Fframe_total_cols, Sframe_total_cols, 0, 1, 0,
        doc: /* Return number of total columns of FRAME.  */)
   (Lisp_Object frame)
 {
-  return make_number (FRAME_TOTAL_COLS (decode_any_frame (frame)));
+  return make_fixnum (FRAME_TOTAL_COLS (decode_any_frame (frame)));
 }
 
 DEFUN ("frame-total-lines", Fframe_total_lines, Sframe_total_lines, 0, 1, 0,
        doc: /* Return number of total lines of FRAME.  */)
   (Lisp_Object frame)
 {
-  return make_number (FRAME_TOTAL_LINES (decode_any_frame (frame)));
+  return make_fixnum (FRAME_TOTAL_LINES (decode_any_frame (frame)));
 }
 
 DEFUN ("frame-text-width", Fframe_text_width, Sframe_text_width, 0, 1, 0,
        doc: /* Return text area width of FRAME in pixels.  */)
   (Lisp_Object frame)
 {
-  return make_number (FRAME_TEXT_WIDTH (decode_any_frame (frame)));
+  return make_fixnum (FRAME_TEXT_WIDTH (decode_any_frame (frame)));
 }
 
 DEFUN ("frame-text-height", Fframe_text_height, Sframe_text_height, 0, 1, 0,
        doc: /* Return text area height of FRAME in pixels.  */)
   (Lisp_Object frame)
 {
-  return make_number (FRAME_TEXT_HEIGHT (decode_any_frame (frame)));
+  return make_fixnum (FRAME_TEXT_HEIGHT (decode_any_frame (frame)));
 }
 
 DEFUN ("frame-scroll-bar-width", Fscroll_bar_width, Sscroll_bar_width, 0, 1, 0,
        doc: /* Return scroll bar width of FRAME in pixels.  */)
   (Lisp_Object frame)
 {
-  return make_number (FRAME_SCROLL_BAR_AREA_WIDTH (decode_any_frame (frame)));
+  return make_fixnum (FRAME_SCROLL_BAR_AREA_WIDTH (decode_any_frame (frame)));
 }
 
 DEFUN ("frame-scroll-bar-height", Fscroll_bar_height, Sscroll_bar_height, 0, 
1, 0,
        doc: /* Return scroll bar height of FRAME in pixels.  */)
   (Lisp_Object frame)
 {
-  return make_number (FRAME_SCROLL_BAR_AREA_HEIGHT (decode_any_frame (frame)));
+  return make_fixnum (FRAME_SCROLL_BAR_AREA_HEIGHT (decode_any_frame (frame)));
 }
 
 DEFUN ("frame-fringe-width", Ffringe_width, Sfringe_width, 0, 1, 0,
        doc: /* Return fringe width of FRAME in pixels.  */)
   (Lisp_Object frame)
 {
-  return make_number (FRAME_TOTAL_FRINGE_WIDTH (decode_any_frame (frame)));
+  return make_fixnum (FRAME_TOTAL_FRINGE_WIDTH (decode_any_frame (frame)));
 }
 
 DEFUN ("frame-internal-border-width", Fframe_internal_border_width, 
Sframe_internal_border_width, 0, 1, 0,
        doc: /* Return width of FRAME's internal border in pixels.  */)
   (Lisp_Object frame)
 {
-  return make_number (FRAME_INTERNAL_BORDER_WIDTH (decode_any_frame (frame)));
+  return make_fixnum (FRAME_INTERNAL_BORDER_WIDTH (decode_any_frame (frame)));
 }
 
 DEFUN ("frame-right-divider-width", Fright_divider_width, 
Sright_divider_width, 0, 1, 0,
        doc: /* Return width (in pixels) of vertical window dividers on FRAME.  
*/)
   (Lisp_Object frame)
 {
-  return make_number (FRAME_RIGHT_DIVIDER_WIDTH (decode_any_frame (frame)));
+  return make_fixnum (FRAME_RIGHT_DIVIDER_WIDTH (decode_any_frame (frame)));
 }
 
 DEFUN ("frame-bottom-divider-width", Fbottom_divider_width, 
Sbottom_divider_width, 0, 1, 0,
        doc: /* Return width (in pixels) of horizontal window dividers on 
FRAME.  */)
   (Lisp_Object frame)
 {
-  return make_number (FRAME_BOTTOM_DIVIDER_WIDTH (decode_any_frame (frame)));
+  return make_fixnum (FRAME_BOTTOM_DIVIDER_WIDTH (decode_any_frame (frame)));
 }
 
 DEFUN ("set-frame-height", Fset_frame_height, Sset_frame_height, 2, 4, 0,
@@ -3421,8 +3421,8 @@ multiple of the default frame font height.  */)
   CHECK_TYPE_RANGED_INTEGER (int, height);
 
   pixel_height = (!NILP (pixelwise)
-                 ? XINT (height)
-                 : XINT (height) * FRAME_LINE_HEIGHT (f));
+                 ? XFIXNUM (height)
+                 : XFIXNUM (height) * FRAME_LINE_HEIGHT (f));
   adjust_frame_size (f, -1, pixel_height, 1, !NILP (pretend), Qheight);
 
   return Qnil;
@@ -3446,8 +3446,8 @@ multiple of the default frame font width.  */)
   CHECK_TYPE_RANGED_INTEGER (int, width);
 
   pixel_width = (!NILP (pixelwise)
-                ? XINT (width)
-                : XINT (width) * FRAME_COLUMN_WIDTH (f));
+                ? XFIXNUM (width)
+                : XFIXNUM (width) * FRAME_COLUMN_WIDTH (f));
   adjust_frame_size (f, pixel_width, -1, 1, !NILP (pretend), Qwidth);
 
   return Qnil;
@@ -3469,11 +3469,11 @@ font height.  */)
   CHECK_TYPE_RANGED_INTEGER (int, height);
 
   pixel_width = (!NILP (pixelwise)
-                ? XINT (width)
-                : XINT (width) * FRAME_COLUMN_WIDTH (f));
+                ? XFIXNUM (width)
+                : XFIXNUM (width) * FRAME_COLUMN_WIDTH (f));
   pixel_height = (!NILP (pixelwise)
-                 ? XINT (height)
-                 : XINT (height) * FRAME_LINE_HEIGHT (f));
+                 ? XFIXNUM (height)
+                 : XFIXNUM (height) * FRAME_LINE_HEIGHT (f));
   adjust_frame_size (f, pixel_width, pixel_height, 1, 0, Qsize);
 
   return Qnil;
@@ -3490,7 +3490,7 @@ display.  */)
 {
   register struct frame *f = decode_live_frame (frame);
 
-  return Fcons (make_number (f->left_pos), make_number (f->top_pos));
+  return Fcons (make_fixnum (f->left_pos), make_fixnum (f->top_pos));
 }
 
 DEFUN ("set-frame-position", Fset_frame_position,
@@ -3513,7 +3513,7 @@ bottom edge of FRAME's display.  */)
   if (FRAME_WINDOW_P (f))
     {
 #ifdef HAVE_WINDOW_SYSTEM
-      x_set_offset (f, XINT (x), XINT (y), 1);
+      x_set_offset (f, XFIXNUM (x), XFIXNUM (y), 1);
 #endif
     }
 
@@ -3682,10 +3682,10 @@ frame_float (struct frame *f, Lisp_Object val, enum 
frame_float_type what,
                }
 
              /* Workarea available.  */
-             parent_left = XINT (Fnth (make_number (0), workarea));
-             parent_top = XINT (Fnth (make_number (1), workarea));
-             parent_width = XINT (Fnth (make_number (2), workarea));
-             parent_height = XINT (Fnth (make_number (3), workarea));
+             parent_left = XFIXNUM (Fnth (make_fixnum (0), workarea));
+             parent_top = XFIXNUM (Fnth (make_fixnum (1), workarea));
+             parent_width = XFIXNUM (Fnth (make_fixnum (2), workarea));
+             parent_height = XFIXNUM (Fnth (make_fixnum (3), workarea));
              *parent_done = 1;
            }
        }
@@ -3713,12 +3713,12 @@ frame_float (struct frame *f, Lisp_Object val, enum 
frame_float_type what,
          if (!NILP (outer_edges))
            {
              outer_minus_text_width
-               = (XINT (Fnth (make_number (2), outer_edges))
-                  - XINT (Fnth (make_number (0), outer_edges))
+               = (XFIXNUM (Fnth (make_fixnum (2), outer_edges))
+                  - XFIXNUM (Fnth (make_fixnum (0), outer_edges))
                   - FRAME_TEXT_WIDTH (f));
              outer_minus_text_height
-               = (XINT (Fnth (make_number (3), outer_edges))
-                  - XINT (Fnth (make_number (1), outer_edges))
+               = (XFIXNUM (Fnth (make_fixnum (3), outer_edges))
+                  - XFIXNUM (Fnth (make_fixnum (1), outer_edges))
                   - FRAME_TEXT_HEIGHT (f));
            }
          else
@@ -3798,7 +3798,7 @@ x_set_frame_parameters (struct frame *f, Lisp_Object 
alist)
   Lisp_Object icon_left, icon_top;
 
   /* And with this.  */
-  Lisp_Object fullscreen;
+  Lisp_Object fullscreen UNINIT;
   bool fullscreen_change = false;
 
   /* Record in these vectors all the parms specified.  */
@@ -3867,22 +3867,22 @@ x_set_frame_parameters (struct frame *f, Lisp_Object 
alist)
 
       if (EQ (prop, Qwidth))
         {
-         if (RANGED_INTEGERP (0, val, INT_MAX))
-           width = XFASTINT (val) * FRAME_COLUMN_WIDTH (f) ;
+         if (RANGED_FIXNUMP (0, val, INT_MAX))
+           width = XFIXNAT (val) * FRAME_COLUMN_WIDTH (f) ;
          else if (CONSP (val) && EQ (XCAR (val), Qtext_pixels)
-                  && RANGED_INTEGERP (0, XCDR (val), INT_MAX))
-           width = XFASTINT (XCDR (val));
+                  && RANGED_FIXNUMP (0, XCDR (val), INT_MAX))
+           width = XFIXNAT (XCDR (val));
          else if (FLOATP (val))
            width = frame_float (f, val, FRAME_FLOAT_WIDTH, &parent_done,
                                 &outer_done, -1);
         }
       else if (EQ (prop, Qheight))
         {
-         if (RANGED_INTEGERP (0, val, INT_MAX))
-           height = XFASTINT (val) * FRAME_LINE_HEIGHT (f);
+         if (RANGED_FIXNUMP (0, val, INT_MAX))
+           height = XFIXNAT (val) * FRAME_LINE_HEIGHT (f);
          else if (CONSP (val) && EQ (XCAR (val), Qtext_pixels)
-                  && RANGED_INTEGERP (0, XCDR (val), INT_MAX))
-           height = XFASTINT (XCDR (val));
+                  && RANGED_FIXNUMP (0, XCDR (val), INT_MAX))
+           height = XFIXNAT (XCDR (val));
          else if (FLOATP (val))
            height = frame_float (f, val, FRAME_FLOAT_HEIGHT, &parent_done,
                                 &outer_done, -1);
@@ -3909,10 +3909,10 @@ x_set_frame_parameters (struct frame *f, Lisp_Object 
alist)
          store_frame_param (f, prop, val);
 
          param_index = Fget (prop, Qx_frame_parameter);
-         if (NATNUMP (param_index)
-             && XFASTINT (param_index) < ARRAYELTS (frame_parms)
-             && FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)])
-           (*(FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)])) (f, 
val, old_value);
+         if (FIXNATP (param_index)
+             && XFIXNAT (param_index) < ARRAYELTS (frame_parms)
+             && FRAME_RIF (f)->frame_parm_handlers[XFIXNUM (param_index)])
+           (*(FRAME_RIF (f)->frame_parm_handlers[XFIXNUM (param_index)])) (f, 
val, old_value);
        }
     }
 
@@ -3921,7 +3921,7 @@ x_set_frame_parameters (struct frame *f, Lisp_Object 
alist)
     {
       left_no_change = 1;
       if (f->left_pos < 0)
-       left = list2 (Qplus, make_number (f->left_pos));
+       left = list2 (Qplus, make_fixnum (f->left_pos));
       else
        XSETINT (left, f->left_pos);
     }
@@ -3929,13 +3929,13 @@ x_set_frame_parameters (struct frame *f, Lisp_Object 
alist)
     {
       top_no_change = 1;
       if (f->top_pos < 0)
-       top = list2 (Qplus, make_number (f->top_pos));
+       top = list2 (Qplus, make_fixnum (f->top_pos));
       else
        XSETINT (top, f->top_pos);
     }
 
   /* If one of the icon positions was not set, preserve or default it.  */
-  if (! TYPE_RANGED_INTEGERP (int, icon_left))
+  if (! TYPE_RANGED_FIXNUMP (int, icon_left))
     {
 #ifdef HAVE_X_WINDOWS
       icon_left_no_change = 1;
@@ -3944,7 +3944,7 @@ x_set_frame_parameters (struct frame *f, Lisp_Object 
alist)
       if (NILP (icon_left))
        XSETINT (icon_left, 0);
     }
-  if (! TYPE_RANGED_INTEGERP (int, icon_top))
+  if (! TYPE_RANGED_FIXNUMP (int, icon_top))
     {
 #ifdef HAVE_X_WINDOWS
       icon_top_no_change = 1;
@@ -3974,8 +3974,8 @@ x_set_frame_parameters (struct frame *f, Lisp_Object 
alist)
 
   if ((!NILP (left) || !NILP (top))
       && ! (left_no_change && top_no_change)
-      && ! (NUMBERP (left) && XINT (left) == f->left_pos
-           && NUMBERP (top) && XINT (top) == f->top_pos))
+      && ! (FIXED_OR_FLOATP (left) && XFIXNUM (left) == f->left_pos
+           && FIXED_OR_FLOATP (top) && XFIXNUM (top) == f->top_pos))
     {
       int leftpos = 0;
       int toppos = 0;
@@ -3984,46 +3984,46 @@ x_set_frame_parameters (struct frame *f, Lisp_Object 
alist)
       f->size_hint_flags &= ~ (XNegative | YNegative);
       if (EQ (left, Qminus))
        f->size_hint_flags |= XNegative;
-      else if (TYPE_RANGED_INTEGERP (int, left))
+      else if (TYPE_RANGED_FIXNUMP (int, left))
        {
-         leftpos = XINT (left);
+         leftpos = XFIXNUM (left);
          if (leftpos < 0)
            f->size_hint_flags |= XNegative;
        }
       else if (CONSP (left) && EQ (XCAR (left), Qminus)
               && CONSP (XCDR (left))
-              && RANGED_INTEGERP (-INT_MAX, XCAR (XCDR (left)), INT_MAX))
+              && RANGED_FIXNUMP (-INT_MAX, XCAR (XCDR (left)), INT_MAX))
        {
-         leftpos = - XINT (XCAR (XCDR (left)));
+         leftpos = - XFIXNUM (XCAR (XCDR (left)));
          f->size_hint_flags |= XNegative;
        }
       else if (CONSP (left) && EQ (XCAR (left), Qplus)
               && CONSP (XCDR (left))
-              && TYPE_RANGED_INTEGERP (int, XCAR (XCDR (left))))
-       leftpos = XINT (XCAR (XCDR (left)));
+              && TYPE_RANGED_FIXNUMP (int, XCAR (XCDR (left))))
+       leftpos = XFIXNUM (XCAR (XCDR (left)));
       else if (FLOATP (left))
        leftpos = frame_float (f, left, FRAME_FLOAT_LEFT, &parent_done,
                               &outer_done, 0);
 
       if (EQ (top, Qminus))
        f->size_hint_flags |= YNegative;
-      else if (TYPE_RANGED_INTEGERP (int, top))
+      else if (TYPE_RANGED_FIXNUMP (int, top))
        {
-         toppos = XINT (top);
+         toppos = XFIXNUM (top);
          if (toppos < 0)
            f->size_hint_flags |= YNegative;
        }
       else if (CONSP (top) && EQ (XCAR (top), Qminus)
               && CONSP (XCDR (top))
-              && RANGED_INTEGERP (-INT_MAX, XCAR (XCDR (top)), INT_MAX))
+              && RANGED_FIXNUMP (-INT_MAX, XCAR (XCDR (top)), INT_MAX))
        {
-         toppos = - XINT (XCAR (XCDR (top)));
+         toppos = - XFIXNUM (XCAR (XCDR (top)));
          f->size_hint_flags |= YNegative;
        }
       else if (CONSP (top) && EQ (XCAR (top), Qplus)
               && CONSP (XCDR (top))
-              && TYPE_RANGED_INTEGERP (int, XCAR (XCDR (top))))
-       toppos = XINT (XCAR (XCDR (top)));
+              && TYPE_RANGED_FIXNUMP (int, XCAR (XCDR (top))))
+       toppos = XFIXNUM (XCAR (XCDR (top)));
       else if (FLOATP (top))
        toppos = frame_float (f, top, FRAME_FLOAT_TOP, &parent_done,
                              &outer_done, 0);
@@ -4054,7 +4054,7 @@ x_set_frame_parameters (struct frame *f, Lisp_Object 
alist)
 #ifdef HAVE_X_WINDOWS
   if ((!NILP (icon_left) || !NILP (icon_top))
       && ! (icon_left_no_change && icon_top_no_change))
-    x_wm_set_icon_position (f, XINT (icon_left), XINT (icon_top));
+    x_wm_set_icon_position (f, XFIXNUM (icon_left), XFIXNUM (icon_top));
 #endif /* HAVE_X_WINDOWS */
 
   SAFE_FREE ();
@@ -4089,31 +4089,31 @@ x_report_frame_params (struct frame *f, Lisp_Object 
*alistptr)
     store_in_alist (alistptr, Qtop, list2 (Qplus, tem));
 
   store_in_alist (alistptr, Qborder_width,
-                 make_number (f->border_width));
+                 make_fixnum (f->border_width));
   store_in_alist (alistptr, Qinternal_border_width,
-                 make_number (FRAME_INTERNAL_BORDER_WIDTH (f)));
+                 make_fixnum (FRAME_INTERNAL_BORDER_WIDTH (f)));
   store_in_alist (alistptr, Qright_divider_width,
-                 make_number (FRAME_RIGHT_DIVIDER_WIDTH (f)));
+                 make_fixnum (FRAME_RIGHT_DIVIDER_WIDTH (f)));
   store_in_alist (alistptr, Qbottom_divider_width,
-                 make_number (FRAME_BOTTOM_DIVIDER_WIDTH (f)));
+                 make_fixnum (FRAME_BOTTOM_DIVIDER_WIDTH (f)));
   store_in_alist (alistptr, Qleft_fringe,
-                 make_number (FRAME_LEFT_FRINGE_WIDTH (f)));
+                 make_fixnum (FRAME_LEFT_FRINGE_WIDTH (f)));
   store_in_alist (alistptr, Qright_fringe,
-                 make_number (FRAME_RIGHT_FRINGE_WIDTH (f)));
+                 make_fixnum (FRAME_RIGHT_FRINGE_WIDTH (f)));
   store_in_alist (alistptr, Qscroll_bar_width,
                  (! FRAME_HAS_VERTICAL_SCROLL_BARS (f)
-                  ? make_number (0)
+                  ? make_fixnum (0)
                   : FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0
-                  ? make_number (FRAME_CONFIG_SCROLL_BAR_WIDTH (f))
+                  ? make_fixnum (FRAME_CONFIG_SCROLL_BAR_WIDTH (f))
                   /* nil means "use default width"
                      for non-toolkit scroll bar.
                      ruler-mode.el depends on this.  */
                   : Qnil));
   store_in_alist (alistptr, Qscroll_bar_height,
                  (! FRAME_HAS_HORIZONTAL_SCROLL_BARS (f)
-                  ? make_number (0)
+                  ? make_fixnum (0)
                   : FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) > 0
-                  ? make_number (FRAME_CONFIG_SCROLL_BAR_HEIGHT (f))
+                  ? make_fixnum (FRAME_CONFIG_SCROLL_BAR_HEIGHT (f))
                   /* nil means "use default height"
                      for non-toolkit scroll bar.  */
                   : Qnil));
@@ -4143,7 +4143,7 @@ x_report_frame_params (struct frame *f, Lisp_Object 
*alistptr)
   if (FRAME_X_OUTPUT (f)->parent_desc == FRAME_DISPLAY_INFO (f)->root_window)
     tem = Qnil;
   else
-    tem = make_natnum ((uintptr_t) FRAME_X_OUTPUT (f)->parent_desc);
+    tem = make_fixed_natnum ((uintptr_t) FRAME_X_OUTPUT (f)->parent_desc);
   store_in_alist (alistptr, Qexplicit_name, (f->explicit_name ? Qt : Qnil));
   store_in_alist (alistptr, Qparent_id, tem);
   store_in_alist (alistptr, Qtool_bar_position, FRAME_TOOL_BAR_POSITION (f));
@@ -4180,8 +4180,8 @@ x_set_line_spacing (struct frame *f, Lisp_Object 
new_value, Lisp_Object old_valu
 {
   if (NILP (new_value))
     f->extra_line_spacing = 0;
-  else if (RANGED_INTEGERP (0, new_value, INT_MAX))
-    f->extra_line_spacing = XFASTINT (new_value);
+  else if (RANGED_FIXNUMP (0, new_value, INT_MAX))
+    f->extra_line_spacing = XFIXNAT (new_value);
   else if (FLOATP (new_value))
     {
       int new_spacing = XFLOAT_DATA (new_value) * FRAME_LINE_HEIGHT (f) + 0.5;
@@ -4208,7 +4208,7 @@ x_set_screen_gamma (struct frame *f, Lisp_Object 
new_value, Lisp_Object old_valu
 
   if (NILP (new_value))
     f->gamma = 0;
-  else if (NUMBERP (new_value) && XFLOATINT (new_value) > 0)
+  else if (FIXED_OR_FLOATP (new_value) && XFLOATINT (new_value) > 0)
     /* The value 0.4545 is the normal viewing gamma.  */
     f->gamma = 1.0 / (0.4545 * XFLOATINT (new_value));
   else
@@ -4219,10 +4219,10 @@ x_set_screen_gamma (struct frame *f, Lisp_Object 
new_value, Lisp_Object old_valu
   if (CONSP (bgcolor) && (bgcolor = XCDR (bgcolor), STRINGP (bgcolor)))
     {
       Lisp_Object parm_index = Fget (Qbackground_color, Qx_frame_parameter);
-      if (NATNUMP (parm_index)
-         && XFASTINT (parm_index) < ARRAYELTS (frame_parms)
-         && FRAME_RIF (f)->frame_parm_handlers[XFASTINT (parm_index)])
-         (*FRAME_RIF (f)->frame_parm_handlers[XFASTINT (parm_index)])
+      if (FIXNATP (parm_index)
+         && XFIXNAT (parm_index) < ARRAYELTS (frame_parms)
+         && FRAME_RIF (f)->frame_parm_handlers[XFIXNAT (parm_index)])
+         (*FRAME_RIF (f)->frame_parm_handlers[XFIXNAT (parm_index)])
            (f, bgcolor, Qnil);
     }
 
@@ -4407,8 +4407,8 @@ x_set_left_fringe (struct frame *f, Lisp_Object 
new_value, Lisp_Object old_value
   int old_width = FRAME_LEFT_FRINGE_WIDTH (f);
   int new_width;
 
-  new_width = (RANGED_INTEGERP (-INT_MAX, new_value, INT_MAX)
-              ? eabs (XINT (new_value)) : 8);
+  new_width = (RANGED_FIXNUMP (-INT_MAX, new_value, INT_MAX)
+              ? eabs (XFIXNUM (new_value)) : 8);
 
   if (new_width != old_width)
     {
@@ -4431,8 +4431,8 @@ x_set_right_fringe (struct frame *f, Lisp_Object 
new_value, Lisp_Object old_valu
   int old_width = FRAME_RIGHT_FRINGE_WIDTH (f);
   int new_width;
 
-  new_width = (RANGED_INTEGERP (-INT_MAX, new_value, INT_MAX)
-              ? eabs (XINT (new_value)) : 8);
+  new_width = (RANGED_FIXNUMP (-INT_MAX, new_value, INT_MAX)
+              ? eabs (XFIXNUM (new_value)) : 8);
 
   if (new_width != old_width)
     {
@@ -4453,13 +4453,13 @@ x_set_border_width (struct frame *f, Lisp_Object arg, 
Lisp_Object oldval)
 {
   CHECK_TYPE_RANGED_INTEGER (int, arg);
 
-  if (XINT (arg) == f->border_width)
+  if (XFIXNUM (arg) == f->border_width)
     return;
 
   if (FRAME_X_WINDOW (f) != 0)
     error ("Cannot change the border width of a frame");
 
-  f->border_width = XINT (arg);
+  f->border_width = XFIXNUM (arg);
 }
 
 void
@@ -4467,7 +4467,7 @@ x_set_right_divider_width (struct frame *f, Lisp_Object 
arg, Lisp_Object oldval)
 {
   int old = FRAME_RIGHT_DIVIDER_WIDTH (f);
   CHECK_TYPE_RANGED_INTEGER (int, arg);
-  int new = max (0, XINT (arg));
+  int new = max (0, XFIXNUM (arg));
   if (new != old)
     {
       f->right_divider_width = new;
@@ -4482,7 +4482,7 @@ x_set_bottom_divider_width (struct frame *f, Lisp_Object 
arg, Lisp_Object oldval
 {
   int old = FRAME_BOTTOM_DIVIDER_WIDTH (f);
   CHECK_TYPE_RANGED_INTEGER (int, arg);
-  int new = max (0, XINT (arg));
+  int new = max (0, XFIXNUM (arg));
   if (new != old)
     {
       f->bottom_divider_width = new;
@@ -4591,11 +4591,11 @@ x_set_scroll_bar_width (struct frame *f, Lisp_Object 
arg, Lisp_Object oldval)
 
       SET_FRAME_GARBAGED (f);
     }
-  else if (RANGED_INTEGERP (1, arg, INT_MAX)
-          && XFASTINT (arg) != FRAME_CONFIG_SCROLL_BAR_WIDTH (f))
+  else if (RANGED_FIXNUMP (1, arg, INT_MAX)
+          && XFIXNAT (arg) != FRAME_CONFIG_SCROLL_BAR_WIDTH (f))
     {
-      FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = XFASTINT (arg);
-      FRAME_CONFIG_SCROLL_BAR_COLS (f) = (XFASTINT (arg) + unit - 1) / unit;
+      FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = XFIXNAT (arg);
+      FRAME_CONFIG_SCROLL_BAR_COLS (f) = (XFIXNAT (arg) + unit - 1) / unit;
       if (FRAME_X_WINDOW (f))
        adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_width);
 
@@ -4621,11 +4621,11 @@ x_set_scroll_bar_height (struct frame *f, Lisp_Object 
arg, Lisp_Object oldval)
 
       SET_FRAME_GARBAGED (f);
     }
-  else if (RANGED_INTEGERP (1, arg, INT_MAX)
-          && XFASTINT (arg) != FRAME_CONFIG_SCROLL_BAR_HEIGHT (f))
+  else if (RANGED_FIXNUMP (1, arg, INT_MAX)
+          && XFIXNAT (arg) != FRAME_CONFIG_SCROLL_BAR_HEIGHT (f))
     {
-      FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) = XFASTINT (arg);
-      FRAME_CONFIG_SCROLL_BAR_LINES (f) = (XFASTINT (arg) + unit - 1) / unit;
+      FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) = XFIXNAT (arg);
+      FRAME_CONFIG_SCROLL_BAR_LINES (f) = (XFIXNAT (arg) + unit - 1) / unit;
       if (FRAME_X_WINDOW (f))
        adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_height);
 
@@ -4664,11 +4664,11 @@ x_set_alpha (struct frame *f, Lisp_Object arg, 
Lisp_Object oldval)
          if (! (0 <= alpha && alpha <= 1.0))
            args_out_of_range (make_float (0.0), make_float (1.0));
        }
-      else if (INTEGERP (item))
+      else if (FIXNUMP (item))
        {
-         EMACS_INT ialpha = XINT (item);
+         EMACS_INT ialpha = XFIXNUM (item);
          if (! (0 <= ialpha && ialpha <= 100))
-           args_out_of_range (make_number (0), make_number (100));
+           args_out_of_range (make_fixnum (0), make_fixnum (100));
          alpha = ialpha / 100.0;
        }
       else
@@ -4980,13 +4980,13 @@ x_get_arg (Display_Info *dpyinfo, Lisp_Object alist, 
Lisp_Object param,
          switch (type)
            {
            case RES_TYPE_NUMBER:
-             return make_number (atoi (SSDATA (tem)));
+             return make_fixnum (atoi (SSDATA (tem)));
 
            case RES_TYPE_BOOLEAN_NUMBER:
              if (!strcmp (SSDATA (tem), "on")
                  || !strcmp (SSDATA (tem), "true"))
-               return make_number (1);
-             return make_number (atoi (SSDATA (tem)));
+               return make_fixnum (1);
+             return make_fixnum (atoi (SSDATA (tem)));
               break;
 
            case RES_TYPE_FLOAT:
@@ -5215,11 +5215,11 @@ On Nextstep, this just calls `ns-parse-geometry'.  */)
       Lisp_Object element;
 
       if (x >= 0 && (geometry & XNegative))
-       element = list3 (Qleft, Qminus, make_number (-x));
+       element = list3 (Qleft, Qminus, make_fixnum (-x));
       else if (x < 0 && ! (geometry & XNegative))
-       element = list3 (Qleft, Qplus, make_number (x));
+       element = list3 (Qleft, Qplus, make_fixnum (x));
       else
-       element = Fcons (Qleft, make_number (x));
+       element = Fcons (Qleft, make_fixnum (x));
       result = Fcons (element, result);
     }
 
@@ -5228,18 +5228,18 @@ On Nextstep, this just calls `ns-parse-geometry'.  */)
       Lisp_Object element;
 
       if (y >= 0 && (geometry & YNegative))
-       element = list3 (Qtop, Qminus, make_number (-y));
+       element = list3 (Qtop, Qminus, make_fixnum (-y));
       else if (y < 0 && ! (geometry & YNegative))
-       element = list3 (Qtop, Qplus, make_number (y));
+       element = list3 (Qtop, Qplus, make_fixnum (y));
       else
-       element = Fcons (Qtop, make_number (y));
+       element = Fcons (Qtop, make_fixnum (y));
       result = Fcons (element, result);
     }
 
   if (geometry & WidthValue)
-    result = Fcons (Fcons (Qwidth, make_number (width)), result);
+    result = Fcons (Fcons (Qwidth, make_fixnum (width)), result);
   if (geometry & HeightValue)
-    result = Fcons (Fcons (Qheight, make_number (height)), result);
+    result = Fcons (Fcons (Qheight, make_fixnum (height)), result);
 
   return result;
 }
@@ -5295,11 +5295,11 @@ x_figure_window_size (struct frame *f, Lisp_Object 
parms, bool toolbar_p, int *x
                    ? tool_bar_button_relief
                    : DEFAULT_TOOL_BAR_BUTTON_RELIEF);
 
-         if (RANGED_INTEGERP (1, Vtool_bar_button_margin, INT_MAX))
-           margin = XFASTINT (Vtool_bar_button_margin);
+         if (RANGED_FIXNUMP (1, Vtool_bar_button_margin, INT_MAX))
+           margin = XFIXNAT (Vtool_bar_button_margin);
          else if (CONSP (Vtool_bar_button_margin)
-                  && RANGED_INTEGERP (1, XCDR (Vtool_bar_button_margin), 
INT_MAX))
-           margin = XFASTINT (XCDR (Vtool_bar_button_margin));
+                  && RANGED_FIXNUMP (1, XCDR (Vtool_bar_button_margin), 
INT_MAX))
+           margin = XFIXNAT (XCDR (Vtool_bar_button_margin));
          else
            margin = 0;
 
@@ -5320,13 +5320,13 @@ x_figure_window_size (struct frame *f, Lisp_Object 
parms, bool toolbar_p, int *x
        {
          if (CONSP (width) && EQ (XCAR (width), Qtext_pixels))
            {
-             CHECK_NUMBER (XCDR (width));
-             if ((XINT (XCDR (width)) < 0 || XINT (XCDR (width)) > INT_MAX))
+             CHECK_FIXNUM (XCDR (width));
+             if ((XFIXNUM (XCDR (width)) < 0 || XFIXNUM (XCDR (width)) > 
INT_MAX))
                xsignal1 (Qargs_out_of_range, XCDR (width));
 
-             SET_FRAME_WIDTH (f, XINT (XCDR (width)));
+             SET_FRAME_WIDTH (f, XFIXNUM (XCDR (width)));
              f->inhibit_horizontal_resize = true;
-             *x_width = XINT (XCDR (width));
+             *x_width = XFIXNUM (XCDR (width));
            }
          else if (FLOATP (width))
            {
@@ -5345,11 +5345,11 @@ x_figure_window_size (struct frame *f, Lisp_Object 
parms, bool toolbar_p, int *x
            }
          else
            {
-             CHECK_NUMBER (width);
-             if ((XINT (width) < 0 || XINT (width) > INT_MAX))
+             CHECK_FIXNUM (width);
+             if ((XFIXNUM (width) < 0 || XFIXNUM (width) > INT_MAX))
                xsignal1 (Qargs_out_of_range, width);
 
-             SET_FRAME_WIDTH (f, XINT (width) * FRAME_COLUMN_WIDTH (f));
+             SET_FRAME_WIDTH (f, XFIXNUM (width) * FRAME_COLUMN_WIDTH (f));
            }
        }
 
@@ -5357,13 +5357,13 @@ x_figure_window_size (struct frame *f, Lisp_Object 
parms, bool toolbar_p, int *x
        {
          if (CONSP (height) && EQ (XCAR (height), Qtext_pixels))
            {
-             CHECK_NUMBER (XCDR (height));
-             if ((XINT (XCDR (height)) < 0 || XINT (XCDR (height)) > INT_MAX))
+             CHECK_FIXNUM (XCDR (height));
+             if ((XFIXNUM (XCDR (height)) < 0 || XFIXNUM (XCDR (height)) > 
INT_MAX))
                xsignal1 (Qargs_out_of_range, XCDR (height));
 
-             SET_FRAME_HEIGHT (f, XINT (XCDR (height)));
+             SET_FRAME_HEIGHT (f, XFIXNUM (XCDR (height)));
              f->inhibit_vertical_resize = true;
-             *x_height = XINT (XCDR (height));
+             *x_height = XFIXNUM (XCDR (height));
            }
          else if (FLOATP (height))
            {
@@ -5382,11 +5382,11 @@ x_figure_window_size (struct frame *f, Lisp_Object 
parms, bool toolbar_p, int *x
            }
          else
            {
-             CHECK_NUMBER (height);
-             if ((XINT (height) < 0) || (XINT (height) > INT_MAX))
+             CHECK_FIXNUM (height);
+             if ((XFIXNUM (height) < 0) || (XFIXNUM (height) > INT_MAX))
                xsignal1 (Qargs_out_of_range, height);
 
-             SET_FRAME_HEIGHT (f, XINT (height) * FRAME_LINE_HEIGHT (f));
+             SET_FRAME_HEIGHT (f, XFIXNUM (height) * FRAME_LINE_HEIGHT (f));
            }
        }
 
@@ -5409,16 +5409,16 @@ x_figure_window_size (struct frame *f, Lisp_Object 
parms, bool toolbar_p, int *x
        }
       else if (CONSP (top) && EQ (XCAR (top), Qminus)
               && CONSP (XCDR (top))
-              && RANGED_INTEGERP (-INT_MAX, XCAR (XCDR (top)), INT_MAX))
+              && RANGED_FIXNUMP (-INT_MAX, XCAR (XCDR (top)), INT_MAX))
        {
-         f->top_pos = - XINT (XCAR (XCDR (top)));
+         f->top_pos = - XFIXNUM (XCAR (XCDR (top)));
          window_prompting |= YNegative;
        }
       else if (CONSP (top) && EQ (XCAR (top), Qplus)
               && CONSP (XCDR (top))
-              && TYPE_RANGED_INTEGERP (int, XCAR (XCDR (top))))
+              && TYPE_RANGED_FIXNUMP (int, XCAR (XCDR (top))))
        {
-         f->top_pos = XINT (XCAR (XCDR (top)));
+         f->top_pos = XFIXNUM (XCAR (XCDR (top)));
        }
       else if (FLOATP (top))
        f->top_pos = frame_float (f, top, FRAME_FLOAT_TOP, &parent_done,
@@ -5428,7 +5428,7 @@ x_figure_window_size (struct frame *f, Lisp_Object parms, 
bool toolbar_p, int *x
       else
        {
          CHECK_TYPE_RANGED_INTEGER (int, top);
-         f->top_pos = XINT (top);
+         f->top_pos = XFIXNUM (top);
          if (f->top_pos < 0)
            window_prompting |= YNegative;
        }
@@ -5440,16 +5440,16 @@ x_figure_window_size (struct frame *f, Lisp_Object 
parms, bool toolbar_p, int *x
        }
       else if (CONSP (left) && EQ (XCAR (left), Qminus)
               && CONSP (XCDR (left))
-              && RANGED_INTEGERP (-INT_MAX, XCAR (XCDR (left)), INT_MAX))
+              && RANGED_FIXNUMP (-INT_MAX, XCAR (XCDR (left)), INT_MAX))
        {
-         f->left_pos = - XINT (XCAR (XCDR (left)));
+         f->left_pos = - XFIXNUM (XCAR (XCDR (left)));
          window_prompting |= XNegative;
        }
       else if (CONSP (left) && EQ (XCAR (left), Qplus)
               && CONSP (XCDR (left))
-              && TYPE_RANGED_INTEGERP (int, XCAR (XCDR (left))))
+              && TYPE_RANGED_FIXNUMP (int, XCAR (XCDR (left))))
        {
-         f->left_pos = XINT (XCAR (XCDR (left)));
+         f->left_pos = XFIXNUM (XCAR (XCDR (left)));
        }
       else if (FLOATP (left))
        f->left_pos = frame_float (f, left, FRAME_FLOAT_LEFT, &parent_done,
@@ -5459,7 +5459,7 @@ x_figure_window_size (struct frame *f, Lisp_Object parms, 
bool toolbar_p, int *x
       else
        {
          CHECK_TYPE_RANGED_INTEGER (int, left);
-         f->left_pos = XINT (left);
+         f->left_pos = XFIXNUM (left);
          if (f->left_pos < 0)
            window_prompting |= XNegative;
        }
@@ -5784,7 +5784,7 @@ syms_of_frame (void)
        Lisp_Object v = (frame_parms[i].sym < 0
                         ? intern_c_string (frame_parms[i].name)
                         : builtin_lisp_symbol (frame_parms[i].sym));
-       Fput (v, Qx_frame_parameter, make_number (i));
+       Fput (v, Qx_frame_parameter, make_fixnum (i));
       }
   }
 
@@ -5817,7 +5817,7 @@ is a reasonable practice.  See also the variable 
`x-resource-name'.  */);
     doc: /* The lower limit of the frame opacity (alpha transparency).
 The value should range from 0 (invisible) to 100 (completely opaque).
 You can also use a floating number between 0.0 and 1.0.  */);
-  Vframe_alpha_lower_limit = make_number (20);
+  Vframe_alpha_lower_limit = make_fixnum (20);
 #endif
 
   DEFVAR_LISP ("default-frame-alist", Vdefault_frame_alist,
diff --git a/src/frame.h b/src/frame.h
index 1f438d3..87d0d5a 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -699,7 +699,7 @@ fset_desired_tool_bar_string (struct frame *f, Lisp_Object 
val)
 INLINE double
 NUMVAL (Lisp_Object x)
 {
-  return NUMBERP (x) ? XFLOATINT (x) : -1;
+  return FIXED_OR_FLOATP (x) ? XFLOATINT (x) : -1;
 }
 
 INLINE double
@@ -1360,16 +1360,16 @@ FRAME_BOTTOM_DIVIDER_WIDTH (struct frame *f)
    canonical char width is to be used.  X must be a Lisp integer or
    float.  Value is a C integer.  */
 #define FRAME_PIXEL_X_FROM_CANON_X(F, X)               \
-  (INTEGERP (X)                                                \
-   ? XINT (X) * FRAME_COLUMN_WIDTH (F)                 \
+  (FIXNUMP (X)                                         \
+   ? XFIXNUM (X) * FRAME_COLUMN_WIDTH (F)                      \
    : (int) (XFLOAT_DATA (X) * FRAME_COLUMN_WIDTH (F)))
 
 /* Convert canonical value Y to pixels.  F is the frame whose
    canonical character height is to be used.  X must be a Lisp integer
    or float.  Value is a C integer.  */
 #define FRAME_PIXEL_Y_FROM_CANON_Y(F, Y)               \
-  (INTEGERP (Y)                                                \
-   ? XINT (Y) * FRAME_LINE_HEIGHT (F)                  \
+  (FIXNUMP (Y)                                         \
+   ? XFIXNUM (Y) * FRAME_LINE_HEIGHT (F)                       \
    : (int) (XFLOAT_DATA (Y) * FRAME_LINE_HEIGHT (F)))
 
 /* Convert pixel-value X to canonical units.  F is the frame whose
@@ -1379,7 +1379,7 @@ FRAME_BOTTOM_DIVIDER_WIDTH (struct frame *f)
 #define FRAME_CANON_X_FROM_PIXEL_X(F, X)                       \
   ((X) % FRAME_COLUMN_WIDTH (F) != 0                           \
    ? make_float ((double) (X) / FRAME_COLUMN_WIDTH (F))                \
-   : make_number ((X) / FRAME_COLUMN_WIDTH (F)))
+   : make_fixnum ((X) / FRAME_COLUMN_WIDTH (F)))
 
 /* Convert pixel-value Y to canonical units.  F is the frame whose
    canonical character height is to be used.  Y is a C integer.
@@ -1388,7 +1388,7 @@ FRAME_BOTTOM_DIVIDER_WIDTH (struct frame *f)
 #define FRAME_CANON_Y_FROM_PIXEL_Y(F, Y)                       \
   ((Y) % FRAME_LINE_HEIGHT (F)                                 \
    ? make_float ((double) (Y) / FRAME_LINE_HEIGHT (F))         \
-   : make_number ((Y) / FRAME_LINE_HEIGHT (F)))
+   : make_fixnum ((Y) / FRAME_LINE_HEIGHT (F)))
 
 
 
diff --git a/src/fringe.c b/src/fringe.c
index 6069184..583bba4 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -488,10 +488,10 @@ lookup_fringe_bitmap (Lisp_Object bitmap)
   EMACS_INT bn;
 
   bitmap = Fget (bitmap, Qfringe);
-  if (!INTEGERP (bitmap))
+  if (!FIXNUMP (bitmap))
     return 0;
 
-  bn = XINT (bitmap);
+  bn = XFIXNUM (bitmap);
   if (bn > NO_FRINGE_BITMAP
       && bn < max_used_fringe_bitmap
       && (bn < MAX_STANDARD_FRINGE_BITMAPS
@@ -519,7 +519,7 @@ get_fringe_bitmap_name (int bn)
     return Qnil;
 
   bitmaps = Vfringe_bitmaps;
-  num = make_number (bn);
+  num = make_fixnum (bn);
 
   while (CONSP (bitmaps))
     {
@@ -743,12 +743,12 @@ get_logical_fringe_bitmap (struct window *w, Lisp_Object 
bitmap, int right_p, in
            return NO_FRINGE_BITMAP;
          if (CONSP (bm1))
            {
-             ln1 = XINT (Flength (bm1));
+             ln1 = XFIXNUM (Flength (bm1));
              if (partial_p)
                {
                  if (ln1 > ix2)
                    {
-                     bm = Fnth (make_number (ix2), bm1);
+                     bm = Fnth (make_fixnum (ix2), bm1);
                      if (!EQ (bm, Qt))
                        goto found;
                    }
@@ -757,7 +757,7 @@ get_logical_fringe_bitmap (struct window *w, Lisp_Object 
bitmap, int right_p, in
                {
                  if (ln1 > ix1)
                    {
-                     bm = Fnth (make_number (ix1), bm1);
+                     bm = Fnth (make_fixnum (ix1), bm1);
                      if (!EQ (bm, Qt))
                        goto found;
                    }
@@ -778,12 +778,12 @@ get_logical_fringe_bitmap (struct window *w, Lisp_Object 
bitmap, int right_p, in
            {
              if (CONSP (bm2))
                {
-                 ln2 = XINT (Flength (bm2));
+                 ln2 = XFIXNUM (Flength (bm2));
                  if (partial_p)
                    {
                      if (ln2 > ix2)
                        {
-                         bm = Fnth (make_number (ix2), bm2);
+                         bm = Fnth (make_fixnum (ix2), bm2);
                          if (!EQ (bm, Qt))
                            goto found;
                        }
@@ -795,14 +795,14 @@ get_logical_fringe_bitmap (struct window *w, Lisp_Object 
bitmap, int right_p, in
 
   if (ln1 > ix1)
     {
-      bm = Fnth (make_number (ix1), bm1);
+      bm = Fnth (make_fixnum (ix1), bm1);
       if (!EQ (bm, Qt))
        goto found;
     }
 
   if (ln2 > ix1)
     {
-      bm = Fnth (make_number (ix1), bm2);
+      bm = Fnth (make_fixnum (ix1), bm2);
       if (!EQ (bm, Qt))
        goto found;
       return NO_FRINGE_BITMAP;
@@ -1509,8 +1509,8 @@ If BITMAP already exists, the existing definition is 
replaced.  */)
     fb.height = h;
   else
     {
-      CHECK_NUMBER (height);
-      fb.height = max (0, min (XINT (height), 255));
+      CHECK_FIXNUM (height);
+      fb.height = max (0, min (XFIXNUM (height), 255));
       if (fb.height > h)
        {
          fill1 = (fb.height - h) / 2;
@@ -1522,8 +1522,8 @@ If BITMAP already exists, the existing definition is 
replaced.  */)
     fb.width = 8;
   else
     {
-      CHECK_NUMBER (width);
-      fb.width = max (0, min (XINT (width), 255));
+      CHECK_FIXNUM (width);
+      fb.width = max (0, min (XFIXNUM (width), 255));
     }
 
   fb.period = 0;
@@ -1586,7 +1586,7 @@ If BITMAP already exists, the existing definition is 
replaced.  */)
        }
 
       Vfringe_bitmaps = Fcons (bitmap, Vfringe_bitmaps);
-      Fput (bitmap, Qfringe, make_number (n));
+      Fput (bitmap, Qfringe, make_fixnum (n));
     }
 
   fb.dynamic = true;
@@ -1604,8 +1604,8 @@ If BITMAP already exists, the existing definition is 
replaced.  */)
        b[j++] = 0;
       for (i = 0; i < h && j < fb.height; i++)
        {
-         Lisp_Object elt = Faref (bits, make_number (i));
-         b[j++] = NUMBERP (elt) ? XINT (elt) : 0;
+         Lisp_Object elt = Faref (bits, make_fixnum (i));
+         b[j++] = FIXED_OR_FLOATP (elt) ? XFIXNUM (elt) : 0;
        }
       for (i = 0; i < fill2 && j < fb.height; i++)
        b[j++] = 0;
@@ -1661,10 +1661,10 @@ Return nil if POS is not visible in WINDOW.  */)
 
   if (!NILP (pos))
     {
-      CHECK_NUMBER_COERCE_MARKER (pos);
-      if (! (BEGV <= XINT (pos) && XINT (pos) <= ZV))
+      CHECK_FIXNUM_COERCE_MARKER (pos);
+      if (! (BEGV <= XFIXNUM (pos) && XFIXNUM (pos) <= ZV))
        args_out_of_range (window, pos);
-      textpos = XINT (pos);
+      textpos = XFIXNUM (pos);
     }
   else if (w == XWINDOW (selected_window))
     textpos = PT;
diff --git a/src/ftcrfont.c b/src/ftcrfont.c
index 425250e..dc1a389 100644
--- a/src/ftcrfont.c
+++ b/src/ftcrfont.c
@@ -137,7 +137,7 @@ ftcrfont_open (struct frame *f, Lisp_Object entity, int 
pixel_size)
   FT_UInt size;
 
   block_input ();
-  size = XINT (AREF (entity, FONT_SIZE_INDEX));
+  size = XFIXNUM (AREF (entity, FONT_SIZE_INDEX));
   if (size == 0)
     size = pixel_size;
   font_object = font_build_object (VECSIZE (struct ftcrfont_info),
diff --git a/src/ftfont.c b/src/ftfont.c
index d50fa39..e83eff3 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -196,7 +196,7 @@ ftfont_pattern_entity (FcPattern *p, Lisp_Object extra)
     return Qnil;
 
   file = (char *) str;
-  key = Fcons (build_unibyte_string (file), make_number (idx));
+  key = Fcons (build_unibyte_string (file), make_fixnum (idx));
   cache = ftfont_lookup_cache (key, FTFONT_CACHE_FOR_ENTITY);
   entity = XCAR (cache);
   if (! NILP (entity))
@@ -232,35 +232,35 @@ ftfont_pattern_entity (FcPattern *p, Lisp_Object extra)
     {
       if (numeric >= FC_WEIGHT_REGULAR && numeric < FC_WEIGHT_MEDIUM)
        numeric = FC_WEIGHT_MEDIUM;
-      FONT_SET_STYLE (entity, FONT_WEIGHT_INDEX, make_number (numeric));
+      FONT_SET_STYLE (entity, FONT_WEIGHT_INDEX, make_fixnum (numeric));
     }
   if (FcPatternGetInteger (p, FC_SLANT, 0, &numeric) == FcResultMatch)
     {
       numeric += 100;
-      FONT_SET_STYLE (entity, FONT_SLANT_INDEX, make_number (numeric));
+      FONT_SET_STYLE (entity, FONT_SLANT_INDEX, make_fixnum (numeric));
     }
   if (FcPatternGetInteger (p, FC_WIDTH, 0, &numeric) == FcResultMatch)
     {
-      FONT_SET_STYLE (entity, FONT_WIDTH_INDEX, make_number (numeric));
+      FONT_SET_STYLE (entity, FONT_WIDTH_INDEX, make_fixnum (numeric));
     }
   if (FcPatternGetDouble (p, FC_PIXEL_SIZE, 0, &dbl) == FcResultMatch)
     {
-      ASET (entity, FONT_SIZE_INDEX, make_number (dbl));
+      ASET (entity, FONT_SIZE_INDEX, make_fixnum (dbl));
     }
   else
-    ASET (entity, FONT_SIZE_INDEX, make_number (0));
+    ASET (entity, FONT_SIZE_INDEX, make_fixnum (0));
   if (FcPatternGetInteger (p, FC_SPACING, 0, &numeric) == FcResultMatch)
-    ASET (entity, FONT_SPACING_INDEX, make_number (numeric));
+    ASET (entity, FONT_SPACING_INDEX, make_fixnum (numeric));
   if (FcPatternGetDouble (p, FC_DPI, 0, &dbl) == FcResultMatch)
     {
       int dpi = dbl;
-      ASET (entity, FONT_DPI_INDEX, make_number (dpi));
+      ASET (entity, FONT_DPI_INDEX, make_fixnum (dpi));
     }
   if (FcPatternGetBool (p, FC_SCALABLE, 0, &b) == FcResultMatch
       && b == FcTrue)
     {
-      ASET (entity, FONT_SIZE_INDEX, make_number (0));
-      ASET (entity, FONT_AVGWIDTH_INDEX, make_number (0));
+      ASET (entity, FONT_SIZE_INDEX, make_fixnum (0));
+      ASET (entity, FONT_AVGWIDTH_INDEX, make_fixnum (0));
     }
   else
     {
@@ -276,7 +276,7 @@ ftfont_pattern_entity (FcPattern *p, Lisp_Object extra)
 
          if (FT_Get_BDF_Property (ft_face, "AVERAGE_WIDTH", &rec) == 0
              && rec.type == BDF_PROPERTY_TYPE_INTEGER)
-           ASET (entity, FONT_AVGWIDTH_INDEX, make_number (rec.u.integer));
+           ASET (entity, FONT_AVGWIDTH_INDEX, make_fixnum (rec.u.integer));
          FT_Done_Face (ft_face);
        }
     }
@@ -390,7 +390,7 @@ ftfont_lookup_cache (Lisp_Object key, enum ftfont_cache_for 
cache_for)
       ? ! cache_data->ft_face : ! cache_data->fc_charset)
     {
       char *filename = SSDATA (XCAR (key));
-      int idx = XINT (XCDR (key));
+      int idx = XFIXNUM (XCDR (key));
 
       if (cache_for == FTFONT_CACHE_FOR_FACE)
        {
@@ -600,9 +600,9 @@ ftfont_get_open_type_spec (Lisp_Object otf_spec)
        continue;
       len = Flength (val);
       spec->features[i] =
-       (min (PTRDIFF_MAX, SIZE_MAX) / sizeof (int) < XINT (len)
+       (min (PTRDIFF_MAX, SIZE_MAX) / sizeof (int) < XFIXNUM (len)
         ? 0
-        : malloc (XINT (len) * sizeof *spec->features[i]));
+        : malloc (XFIXNUM (len) * sizeof *spec->features[i]));
       if (! spec->features[i])
        {
          if (i > 0 && spec->features[0])
@@ -646,10 +646,10 @@ ftfont_spec_pattern (Lisp_Object spec, char *otlayout, 
struct OpenTypeSpec **ots
     /* Fontconfig doesn't support reverse-italic/oblique.  */
     return NULL;
 
-  if (INTEGERP (AREF (spec, FONT_DPI_INDEX)))
-    dpi = XINT (AREF (spec, FONT_DPI_INDEX));
-  if (INTEGERP (AREF (spec, FONT_AVGWIDTH_INDEX))
-      && XINT (AREF (spec, FONT_AVGWIDTH_INDEX)) == 0)
+  if (FIXNUMP (AREF (spec, FONT_DPI_INDEX)))
+    dpi = XFIXNUM (AREF (spec, FONT_DPI_INDEX));
+  if (FIXNUMP (AREF (spec, FONT_AVGWIDTH_INDEX))
+      && XFIXNUM (AREF (spec, FONT_AVGWIDTH_INDEX)) == 0)
     scalable = 1;
 
   registry = AREF (spec, FONT_REGISTRY_INDEX);
@@ -686,8 +686,8 @@ ftfont_spec_pattern (Lisp_Object spec, char *otlayout, 
struct OpenTypeSpec **ots
       key = XCAR (XCAR (extra)), val = XCDR (XCAR (extra));
       if (EQ (key, QCdpi))
        {
-         if (INTEGERP (val))
-           dpi = XINT (val);
+         if (FIXNUMP (val))
+           dpi = XFIXNUM (val);
        }
       else if (EQ (key, QClang))
        {
@@ -735,7 +735,7 @@ ftfont_spec_pattern (Lisp_Object spec, char *otlayout, 
struct OpenTypeSpec **ots
            goto err;
          for (chars = XCDR (chars); CONSP (chars); chars = XCDR (chars))
            if (CHARACTERP (XCAR (chars))
-               && ! FcCharSetAddChar (charset, XFASTINT (XCAR (chars))))
+               && ! FcCharSetAddChar (charset, XFIXNAT (XCAR (chars))))
              goto err;
        }
     }
@@ -832,8 +832,8 @@ ftfont_list (struct frame *f, Lisp_Object spec)
        }
       val = Qnil;
     }
-  if (INTEGERP (AREF (spec, FONT_SPACING_INDEX)))
-    spacing = XINT (AREF (spec, FONT_SPACING_INDEX));
+  if (FIXNUMP (AREF (spec, FONT_SPACING_INDEX)))
+    spacing = XFIXNUM (AREF (spec, FONT_SPACING_INDEX));
   family = AREF (spec, FONT_FAMILY_INDEX);
   if (! NILP (family))
     {
@@ -955,8 +955,8 @@ ftfont_list (struct frame *f, Lisp_Object spec)
              != FcResultMatch)
            continue;
          for (j = 0; j < ASIZE (chars); j++)
-           if (TYPE_RANGED_INTEGERP (FcChar32, AREF (chars, j))
-               && FcCharSetHasChar (charset, XFASTINT (AREF (chars, j))))
+           if (TYPE_RANGED_FIXNUMP (FcChar32, AREF (chars, j))
+               && FcCharSetHasChar (charset, XFIXNAT (AREF (chars, j))))
              break;
          if (j == ASIZE (chars))
            continue;
@@ -1016,12 +1016,12 @@ ftfont_match (struct frame *f, Lisp_Object spec)
   if (! pattern)
     return Qnil;
 
-  if (INTEGERP (AREF (spec, FONT_SIZE_INDEX)))
+  if (FIXNUMP (AREF (spec, FONT_SIZE_INDEX)))
     {
       FcValue value;
 
       value.type = FcTypeDouble;
-      value.u.d = XINT (AREF (spec, FONT_SIZE_INDEX));
+      value.u.d = XFIXNUM (AREF (spec, FONT_SIZE_INDEX));
       FcPatternAdd (pattern, FC_PIXEL_SIZE, value, FcFalse);
     }
   if (FcConfigSubstitute (NULL, pattern, FcMatchPattern) == FcTrue)
@@ -1130,7 +1130,7 @@ ftfont_open2 (struct frame *f,
          return Qnil;
        }
     }
-  size = XINT (AREF (entity, FONT_SIZE_INDEX));
+  size = XFIXNUM (AREF (entity, FONT_SIZE_INDEX));
   if (size == 0)
     size = pixel_size;
   if (FT_Set_Pixel_Sizes (ft_face, size, size) != 0)
@@ -1148,7 +1148,7 @@ ftfont_open2 (struct frame *f,
   font = XFONT_OBJECT (font_object);
   ftfont_info = (struct ftfont_info *) font;
   ftfont_info->ft_size = ft_face->size;
-  ftfont_info->index = XINT (idx);
+  ftfont_info->index = XFIXNUM (idx);
 #ifdef HAVE_LIBOTF
   ftfont_info->maybe_otf = (ft_face->face_flags & FT_FACE_FLAG_SFNT) != 0;
   ftfont_info->otf = NULL;
@@ -1160,8 +1160,8 @@ ftfont_open2 (struct frame *f,
   font->encoding_charset = font->repertory_charset = -1;
 
   upEM = ft_face->units_per_EM;
-  scalable = (INTEGERP (AREF (entity, FONT_AVGWIDTH_INDEX))
-             && XINT (AREF (entity, FONT_AVGWIDTH_INDEX)) == 0);
+  scalable = (FIXNUMP (AREF (entity, FONT_AVGWIDTH_INDEX))
+             && XFIXNUM (AREF (entity, FONT_AVGWIDTH_INDEX)) == 0);
   if (scalable)
     {
       font->ascent = ft_face->ascender * size / upEM + 0.5;
@@ -1174,8 +1174,8 @@ ftfont_open2 (struct frame *f,
       font->descent = - ft_face->size->metrics.descender >> 6;
       font->height = ft_face->size->metrics.height >> 6;
     }
-  if (INTEGERP (AREF (entity, FONT_SPACING_INDEX)))
-    spacing = XINT (AREF (entity, FONT_SPACING_INDEX));
+  if (FIXNUMP (AREF (entity, FONT_SPACING_INDEX)))
+    spacing = XFIXNUM (AREF (entity, FONT_SPACING_INDEX));
   else
     spacing = FC_PROPORTIONAL;
   if (spacing != FC_PROPORTIONAL
@@ -1233,7 +1233,7 @@ ftfont_open (struct frame *f, Lisp_Object entity, int 
pixel_size)
 {
   Lisp_Object font_object;
   FT_UInt size;
-  size = XINT (AREF (entity, FONT_SIZE_INDEX));
+  size = XFIXNUM (AREF (entity, FONT_SIZE_INDEX));
   if (size == 0)
     size = pixel_size;
   font_object = font_build_object (VECSIZE (struct ftfont_info),
@@ -1250,7 +1250,7 @@ ftfont_close (struct font *font)
   struct ftfont_info *ftfont_info = (struct ftfont_info *) font;
   Lisp_Object val, cache;
 
-  val = Fcons (font->props[FONT_FILE_INDEX], make_number (ftfont_info->index));
+  val = Fcons (font->props[FONT_FILE_INDEX], make_fixnum (ftfont_info->index));
   cache = ftfont_lookup_cache (val, FTFONT_CACHE_FOR_FACE);
   eassert (CONSP (cache));
   val = XCDR (cache);
@@ -2534,7 +2534,7 @@ ftfont_shape_by_flt (Lisp_Object lgstring, struct font 
*font,
       flt = mflt_find (LGLYPH_CHAR (LGSTRING_GLYPH (lgstring, 0)),
                       &flt_font_ft.flt_font);
       if (! flt)
-       return make_number (0);
+       return make_fixnum (0);
     }
 
   MFLTGlyphFT *glyphs = (MFLTGlyphFT *) gstring.glyphs;
@@ -2603,13 +2603,13 @@ ftfont_shape_by_flt (Lisp_Object lgstring, struct font 
*font,
        {
          Lisp_Object vec = make_uninit_vector (3);
 
-         ASET (vec, 0, make_number (g->g.xoff >> 6));
-         ASET (vec, 1, make_number (g->g.yoff >> 6));
-         ASET (vec, 2, make_number (g->g.xadv >> 6));
+         ASET (vec, 0, make_fixnum (g->g.xoff >> 6));
+         ASET (vec, 1, make_fixnum (g->g.yoff >> 6));
+         ASET (vec, 2, make_fixnum (g->g.xadv >> 6));
          LGLYPH_SET_ADJUSTMENT (lglyph, vec);
        }
     }
-  return make_number (i);
+  return make_fixnum (i);
 }
 
 Lisp_Object
diff --git a/src/gfilenotify.c b/src/gfilenotify.c
index 650df0f..798f308 100644
--- a/src/gfilenotify.c
+++ b/src/gfilenotify.c
@@ -77,7 +77,6 @@ dir_monitor_callback (GFileMonitor *monitor,
 
   /* Determine callback function.  */
   monitor_object = make_pointer_integer (monitor);
-  eassert (INTEGERP (monitor_object));
   watch_object = assq_no_quit (monitor_object, watch_list);
 
   if (CONSP (watch_object))
@@ -203,10 +202,10 @@ will be reported only in case of the `moved' event.  */)
   if (! monitor)
     xsignal2 (Qfile_notify_error, build_string ("Cannot watch file"), file);
 
-  Lisp_Object watch_descriptor = make_pointer_integer (monitor);
+  Lisp_Object watch_descriptor = make_pointer_integer_unsafe (monitor);
 
-  /* Check the dicey assumption that make_pointer_integer is safe.  */
-  if (! INTEGERP (watch_descriptor))
+  if (! (FIXNUMP (watch_descriptor)
+        && XFIXNUMPTR (watch_descriptor) == monitor))
     {
       g_object_unref (monitor);
       xsignal2 (Qfile_notify_error, build_string ("Unsupported file watcher"),
@@ -239,8 +238,8 @@ WATCH-DESCRIPTOR should be an object returned by 
`gfile-add-watch'.  */)
     xsignal2 (Qfile_notify_error, build_string ("Not a watch descriptor"),
              watch_descriptor);
 
-  eassert (INTEGERP (watch_descriptor));
-  GFileMonitor *monitor = XINTPTR (watch_descriptor);
+  eassert (FIXNUMP (watch_descriptor));
+  GFileMonitor *monitor = XFIXNUMPTR (watch_descriptor);
   if (!g_file_monitor_is_cancelled (monitor) &&
       !g_file_monitor_cancel (monitor))
       xsignal2 (Qfile_notify_error, build_string ("Could not rm watch"),
@@ -271,7 +270,7 @@ invalid.  */)
     return Qnil;
   else
     {
-      GFileMonitor *monitor = XINTPTR (watch_descriptor);
+      GFileMonitor *monitor = XFIXNUMPTR (watch_descriptor);
       return g_file_monitor_is_cancelled (monitor) ? Qnil : Qt;
     }
 }
@@ -290,7 +289,7 @@ If WATCH-DESCRIPTOR is not valid, nil is returned.  */)
     return Qnil;
   else
     {
-      GFileMonitor *monitor = XINTPTR (watch_descriptor);
+      GFileMonitor *monitor = XFIXNUMPTR (watch_descriptor);
       return intern (G_OBJECT_TYPE_NAME (monitor));
     }
 }
diff --git a/src/gnutls.c b/src/gnutls.c
index 4e98f16..2d455ea 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -816,7 +816,7 @@ gnutls_make_error (int err)
     }
 
   check_memory_full (err);
-  return make_number (err);
+  return make_fixnum (err);
 }
 
 static void
@@ -893,7 +893,7 @@ See also `gnutls-boot'.  */)
 {
   CHECK_PROCESS (proc);
 
-  return make_number (GNUTLS_INITSTAGE (proc));
+  return make_fixnum (GNUTLS_INITSTAGE (proc));
 }
 
 DEFUN ("gnutls-errorp", Fgnutls_errorp, Sgnutls_errorp, 1, 1, 0,
@@ -923,7 +923,7 @@ Usage: (gnutls-error-fatalp ERROR)  */)
   if (SYMBOLP (err))
     {
       code = Fget (err, Qgnutls_code);
-      if (NUMBERP (code))
+      if (FIXED_OR_FLOATP (code))
        {
          err = code;
        }
@@ -933,10 +933,10 @@ Usage: (gnutls-error-fatalp ERROR)  */)
        }
     }
 
-  if (! TYPE_RANGED_INTEGERP (int, err))
+  if (! TYPE_RANGED_FIXNUMP (int, err))
     error ("Not an error symbol or code");
 
-  if (0 == gnutls_error_is_fatal (XINT (err)))
+  if (0 == gnutls_error_is_fatal (XFIXNUM (err)))
     return Qnil;
 
   return Qt;
@@ -955,7 +955,7 @@ usage: (gnutls-error-string ERROR)  */)
   if (SYMBOLP (err))
     {
       code = Fget (err, Qgnutls_code);
-      if (NUMBERP (code))
+      if (FIXED_OR_FLOATP (code))
        {
          err = code;
        }
@@ -965,10 +965,10 @@ usage: (gnutls-error-string ERROR)  */)
        }
     }
 
-  if (! TYPE_RANGED_INTEGERP (int, err))
+  if (! TYPE_RANGED_FIXNUMP (int, err))
     return build_string ("Not an error symbol or code");
 
-  return build_string (emacs_gnutls_strerror (XINT (err)));
+  return build_string (emacs_gnutls_strerror (XFIXNUM (err)));
 }
 
 DEFUN ("gnutls-deinit", Fgnutls_deinit, Sgnutls_deinit, 1, 1, 0,
@@ -1012,7 +1012,7 @@ gnutls_certificate_details (gnutls_x509_crt_t cert)
     check_memory_full (version);
     if (version >= GNUTLS_E_SUCCESS)
       res = nconc2 (res, list2 (intern (":version"),
-                               make_number (version)));
+                               make_fixnum (version)));
   }
 
   /* Serial. */
@@ -1296,7 +1296,7 @@ returned as the :certificate entry.  */)
     check_memory_full (bits);
     if (bits > 0)
       result = nconc2 (result, list2 (intern (":diffie-hellman-prime-bits"),
-                                     make_number (bits)));
+                                     make_fixnum (bits)));
   }
 
   /* Key exchange. */
@@ -1650,14 +1650,14 @@ one trustfile (usually a CA bundle).  */)
 
   state = XPROCESS (proc)->gnutls_state;
 
-  if (TYPE_RANGED_INTEGERP (int, loglevel))
+  if (TYPE_RANGED_FIXNUMP (int, loglevel))
     {
       gnutls_global_set_log_function (gnutls_log_function);
 # ifdef HAVE_GNUTLS3
       gnutls_global_set_audit_log_function (gnutls_audit_log_function);
 # endif
-      gnutls_global_set_log_level (XINT (loglevel));
-      max_log_level = XINT (loglevel);
+      gnutls_global_set_log_level (XFIXNUM (loglevel));
+      max_log_level = XFIXNUM (loglevel);
       XPROCESS (proc)->gnutls_log_level = max_log_level;
     }
 
@@ -1690,9 +1690,9 @@ one trustfile (usually a CA bundle).  */)
       XPROCESS (proc)->gnutls_x509_cred = x509_cred;
 
       verify_flags = Fplist_get (proplist, QCverify_flags);
-      if (TYPE_RANGED_INTEGERP (unsigned int, verify_flags))
+      if (TYPE_RANGED_FIXNUMP (unsigned int, verify_flags))
        {
-         gnutls_verify_flags = XFASTINT (verify_flags);
+         gnutls_verify_flags = XFIXNAT (verify_flags);
          GNUTLS_LOG (2, max_log_level, "setting verification flags");
        }
       else if (NILP (verify_flags))
@@ -1851,8 +1851,8 @@ one trustfile (usually a CA bundle).  */)
 
   GNUTLS_INITSTAGE (proc) = GNUTLS_STAGE_PRIORITY;
 
-  if (INTEGERP (prime_bits))
-    gnutls_dh_set_prime_bits (state, XUINT (prime_bits));
+  if (FIXNUMP (prime_bits))
+    gnutls_dh_set_prime_bits (state, XUFIXNUM (prime_bits));
 
   ret = EQ (type, Qgnutls_x509pki)
     ? gnutls_credentials_set (state, GNUTLS_CRD_CERTIFICATE, x509_cred)
@@ -1937,19 +1937,19 @@ The alist key is the cipher name. */)
 
       Lisp_Object cp
        = listn (CONSTYPE_HEAP, 15, cipher_symbol,
-                QCcipher_id, make_number (gca),
+                QCcipher_id, make_fixnum (gca),
                 QCtype, Qgnutls_type_cipher,
                 QCcipher_aead_capable, cipher_tag_size == 0 ? Qnil : Qt,
-                QCcipher_tagsize, make_number (cipher_tag_size),
+                QCcipher_tagsize, make_fixnum (cipher_tag_size),
 
                 QCcipher_blocksize,
-                make_number (gnutls_cipher_get_block_size (gca)),
+                make_fixnum (gnutls_cipher_get_block_size (gca)),
 
                 QCcipher_keysize,
-                make_number (gnutls_cipher_get_key_size (gca)),
+                make_fixnum (gnutls_cipher_get_key_size (gca)),
 
                 QCcipher_ivsize,
-                make_number (gnutls_cipher_get_iv_size (gca)));
+                make_fixnum (gnutls_cipher_get_iv_size (gca)));
 
       ciphers = Fcons (cp, ciphers);
     }
@@ -2079,16 +2079,16 @@ gnutls_symmetric (bool encrypting, Lisp_Object cipher,
                  cipher);
       info = XCDR (info);
     }
-  else if (TYPE_RANGED_INTEGERP (gnutls_cipher_algorithm_t, cipher))
-    gca = XINT (cipher);
+  else if (TYPE_RANGED_FIXNUMP (gnutls_cipher_algorithm_t, cipher))
+    gca = XFIXNUM (cipher);
   else
     info = cipher;
 
   if (!NILP (info) && CONSP (info))
     {
       Lisp_Object v = Fplist_get (info, QCcipher_id);
-      if (TYPE_RANGED_INTEGERP (gnutls_cipher_algorithm_t, v))
-        gca = XINT (v);
+      if (TYPE_RANGED_FIXNUMP (gnutls_cipher_algorithm_t, v))
+        gca = XFIXNUM (v);
     }
 
   ptrdiff_t key_size = gnutls_cipher_get_key_size (gca);
@@ -2268,17 +2268,17 @@ name. */)
       nonce_size = gnutls_mac_get_nonce_size (gma);
 #endif
       Lisp_Object mp = listn (CONSTYPE_HEAP, 11, gma_symbol,
-                             QCmac_algorithm_id, make_number (gma),
+                             QCmac_algorithm_id, make_fixnum (gma),
                              QCtype, Qgnutls_type_mac_algorithm,
 
                               QCmac_algorithm_length,
-                              make_number (gnutls_hmac_get_len (gma)),
+                              make_fixnum (gnutls_hmac_get_len (gma)),
 
                               QCmac_algorithm_keysize,
-                              make_number (gnutls_mac_get_key_size (gma)),
+                              make_fixnum (gnutls_mac_get_key_size (gma)),
 
                               QCmac_algorithm_noncesize,
-                             make_number (nonce_size));
+                             make_fixnum (nonce_size));
       mac_algorithms = Fcons (mp, mac_algorithms);
     }
 
@@ -2303,11 +2303,11 @@ method name. */)
       Lisp_Object gda_symbol = intern (gnutls_digest_get_name (gda));
 
       Lisp_Object mp = listn (CONSTYPE_HEAP, 7, gda_symbol,
-                             QCdigest_algorithm_id, make_number (gda),
+                             QCdigest_algorithm_id, make_fixnum (gda),
                              QCtype, Qgnutls_type_digest_algorithm,
 
                               QCdigest_algorithm_length,
-                              make_number (gnutls_hash_get_len (gda)));
+                              make_fixnum (gnutls_hash_get_len (gda)));
 
       digest_algorithms = Fcons (mp, digest_algorithms);
     }
@@ -2358,16 +2358,16 @@ itself. */)
                  hash_method);
       info = XCDR (info);
     }
-  else if (TYPE_RANGED_INTEGERP (gnutls_mac_algorithm_t, hash_method))
-    gma = XINT (hash_method);
+  else if (TYPE_RANGED_FIXNUMP (gnutls_mac_algorithm_t, hash_method))
+    gma = XFIXNUM (hash_method);
   else
     info = hash_method;
 
   if (!NILP (info) && CONSP (info))
     {
       Lisp_Object v = Fplist_get (info, QCmac_algorithm_id);
-      if (TYPE_RANGED_INTEGERP (gnutls_mac_algorithm_t, v))
-        gma = XINT (v);
+      if (TYPE_RANGED_FIXNUMP (gnutls_mac_algorithm_t, v))
+        gma = XFIXNUM (v);
     }
 
   ptrdiff_t digest_length = gnutls_hmac_get_len (gma);
@@ -2448,16 +2448,16 @@ the number itself. */)
                  digest_method);
       info = XCDR (info);
     }
-  else if (TYPE_RANGED_INTEGERP (gnutls_digest_algorithm_t, digest_method))
-    gda = XINT (digest_method);
+  else if (TYPE_RANGED_FIXNUMP (gnutls_digest_algorithm_t, digest_method))
+    gda = XFIXNUM (digest_method);
   else
     info = digest_method;
 
   if (!NILP (info) && CONSP (info))
     {
       Lisp_Object v = Fplist_get (info, QCdigest_algorithm_id);
-      if (TYPE_RANGED_INTEGERP (gnutls_digest_algorithm_t, v))
-        gda = XINT (v);
+      if (TYPE_RANGED_FIXNUMP (gnutls_digest_algorithm_t, v))
+        gda = XFIXNUM (v);
     }
 
   ptrdiff_t digest_length = gnutls_hash_get_len (gda);
@@ -2571,11 +2571,11 @@ syms_of_gnutls (void)
   DEFSYM (Qlibgnutls_version, "libgnutls-version");
   Fset (Qlibgnutls_version,
 #ifdef HAVE_GNUTLS
-       make_number (GNUTLS_VERSION_MAJOR * 10000
+       make_fixnum (GNUTLS_VERSION_MAJOR * 10000
                     + GNUTLS_VERSION_MINOR * 100
                     + GNUTLS_VERSION_PATCH)
 #else
-       make_number (-1)
+       make_fixnum (-1)
 #endif
         );
 #ifdef HAVE_GNUTLS
@@ -2619,19 +2619,19 @@ syms_of_gnutls (void)
 
   DEFSYM (Qgnutls_e_interrupted, "gnutls-e-interrupted");
   Fput (Qgnutls_e_interrupted, Qgnutls_code,
-       make_number (GNUTLS_E_INTERRUPTED));
+       make_fixnum (GNUTLS_E_INTERRUPTED));
 
   DEFSYM (Qgnutls_e_again, "gnutls-e-again");
   Fput (Qgnutls_e_again, Qgnutls_code,
-       make_number (GNUTLS_E_AGAIN));
+       make_fixnum (GNUTLS_E_AGAIN));
 
   DEFSYM (Qgnutls_e_invalid_session, "gnutls-e-invalid-session");
   Fput (Qgnutls_e_invalid_session, Qgnutls_code,
-       make_number (GNUTLS_E_INVALID_SESSION));
+       make_fixnum (GNUTLS_E_INVALID_SESSION));
 
   DEFSYM (Qgnutls_e_not_ready_for_handshake, 
"gnutls-e-not-ready-for-handshake");
   Fput (Qgnutls_e_not_ready_for_handshake, Qgnutls_code,
-       make_number (GNUTLS_E_APPLICATION_ERROR_MIN));
+       make_fixnum (GNUTLS_E_APPLICATION_ERROR_MIN));
 
   defsubr (&Sgnutls_get_initstage);
   defsubr (&Sgnutls_asynchronous_parameters);
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 69325ff..4250355 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -963,7 +963,7 @@ xg_frame_set_char_size (struct frame *f, int width, int 
height)
     {
       frame_size_history_add
        (f, Qxg_frame_set_char_size_1, width, height,
-        list2 (make_number (gheight), make_number (totalheight)));
+        list2 (make_fixnum (gheight), make_fixnum (totalheight)));
 
       gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
                         gwidth, totalheight);
@@ -972,7 +972,7 @@ xg_frame_set_char_size (struct frame *f, int width, int 
height)
     {
       frame_size_history_add
        (f, Qxg_frame_set_char_size_2, width, height,
-        list2 (make_number (gwidth), make_number (totalwidth)));
+        list2 (make_fixnum (gwidth), make_fixnum (totalwidth)));
 
       gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
                         totalwidth, gheight);
@@ -981,7 +981,7 @@ xg_frame_set_char_size (struct frame *f, int width, int 
height)
     {
       frame_size_history_add
        (f, Qxg_frame_set_char_size_3, width, height,
-        list2 (make_number (totalwidth), make_number (totalheight)));
+        list2 (make_fixnum (totalwidth), make_fixnum (totalheight)));
 
       gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
                         totalwidth, totalheight);
@@ -4279,7 +4279,7 @@ draw_page (GtkPrintOperation *operation, GtkPrintContext 
*context,
           gint page_nr, gpointer user_data)
 {
   Lisp_Object frames = *((Lisp_Object *) user_data);
-  struct frame *f = XFRAME (Fnth (make_number (page_nr), frames));
+  struct frame *f = XFRAME (Fnth (make_fixnum (page_nr), frames));
   cairo_t *cr = gtk_print_context_get_cairo_context (context);
 
   x_cr_draw_frame (cr, f);
@@ -4296,7 +4296,7 @@ xg_print_frames_dialog (Lisp_Object frames)
     gtk_print_operation_set_print_settings (print, print_settings);
   if (page_setup != NULL)
     gtk_print_operation_set_default_page_setup (print, page_setup);
-  gtk_print_operation_set_n_pages (print, XINT (Flength (frames)));
+  gtk_print_operation_set_n_pages (print, XFIXNUM (Flength (frames)));
   g_signal_connect (print, "draw-page", G_CALLBACK (draw_page), &frames);
   res = gtk_print_operation_run (print, 
GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
                                  NULL, NULL);
@@ -4889,18 +4889,18 @@ update_frame_tool_bar (struct frame *f)
 
   block_input ();
 
-  if (RANGED_INTEGERP (1, Vtool_bar_button_margin, INT_MAX))
+  if (RANGED_FIXNUMP (1, Vtool_bar_button_margin, INT_MAX))
     {
-      hmargin = XFASTINT (Vtool_bar_button_margin);
-      vmargin = XFASTINT (Vtool_bar_button_margin);
+      hmargin = XFIXNAT (Vtool_bar_button_margin);
+      vmargin = XFIXNAT (Vtool_bar_button_margin);
     }
   else if (CONSP (Vtool_bar_button_margin))
     {
-      if (RANGED_INTEGERP (1, XCAR (Vtool_bar_button_margin), INT_MAX))
-        hmargin = XFASTINT (XCAR (Vtool_bar_button_margin));
+      if (RANGED_FIXNUMP (1, XCAR (Vtool_bar_button_margin), INT_MAX))
+        hmargin = XFIXNAT (XCAR (Vtool_bar_button_margin));
 
-      if (RANGED_INTEGERP (1, XCDR (Vtool_bar_button_margin), INT_MAX))
-        vmargin = XFASTINT (XCDR (Vtool_bar_button_margin));
+      if (RANGED_FIXNUMP (1, XCDR (Vtool_bar_button_margin), INT_MAX))
+        vmargin = XFIXNAT (XCDR (Vtool_bar_button_margin));
     }
 
   /* The natural size (i.e. when GTK uses 0 as margin) looks best,
diff --git a/src/image.c b/src/image.c
index a83f064..499c1b6 100644
--- a/src/image.c
+++ b/src/image.c
@@ -322,7 +322,7 @@ x_create_bitmap_from_file (struct frame *f, Lisp_Object 
file)
 
   /* Search bitmap-file-path for the file, if appropriate.  */
   if (openp (Vx_bitmap_file_path, file, Qnil, &found,
-            make_number (R_OK), false)
+            make_fixnum (R_OK), false)
       < 0)
     return -1;
 
@@ -761,23 +761,23 @@ parse_image_spec (Lisp_Object spec, struct image_keyword 
*keywords,
          break;
 
        case IMAGE_POSITIVE_INTEGER_VALUE:
-         if (! RANGED_INTEGERP (1, value, INT_MAX))
+         if (! RANGED_FIXNUMP (1, value, INT_MAX))
            return 0;
          break;
 
        case IMAGE_NON_NEGATIVE_INTEGER_VALUE_OR_PAIR:
-         if (RANGED_INTEGERP (0, value, INT_MAX))
+         if (RANGED_FIXNUMP (0, value, INT_MAX))
            break;
          if (CONSP (value)
-             && RANGED_INTEGERP (0, XCAR (value), INT_MAX)
-             && RANGED_INTEGERP (0, XCDR (value), INT_MAX))
+             && RANGED_FIXNUMP (0, XCAR (value), INT_MAX)
+             && RANGED_FIXNUMP (0, XCDR (value), INT_MAX))
            break;
          return 0;
 
        case IMAGE_ASCENT_VALUE:
          if (SYMBOLP (value) && EQ (value, Qcenter))
            break;
-         else if (RANGED_INTEGERP (0, value, 100))
+         else if (RANGED_FIXNUMP (0, value, 100))
            break;
          return 0;
 
@@ -785,7 +785,7 @@ parse_image_spec (Lisp_Object spec, struct image_keyword 
*keywords,
          /* Unlike the other integer-related cases, this one does not
             verify that VALUE fits in 'int'.  This is because callers
             want EMACS_INT.  */
-         if (!INTEGERP (value) || XINT (value) < 0)
+         if (!FIXNUMP (value) || XFIXNUM (value) < 0)
            return 0;
          break;
 
@@ -799,12 +799,12 @@ parse_image_spec (Lisp_Object spec, struct image_keyword 
*keywords,
          return 0;
 
        case IMAGE_NUMBER_VALUE:
-         if (! NUMBERP (value))
+         if (! FIXED_OR_FLOATP (value))
            return 0;
          break;
 
        case IMAGE_INTEGER_VALUE:
-         if (! TYPE_RANGED_INTEGERP (int, value))
+         if (! TYPE_RANGED_FIXNUMP (int, value))
            return 0;
          break;
 
@@ -883,7 +883,7 @@ or omitted means use the selected frame.  */)
        size = Fcons (make_float ((double) width / FRAME_COLUMN_WIDTH (f)),
                      make_float ((double) height / FRAME_LINE_HEIGHT (f)));
       else
-       size = Fcons (make_number (width), make_number (height));
+       size = Fcons (make_fixnum (width), make_fixnum (height));
     }
   else
     error ("Invalid image specification");
@@ -1004,9 +1004,9 @@ check_image_size (struct frame *f, int width, int height)
   if (width <= 0 || height <= 0)
     return 0;
 
-  if (INTEGERP (Vmax_image_size))
-    return (width <= XINT (Vmax_image_size)
-           && height <= XINT (Vmax_image_size));
+  if (FIXNUMP (Vmax_image_size))
+    return (width <= XFIXNUM (Vmax_image_size)
+           && height <= XFIXNUM (Vmax_image_size));
   else if (FLOATP (Vmax_image_size))
     {
       if (f != NULL)
@@ -1534,7 +1534,7 @@ clear_image_cache (struct frame *f, Lisp_Object filter)
                }
            }
        }
-      else if (INTEGERP (Vimage_cache_eviction_delay))
+      else if (FIXNUMP (Vimage_cache_eviction_delay))
        {
          /* Free cache based on timestamp.  */
          struct timespec old, t;
@@ -1547,7 +1547,7 @@ clear_image_cache (struct frame *f, Lisp_Object filter)
 
          /* If the number of cached images has grown unusually large,
             decrease the cache eviction delay (Bug#6230).  */
-         delay = XINT (Vimage_cache_eviction_delay);
+         delay = XFIXNUM (Vimage_cache_eviction_delay);
          if (nimages > 40)
            delay = 1600 * delay / nimages / nimages;
          delay = max (delay, 1);
@@ -1761,11 +1761,11 @@ lookup_image (struct frame *f, Lisp_Object spec)
          Lisp_Object value;
 
          value = image_spec_value (spec, QCwidth, NULL);
-         img->width = (INTEGERP (value)
-                       ? XFASTINT (value) : DEFAULT_IMAGE_WIDTH);
+         img->width = (FIXNUMP (value)
+                       ? XFIXNAT (value) : DEFAULT_IMAGE_WIDTH);
          value = image_spec_value (spec, QCheight, NULL);
-         img->height = (INTEGERP (value)
-                        ? XFASTINT (value) : DEFAULT_IMAGE_HEIGHT);
+         img->height = (FIXNUMP (value)
+                        ? XFIXNAT (value) : DEFAULT_IMAGE_HEIGHT);
        }
       else
        {
@@ -1776,25 +1776,25 @@ lookup_image (struct frame *f, Lisp_Object spec)
          int relief_bound;
 
          ascent = image_spec_value (spec, QCascent, NULL);
-         if (INTEGERP (ascent))
-           img->ascent = XFASTINT (ascent);
+         if (FIXNUMP (ascent))
+           img->ascent = XFIXNAT (ascent);
          else if (EQ (ascent, Qcenter))
            img->ascent = CENTERED_IMAGE_ASCENT;
 
          margin = image_spec_value (spec, QCmargin, NULL);
-         if (INTEGERP (margin))
-           img->vmargin = img->hmargin = XFASTINT (margin);
+         if (FIXNUMP (margin))
+           img->vmargin = img->hmargin = XFIXNAT (margin);
          else if (CONSP (margin))
            {
-             img->hmargin = XFASTINT (XCAR (margin));
-             img->vmargin = XFASTINT (XCDR (margin));
+             img->hmargin = XFIXNAT (XCAR (margin));
+             img->vmargin = XFIXNAT (XCDR (margin));
            }
 
          relief = image_spec_value (spec, QCrelief, NULL);
          relief_bound = INT_MAX - max (img->hmargin, img->vmargin);
-         if (RANGED_INTEGERP (- relief_bound, relief, relief_bound))
+         if (RANGED_FIXNUMP (- relief_bound, relief, relief_bound))
            {
-             img->relief = XINT (relief);
+             img->relief = XFIXNUM (relief);
              img->hmargin += eabs (img->relief);
              img->vmargin += eabs (img->relief);
            }
@@ -1973,7 +1973,7 @@ x_create_x_image_and_pixmap (struct frame *f, int width, 
int height, int depth,
       x_destroy_x_image (*ximg);
       *ximg = NULL;
       image_error ("Image too large (%dx%d)",
-                  make_number (width), make_number (height));
+                  make_fixnum (width), make_fixnum (height));
       return 0;
     }
 
@@ -2306,7 +2306,7 @@ x_find_image_fd (Lisp_Object file, int *pfd)
 
   /* Try to find FILE in data-directory/images, then x-bitmap-file-path.  */
   fd = openp (search_path, file, Qnil, &file_found,
-             pfd ? Qt : make_number (R_OK), false);
+             pfd ? Qt : make_fixnum (R_OK), false);
   if (fd >= 0 || fd == -2)
     {
       file_found = ENCODE_FILE (file_found);
@@ -2512,8 +2512,8 @@ xbm_image_p (Lisp_Object object)
        return 0;
 
       data = kw[XBM_DATA].value;
-      width = XFASTINT (kw[XBM_WIDTH].value);
-      height = XFASTINT (kw[XBM_HEIGHT].value);
+      width = XFIXNAT (kw[XBM_WIDTH].value);
+      height = XFIXNAT (kw[XBM_HEIGHT].value);
 
       /* Check type of data, and width and height against contents of
         data.  */
@@ -2875,7 +2875,7 @@ xbm_read_bitmap_data (struct frame *f, char *contents, 
char *end,
     {
       if (!inhibit_image_error)
        image_error ("Image too large (%dx%d)",
-                    make_number (*width), make_number (*height));
+                    make_fixnum (*width), make_fixnum (*height));
       goto failure;
     }
   bytes_per_line = (*width + 7) / 8 + padding_p;
@@ -3061,8 +3061,8 @@ xbm_load (struct frame *f, struct image *img)
       /* Get specified width, and height.  */
       if (!in_memory_file_p)
        {
-         img->width = XFASTINT (fmt[XBM_WIDTH].value);
-         img->height = XFASTINT (fmt[XBM_HEIGHT].value);
+         img->width = XFIXNAT (fmt[XBM_WIDTH].value);
+         img->height = XFIXNAT (fmt[XBM_HEIGHT].value);
          eassert (img->width > 0 && img->height > 0);
          if (!check_image_size (f, img->width, img->height))
            {
@@ -4000,7 +4000,7 @@ xpm_make_color_table_v (void (**put_func) (Lisp_Object, 
const char *, int,
 {
   *put_func = xpm_put_color_table_v;
   *get_func = xpm_get_color_table_v;
-  return Fmake_vector (make_number (256), Qnil);
+  return Fmake_vector (make_fixnum (256), Qnil);
 }
 
 static void
@@ -4168,7 +4168,7 @@ xpm_load_image (struct frame *f,
   if (!NILP (Fxw_display_color_p (frame)))
     best_key = XPM_COLOR_KEY_C;
   else if (!NILP (Fx_display_grayscale_p (frame)))
-    best_key = (XFASTINT (Fx_display_planes (frame)) > 2
+    best_key = (XFIXNAT (Fx_display_planes (frame)) > 2
                ? XPM_COLOR_KEY_G : XPM_COLOR_KEY_G4);
   else
     best_key = XPM_COLOR_KEY_M;
@@ -4239,7 +4239,7 @@ xpm_load_image (struct frame *f,
                color_val = Qt;
              else if (x_defined_color (f, SSDATA (XCDR (specified_color)),
                                        &cdef, 0))
-               color_val = make_number (cdef.pixel);
+               color_val = make_fixnum (cdef.pixel);
            }
        }
       if (NILP (color_val) && max_key > 0)
@@ -4247,7 +4247,7 @@ xpm_load_image (struct frame *f,
          if (xstrcasecmp (max_color, "None") == 0)
            color_val = Qt;
          else if (x_defined_color (f, max_color, &cdef, 0))
-           color_val = make_number (cdef.pixel);
+           color_val = make_fixnum (cdef.pixel);
        }
       if (!NILP (color_val))
        (*put_color_table) (color_table, beg, chars_per_pixel, color_val);
@@ -4267,7 +4267,7 @@ xpm_load_image (struct frame *f,
            (*get_color_table) (color_table, str, chars_per_pixel);
 
          XPutPixel (ximg, x, y,
-                    (INTEGERP (color_val) ? XINT (color_val)
+                    (FIXNUMP (color_val) ? XFIXNUM (color_val)
                      : FRAME_FOREGROUND_PIXEL (f)));
 #ifndef HAVE_NS
          XPutPixel (mask_img, x, y,
@@ -4928,20 +4928,20 @@ x_edge_detection (struct frame *f, struct image *img, 
Lisp_Object matrix,
   if (CONSP (matrix))
     {
       for (i = 0;
-          i < 9 && CONSP (matrix) && NUMBERP (XCAR (matrix));
+          i < 9 && CONSP (matrix) && FIXED_OR_FLOATP (XCAR (matrix));
           ++i, matrix = XCDR (matrix))
        trans[i] = XFLOATINT (XCAR (matrix));
     }
   else if (VECTORP (matrix) && ASIZE (matrix) >= 9)
     {
-      for (i = 0; i < 9 && NUMBERP (AREF (matrix, i)); ++i)
+      for (i = 0; i < 9 && FIXED_OR_FLOATP (AREF (matrix, i)); ++i)
        trans[i] = XFLOATINT (AREF (matrix, i));
     }
 
   if (NILP (color_adjust))
-    color_adjust = make_number (0xffff / 2);
+    color_adjust = make_fixnum (0xffff / 2);
 
-  if (i == 9 && NUMBERP (color_adjust))
+  if (i == 9 && FIXED_OR_FLOATP (color_adjust))
     x_detect_edges (f, img, trans, XFLOATINT (color_adjust));
 }
 
@@ -5093,9 +5093,9 @@ x_build_heuristic_mask (struct frame *f, struct image 
*img, Lisp_Object how)
     {
       int rgb[3], i;
 
-      for (i = 0; i < 3 && CONSP (how) && NATNUMP (XCAR (how)); ++i)
+      for (i = 0; i < 3 && CONSP (how) && FIXNATP (XCAR (how)); ++i)
        {
-         rgb[i] = XFASTINT (XCAR (how)) & 0xffff;
+         rgb[i] = XFIXNAT (XCAR (how)) & 0xffff;
          how = XCDR (how);
        }
 
@@ -7280,9 +7280,9 @@ tiff_load (struct frame *f, struct image *img)
     }
 
   image = image_spec_value (img->spec, QCindex, NULL);
-  if (INTEGERP (image))
+  if (FIXNUMP (image))
     {
-      EMACS_INT ino = XFASTINT (image);
+      EMACS_INT ino = XFIXNAT (image);
       if (! (TYPE_MINIMUM (tdir_t) <= ino && ino <= TYPE_MAXIMUM (tdir_t)
             && TIFFSetDirectory (tiff, ino)))
        {
@@ -7324,7 +7324,7 @@ tiff_load (struct frame *f, struct image *img)
 
   if (count > 1)
     img->lisp_data = Fcons (Qcount,
-                           Fcons (make_number (count),
+                           Fcons (make_fixnum (count),
                                   img->lisp_data));
 
   TIFFClose (tiff);
@@ -7746,7 +7746,7 @@ gif_load (struct frame *f, struct image *img)
   /* Which sub-image are we to display?  */
   {
     Lisp_Object image_number = image_spec_value (img->spec, QCindex, NULL);
-    idx = INTEGERP (image_number) ? XFASTINT (image_number) : 0;
+    idx = FIXNUMP (image_number) ? XFIXNAT (image_number) : 0;
     if (idx < 0 || idx >= gif->ImageCount)
       {
        image_error ("Invalid image number `%s' in image `%s'",
@@ -8000,7 +8000,7 @@ gif_load (struct frame *f, struct image *img)
        /* Append (... FUNCTION "BYTES") */
        {
          img->lisp_data
-           = Fcons (make_number (ext->Function),
+           = Fcons (make_fixnum (ext->Function),
                     Fcons (make_unibyte_string ((char *) ext->Bytes,
                                                 ext->ByteCount),
                            img->lisp_data));
@@ -8021,7 +8021,7 @@ gif_load (struct frame *f, struct image *img)
 
   if (gif->ImageCount > 1)
     img->lisp_data = Fcons (Qcount,
-                           Fcons (make_number (gif->ImageCount),
+                           Fcons (make_fixnum (gif->ImageCount),
                                   img->lisp_data));
 
   if (gif_close (gif, &gif_err) == GIF_ERROR)
@@ -8102,33 +8102,33 @@ compute_image_size (size_t width, size_t height,
   double scale = 1;
 
   value = image_spec_value (spec, QCscale, NULL);
-  if (NUMBERP (value))
+  if (FIXED_OR_FLOATP (value))
     scale = XFLOATINT (value);
 
   value = image_spec_value (spec, QCmax_width, NULL);
-  if (NATNUMP (value))
-    max_width = min (XFASTINT (value), INT_MAX);
+  if (FIXNATP (value))
+    max_width = min (XFIXNAT (value), INT_MAX);
 
   value = image_spec_value (spec, QCmax_height, NULL);
-  if (NATNUMP (value))
-    max_height = min (XFASTINT (value), INT_MAX);
+  if (FIXNATP (value))
+    max_height = min (XFIXNAT (value), INT_MAX);
 
   /* If width and/or height is set in the display spec assume we want
      to scale to those values.  If either h or w is unspecified, the
      unspecified should be calculated from the specified to preserve
      aspect ratio.  */
   value = image_spec_value (spec, QCwidth, NULL);
-  if (NATNUMP (value))
+  if (FIXNATP (value))
     {
-      desired_width = min (XFASTINT (value) * scale, INT_MAX);
+      desired_width = min (XFIXNAT (value) * scale, INT_MAX);
       /* :width overrides :max-width. */
       max_width = -1;
     }
 
   value = image_spec_value (spec, QCheight, NULL);
-  if (NATNUMP (value))
+  if (FIXNATP (value))
     {
-      desired_height = min (XFASTINT (value) * scale, INT_MAX);
+      desired_height = min (XFIXNAT (value) * scale, INT_MAX);
       /* :height overrides :max-height. */
       max_height = -1;
     }
@@ -8573,7 +8573,7 @@ imagemagick_load_image (struct frame *f, struct image 
*img,
      find out things about it.  */
 
   image = image_spec_value (img->spec, QCindex, NULL);
-  ino = INTEGERP (image) ? XFASTINT (image) : 0;
+  ino = FIXNUMP (image) ? XFIXNAT (image) : 0;
   image_wand = NewMagickWand ();
 
   if (filename)
@@ -8583,9 +8583,9 @@ imagemagick_load_image (struct frame *f, struct image 
*img,
       Lisp_Object lwidth = image_spec_value (img->spec, QCwidth, NULL);
       Lisp_Object lheight = image_spec_value (img->spec, QCheight, NULL);
 
-      if (NATNUMP (lwidth) && NATNUMP (lheight))
+      if (FIXNATP (lwidth) && FIXNATP (lheight))
        {
-         MagickSetSize (image_wand, XFASTINT (lwidth), XFASTINT (lheight));
+         MagickSetSize (image_wand, XFIXNAT (lwidth), XFIXNAT (lheight));
          MagickSetDepth (image_wand, 8);
        }
       filename_hint = imagemagick_filename_hint (img->spec, hint_buffer);
@@ -8628,7 +8628,7 @@ imagemagick_load_image (struct frame *f, struct image 
*img,
   if (MagickGetNumberImages (image_wand) > 1)
     img->lisp_data =
       Fcons (Qcount,
-             Fcons (make_number (MagickGetNumberImages (image_wand)),
+             Fcons (make_fixnum (MagickGetNumberImages (image_wand)),
                     img->lisp_data));
 
   /* If we have an animated image, get the new wand based on the
@@ -8678,26 +8678,26 @@ imagemagick_load_image (struct frame *f, struct image 
*img,
      efficient.  */
   crop = image_spec_value (img->spec, QCcrop, NULL);
 
-  if (CONSP (crop) && TYPE_RANGED_INTEGERP (size_t, XCAR (crop)))
+  if (CONSP (crop) && TYPE_RANGED_FIXNUMP (size_t, XCAR (crop)))
     {
       /* After some testing, it seems MagickCropImage is the fastest crop
          function in ImageMagick.  This crop function seems to do less copying
          than the alternatives, but it still reads the entire image into memory
          before cropping, which is apparently difficult to avoid when using
          imagemagick.  */
-      size_t crop_width = XINT (XCAR (crop));
+      size_t crop_width = XFIXNUM (XCAR (crop));
       crop = XCDR (crop);
-      if (CONSP (crop) && TYPE_RANGED_INTEGERP (size_t, XCAR (crop)))
+      if (CONSP (crop) && TYPE_RANGED_FIXNUMP (size_t, XCAR (crop)))
        {
-         size_t crop_height = XINT (XCAR (crop));
+         size_t crop_height = XFIXNUM (XCAR (crop));
          crop = XCDR (crop);
-         if (CONSP (crop) && TYPE_RANGED_INTEGERP (ssize_t, XCAR (crop)))
+         if (CONSP (crop) && TYPE_RANGED_FIXNUMP (ssize_t, XCAR (crop)))
            {
-             ssize_t crop_x = XINT (XCAR (crop));
+             ssize_t crop_x = XFIXNUM (XCAR (crop));
              crop = XCDR (crop);
-             if (CONSP (crop) && TYPE_RANGED_INTEGERP (ssize_t, XCAR (crop)))
+             if (CONSP (crop) && TYPE_RANGED_FIXNUMP (ssize_t, XCAR (crop)))
                {
-                 ssize_t crop_y = XINT (XCAR (crop));
+                 ssize_t crop_y = XFIXNUM (XCAR (crop));
                  MagickCropImage (image_wand, crop_width, crop_height,
                                   crop_x, crop_y);
                }
@@ -9551,7 +9551,7 @@ gs_image_p (Lisp_Object object)
   if (CONSP (tem))
     {
       for (i = 0; i < 4; ++i, tem = XCDR (tem))
-       if (!CONSP (tem) || !INTEGERP (XCAR (tem)))
+       if (!CONSP (tem) || !FIXNUMP (XCAR (tem)))
          return 0;
       if (!NILP (tem))
        return 0;
@@ -9561,7 +9561,7 @@ gs_image_p (Lisp_Object object)
       if (ASIZE (tem) != 4)
        return 0;
       for (i = 0; i < 4; ++i)
-       if (!INTEGERP (AREF (tem, i)))
+       if (!FIXNUMP (AREF (tem, i)))
          return 0;
     }
   else
@@ -9589,10 +9589,10 @@ gs_load (struct frame *f, struct image *img)
      = 1/72 in, xdpi and ydpi are stored in the frame's X display
      info.  */
   pt_width = image_spec_value (img->spec, QCpt_width, NULL);
-  in_width = INTEGERP (pt_width) ? XFASTINT (pt_width) / 72.0 : 0;
+  in_width = FIXNUMP (pt_width) ? XFIXNAT (pt_width) / 72.0 : 0;
   in_width *= FRAME_RES_X (f);
   pt_height = image_spec_value (img->spec, QCpt_height, NULL);
-  in_height = INTEGERP (pt_height) ? XFASTINT (pt_height) / 72.0 : 0;
+  in_height = FIXNUMP (pt_height) ? XFIXNAT (pt_height) / 72.0 : 0;
   in_height *= FRAME_RES_Y (f);
 
   if (! (in_width <= INT_MAX && in_height <= INT_MAX
@@ -9643,8 +9643,8 @@ gs_load (struct frame *f, struct image *img)
     loader = intern ("gs-load-image");
 
   img->lisp_data = call6 (loader, frame, img->spec,
-                         make_number (img->width),
-                         make_number (img->height),
+                         make_fixnum (img->width),
+                         make_fixnum (img->height),
                          window_and_pixmap_id,
                          pixel_colors);
   return PROCESSP (img->lisp_data);
@@ -9768,7 +9768,7 @@ DEFUN ("lookup-image", Flookup_image, Slookup_image, 1, 
1, 0,
     id = lookup_image (SELECTED_FRAME (), spec);
 
   debug_print (spec);
-  return make_number (id);
+  return make_fixnum (id);
 }
 
 #endif /* GLYPH_DEBUG */
@@ -9933,27 +9933,27 @@ non-numeric, there is no explicit limit on the size of 
images.  */);
   DEFSYM (Qlibpng_version, "libpng-version");
   Fset (Qlibpng_version,
 #if HAVE_PNG
-       make_number (PNG_LIBPNG_VER)
+       make_fixnum (PNG_LIBPNG_VER)
 #else
-       make_number (-1)
+       make_fixnum (-1)
 #endif
        );
   DEFSYM (Qlibgif_version, "libgif-version");
   Fset (Qlibgif_version,
 #ifdef HAVE_GIF
-       make_number (GIFLIB_MAJOR * 10000
+       make_fixnum (GIFLIB_MAJOR * 10000
                     + GIFLIB_MINOR * 100
                     + GIFLIB_RELEASE)
 #else
-       make_number (-1)
+       make_fixnum (-1)
 #endif
         );
   DEFSYM (Qlibjpeg_version, "libjpeg-version");
   Fset (Qlibjpeg_version,
 #if HAVE_JPEG
-       make_number (JPEG_LIB_VERSION)
+       make_fixnum (JPEG_LIB_VERSION)
 #else
-       make_number (-1)
+       make_fixnum (-1)
 #endif
        );
 #endif
@@ -10038,7 +10038,7 @@ a large number of images, the actual eviction time may 
be shorter.
 The value can also be nil, meaning the cache is never cleared.
 
 The function `clear-image-cache' disregards this variable.  */);
-  Vimage_cache_eviction_delay = make_number (300);
+  Vimage_cache_eviction_delay = make_fixnum (300);
 #ifdef HAVE_IMAGEMAGICK
   DEFVAR_INT ("imagemagick-render-type", imagemagick_render_type,
     doc: /* Integer indicating which ImageMagick rendering method to use.
diff --git a/src/indent.c b/src/indent.c
index a86db71..1885576 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -116,7 +116,7 @@ disptab_matches_widthtab (struct Lisp_Char_Table *disptab, 
struct Lisp_Vector *w
 
   for (i = 0; i < 256; i++)
     if (character_width (i, disptab)
-        != XFASTINT (widthtab->contents[i]))
+        != XFIXNAT (widthtab->contents[i]))
       return 0;
 
   return 1;
@@ -235,24 +235,24 @@ skip_invisible (ptrdiff_t pos, ptrdiff_t 
*next_boundary_p, ptrdiff_t to, Lisp_Ob
   /* As for text properties, this gives a lower bound
      for where the invisible text property could change.  */
   proplimit = Fnext_property_change (position, buffer, Qt);
-  if (XFASTINT (overlay_limit) < XFASTINT (proplimit))
+  if (XFIXNAT (overlay_limit) < XFIXNAT (proplimit))
     proplimit = overlay_limit;
   /* PROPLIMIT is now a lower bound for the next change
      in invisible status.  If that is plenty far away,
      use that lower bound.  */
-  if (XFASTINT (proplimit) > pos + 100 || XFASTINT (proplimit) >= to)
-    *next_boundary_p = XFASTINT (proplimit);
+  if (XFIXNAT (proplimit) > pos + 100 || XFIXNAT (proplimit) >= to)
+    *next_boundary_p = XFIXNAT (proplimit);
   /* Otherwise, scan for the next `invisible' property change.  */
   else
     {
       /* Don't scan terribly far.  */
       XSETFASTINT (proplimit, min (pos + 100, to));
       /* No matter what, don't go past next overlay change.  */
-      if (XFASTINT (overlay_limit) < XFASTINT (proplimit))
+      if (XFIXNAT (overlay_limit) < XFIXNAT (proplimit))
        proplimit = overlay_limit;
       tmp = Fnext_single_property_change (position, Qinvisible,
                                          buffer, proplimit);
-      end = XFASTINT (tmp);
+      end = XFIXNAT (tmp);
 #if 0
       /* Don't put the boundary in the middle of multibyte form if
          there is no actual property change.  */
@@ -472,7 +472,7 @@ check_display_width (ptrdiff_t pos, ptrdiff_t col, 
ptrdiff_t *endpos)
   Lisp_Object val, overlay;
 
   if (CONSP (val = get_char_property_and_overlay
-            (make_number (pos), Qdisplay, Qnil, &overlay))
+            (make_fixnum (pos), Qdisplay, Qnil, &overlay))
       && EQ (Qspace, XCAR (val)))
     { /* FIXME: Use calc_pixel_width_or_height.  */
       Lisp_Object plist = XCDR (val), prop;
@@ -483,16 +483,16 @@ check_display_width (ptrdiff_t pos, ptrdiff_t col, 
ptrdiff_t *endpos)
         : MOST_POSITIVE_FIXNUM);
 
       if ((prop = Fplist_get (plist, QCwidth),
-          RANGED_INTEGERP (0, prop, INT_MAX))
+          RANGED_FIXNUMP (0, prop, INT_MAX))
          || (prop = Fplist_get (plist, QCrelative_width),
-             RANGED_INTEGERP (0, prop, INT_MAX)))
-       width = XINT (prop);
+             RANGED_FIXNUMP (0, prop, INT_MAX)))
+       width = XFIXNUM (prop);
       else if (FLOATP (prop) && 0 <= XFLOAT_DATA (prop)
               && XFLOAT_DATA (prop) <= INT_MAX)
        width = (int)(XFLOAT_DATA (prop) + 0.5);
       else if ((prop = Fplist_get (plist, QCalign_to),
-               RANGED_INTEGERP (col, prop, align_to_max)))
-       width = XINT (prop) - col;
+               RANGED_FIXNUMP (col, prop, align_to_max)))
+       width = XFIXNUM (prop) - col;
       else if (FLOATP (prop) && col <= XFLOAT_DATA (prop)
               && (XFLOAT_DATA (prop) <= align_to_max))
        width = (int)(XFLOAT_DATA (prop) + 0.5) - col;
@@ -751,16 +751,16 @@ string_display_width (Lisp_Object string, Lisp_Object 
beg, Lisp_Object end)
     e = SCHARS (string);
   else
     {
-      CHECK_NUMBER (end);
-      e = XINT (end);
+      CHECK_FIXNUM (end);
+      e = XFIXNUM (end);
     }
 
   if (NILP (beg))
     b = 0;
   else
     {
-      CHECK_NUMBER (beg);
-      b = XINT (beg);
+      CHECK_FIXNUM (beg);
+      b = XFIXNUM (beg);
     }
 
   /* Make a pointer for decrementing through the chars before point.  */
@@ -820,32 +820,32 @@ The return value is the column where the insertion ends.  
*/)
   register ptrdiff_t fromcol;
   int tab_width = SANE_TAB_WIDTH (current_buffer);
 
-  CHECK_NUMBER (column);
+  CHECK_FIXNUM (column);
   if (NILP (minimum))
     XSETFASTINT (minimum, 0);
-  CHECK_NUMBER (minimum);
+  CHECK_FIXNUM (minimum);
 
   fromcol = current_column ();
-  mincol = fromcol + XINT (minimum);
-  if (mincol < XINT (column)) mincol = XINT (column);
+  mincol = fromcol + XFIXNUM (minimum);
+  if (mincol < XFIXNUM (column)) mincol = XFIXNUM (column);
 
   if (fromcol == mincol)
-    return make_number (mincol);
+    return make_fixnum (mincol);
 
   if (indent_tabs_mode)
     {
       Lisp_Object n;
       XSETFASTINT (n, mincol / tab_width - fromcol / tab_width);
-      if (XFASTINT (n) != 0)
+      if (XFIXNAT (n) != 0)
        {
-         Finsert_char (make_number ('\t'), n, Qt);
+         Finsert_char (make_fixnum ('\t'), n, Qt);
 
          fromcol = (mincol / tab_width) * tab_width;
        }
     }
 
   XSETFASTINT (column, mincol - fromcol);
-  Finsert_char (make_number (' '), column, Qt);
+  Finsert_char (make_fixnum (' '), column, Qt);
 
   last_known_column = mincol;
   last_known_column_point = PT;
@@ -866,7 +866,7 @@ following any initial whitespace.  */)
   ptrdiff_t posbyte;
 
   find_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, -1, NULL, &posbyte, 1);
-  return make_number (position_indentation (posbyte));
+  return make_fixnum (position_indentation (posbyte));
 }
 
 static ptrdiff_t
@@ -994,8 +994,8 @@ The return value is the current column.  */)
   EMACS_INT col;
   EMACS_INT goal;
 
-  CHECK_NATNUM (column);
-  goal = XINT (column);
+  CHECK_FIXNAT (column);
+  goal = XFIXNUM (column);
 
   col = goal;
   pos = ZV;
@@ -1020,13 +1020,13 @@ The return value is the current column.  */)
             first so that a marker at the end of the tab gets
             adjusted.  */
          SET_PT_BOTH (PT - 1, PT_BYTE - 1);
-         Finsert_char (make_number (' '), make_number (goal - prev_col), Qt);
+         Finsert_char (make_fixnum (' '), make_fixnum (goal - prev_col), Qt);
 
          /* Now delete the tab, and indent to COL.  */
          del_range (PT, PT + 1);
          goal_pt = PT;
          goal_pt_byte = PT_BYTE;
-         Findent_to (make_number (col), Qnil);
+         Findent_to (make_fixnum (col), Qnil);
          SET_PT_BOTH (goal_pt, goal_pt_byte);
 
          /* Set the last_known... vars consistently.  */
@@ -1036,13 +1036,13 @@ The return value is the current column.  */)
 
   /* If line ends prematurely, add space to the end.  */
   if (col < goal && EQ (force, Qt))
-    Findent_to (make_number (col = goal), Qnil);
+    Findent_to (make_fixnum (col = goal), Qnil);
 
   last_known_column = col;
   last_known_column_point = PT;
   last_known_column_modified = MODIFF;
 
-  return make_number (col);
+  return make_fixnum (col);
 }
 
 /* compute_motion: compute buffer posn given screen posn and vice versa */
@@ -1128,8 +1128,8 @@ compute_motion (ptrdiff_t from, ptrdiff_t frombyte, 
EMACS_INT fromvpos,
   bool ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
   struct Lisp_Char_Table *dp = window_display_table (win);
   EMACS_INT selective
-    = (INTEGERP (BVAR (current_buffer, selective_display))
-       ? XINT (BVAR (current_buffer, selective_display))
+    = (FIXNUMP (BVAR (current_buffer, selective_display))
+       ? XFIXNUM (BVAR (current_buffer, selective_display))
        : !NILP (BVAR (current_buffer, selective_display)) ? -1 : 0);
   ptrdiff_t selective_rlen
     = (selective && dp && VECTORP (DISP_INVIS_VECTOR (dp))
@@ -1338,9 +1338,9 @@ compute_motion (ptrdiff_t from, ptrdiff_t frombyte, 
EMACS_INT fromvpos,
          if (!NILP (Vtruncate_partial_width_windows)
              && (total_width < FRAME_COLS (XFRAME (WINDOW_FRAME (win)))))
            {
-             if (INTEGERP (Vtruncate_partial_width_windows))
+             if (FIXNUMP (Vtruncate_partial_width_windows))
                truncate
-                 = total_width < XFASTINT (Vtruncate_partial_width_windows);
+                 = total_width < XFIXNAT (Vtruncate_partial_width_windows);
              else
                truncate = 1;
            }
@@ -1533,7 +1533,7 @@ compute_motion (ptrdiff_t from, ptrdiff_t frombyte, 
EMACS_INT fromvpos,
              /* Is this character part of the current run?  If so, extend
                 the run.  */
              if (pos - 1 == width_run_end
-                 && XFASTINT (width_table[c]) == width_run_width)
+                 && XFIXNAT (width_table[c]) == width_run_width)
                width_run_end = pos;
 
              /* The previous run is over, since this is a character at a
@@ -1548,7 +1548,7 @@ compute_motion (ptrdiff_t from, ptrdiff_t frombyte, 
EMACS_INT fromvpos,
                                       width_run_start, width_run_end);
 
                  /* Start recording a new width run.  */
-                 width_run_width = XFASTINT (width_table[c]);
+                 width_run_width = XFIXNAT (width_table[c]);
                  width_run_start = pos - 1;
                  width_run_end = pos;
                }
@@ -1754,48 +1754,48 @@ visible section of the buffer, and pass LINE and COL as 
TOPOS.  */)
   ptrdiff_t hscroll;
   int tab_offset;
 
-  CHECK_NUMBER_COERCE_MARKER (from);
+  CHECK_FIXNUM_COERCE_MARKER (from);
   CHECK_CONS (frompos);
-  CHECK_NUMBER_CAR (frompos);
-  CHECK_NUMBER_CDR (frompos);
-  CHECK_NUMBER_COERCE_MARKER (to);
+  CHECK_FIXNUM_CAR (frompos);
+  CHECK_FIXNUM_CDR (frompos);
+  CHECK_FIXNUM_COERCE_MARKER (to);
   if (!NILP (topos))
     {
       CHECK_CONS (topos);
-      CHECK_NUMBER_CAR (topos);
-      CHECK_NUMBER_CDR (topos);
+      CHECK_FIXNUM_CAR (topos);
+      CHECK_FIXNUM_CDR (topos);
     }
   if (!NILP (width))
-    CHECK_NUMBER (width);
+    CHECK_FIXNUM (width);
 
   if (!NILP (offsets))
     {
       CHECK_CONS (offsets);
-      CHECK_NUMBER_CAR (offsets);
-      CHECK_NUMBER_CDR (offsets);
-      if (! (0 <= XINT (XCAR (offsets)) && XINT (XCAR (offsets)) <= PTRDIFF_MAX
-            && 0 <= XINT (XCDR (offsets)) && XINT (XCDR (offsets)) <= INT_MAX))
+      CHECK_FIXNUM_CAR (offsets);
+      CHECK_FIXNUM_CDR (offsets);
+      if (! (0 <= XFIXNUM (XCAR (offsets)) && XFIXNUM (XCAR (offsets)) <= 
PTRDIFF_MAX
+            && 0 <= XFIXNUM (XCDR (offsets)) && XFIXNUM (XCDR (offsets)) <= 
INT_MAX))
        args_out_of_range (XCAR (offsets), XCDR (offsets));
-      hscroll = XINT (XCAR (offsets));
-      tab_offset = XINT (XCDR (offsets));
+      hscroll = XFIXNUM (XCAR (offsets));
+      tab_offset = XFIXNUM (XCDR (offsets));
     }
   else
     hscroll = tab_offset = 0;
 
   w = decode_live_window (window);
 
-  if (XINT (from) < BEGV || XINT (from) > ZV)
-    args_out_of_range_3 (from, make_number (BEGV), make_number (ZV));
-  if (XINT (to) < BEGV || XINT (to) > ZV)
-    args_out_of_range_3 (to, make_number (BEGV), make_number (ZV));
+  if (XFIXNUM (from) < BEGV || XFIXNUM (from) > ZV)
+    args_out_of_range_3 (from, make_fixnum (BEGV), make_fixnum (ZV));
+  if (XFIXNUM (to) < BEGV || XFIXNUM (to) > ZV)
+    args_out_of_range_3 (to, make_fixnum (BEGV), make_fixnum (ZV));
 
-  pos = compute_motion (XINT (from), CHAR_TO_BYTE (XINT (from)),
-                       XINT (XCDR (frompos)),
-                       XINT (XCAR (frompos)), 0,
-                       XINT (to),
+  pos = compute_motion (XFIXNUM (from), CHAR_TO_BYTE (XFIXNUM (from)),
+                       XFIXNUM (XCDR (frompos)),
+                       XFIXNUM (XCAR (frompos)), 0,
+                       XFIXNUM (to),
                        (NILP (topos)
                         ? window_internal_height (w)
-                        : XINT (XCDR (topos))),
+                        : XFIXNUM (XCDR (topos))),
                        (NILP (topos)
                         ? (window_body_width (w, 0)
                            - (
@@ -1803,8 +1803,8 @@ visible section of the buffer, and pass LINE and COL as 
TOPOS.  */)
                               FRAME_WINDOW_P (XFRAME (w->frame)) ? 0 :
 #endif
                               1))
-                        : XINT (XCAR (topos))),
-                       (NILP (width) ? -1 : XINT (width)),
+                        : XFIXNUM (XCAR (topos))),
+                       (NILP (width) ? -1 : XFIXNUM (width)),
                        hscroll, tab_offset, w);
 
   XSETFASTINT (bufpos, pos->bufpos);
@@ -1831,8 +1831,8 @@ vmotion (register ptrdiff_t from, register ptrdiff_t 
from_byte,
   register ptrdiff_t first;
   ptrdiff_t lmargin = hscroll > 0 ? 1 - hscroll : 0;
   ptrdiff_t selective
-    = (INTEGERP (BVAR (current_buffer, selective_display))
-       ? clip_to_bounds (-1, XINT (BVAR (current_buffer, selective_display)),
+    = (FIXNUMP (BVAR (current_buffer, selective_display))
+       ? clip_to_bounds (-1, XFIXNUM (BVAR (current_buffer, 
selective_display)),
                         PTRDIFF_MAX)
        : !NILP (BVAR (current_buffer, selective_display)) ? -1 : 0);
   Lisp_Object window;
@@ -1870,7 +1870,7 @@ vmotion (register ptrdiff_t from, register ptrdiff_t 
from_byte,
                      && indented_beyond_p (prevline, bytepos, selective))
                     /* Watch out for newlines with `invisible' property.
                        When moving upward, check the newline before.  */
-                    || (propval = Fget_char_property (make_number (prevline - 
1),
+                    || (propval = Fget_char_property (make_fixnum (prevline - 
1),
                                                       Qinvisible,
                                                       text_prop_object),
                         TEXT_PROP_MEANS_INVISIBLE (propval))))
@@ -1920,7 +1920,7 @@ vmotion (register ptrdiff_t from, register ptrdiff_t 
from_byte,
                  && indented_beyond_p (prevline, bytepos, selective))
                 /* Watch out for newlines with `invisible' property.
                    When moving downward, check the newline after.  */
-                || (propval = Fget_char_property (make_number (prevline),
+                || (propval = Fget_char_property (make_fixnum (prevline),
                                                   Qinvisible,
                                                   text_prop_object),
                     TEXT_PROP_MEANS_INVISIBLE (propval))))
@@ -2016,8 +2016,8 @@ numbers on display.  */)
       return make_float ((double) pixel_width / FRAME_COLUMN_WIDTH (f));
     }
   else if (!NILP (pixelwise))
-    return make_number (pixel_width);
-  return make_number (width);
+    return make_fixnum (pixel_width);
+  return make_fixnum (width);
 }
 
 /* In window W (derived from WINDOW), return x coordinate for column
@@ -2045,8 +2045,8 @@ restore_window_buffer (Lisp_Object list)
   wset_buffer (w, XCAR (list));
   list = XCDR (list);
   set_marker_both (w->pointm, w->contents,
-                  XFASTINT (XCAR (list)),
-                  XFASTINT (XCAR (XCDR (list))));
+                  XFIXNAT (XCAR (list)),
+                  XFIXNAT (XCAR (XCDR (list))));
 }
 
 DEFUN ("vertical-motion", Fvertical_motion, Svertical_motion, 1, 3, 0,
@@ -2100,15 +2100,15 @@ whether or not it is currently displayed in some 
window.  */)
       lines = XCDR (lines);
     }
 
-  CHECK_NUMBER (lines);
+  CHECK_FIXNUM (lines);
   w = decode_live_window (window);
 
   if (XBUFFER (w->contents) != current_buffer)
     {
       /* Set the window's buffer temporarily to the current buffer.  */
       Lisp_Object old = list4 (window, w->contents,
-                              make_number (marker_position (w->pointm)),
-                              make_number (marker_byte_position (w->pointm)));
+                              make_fixnum (marker_position (w->pointm)),
+                              make_fixnum (marker_byte_position (w->pointm)));
       record_unwind_protect (restore_window_buffer, old);
       wset_buffer (w, Fcurrent_buffer ());
       set_marker_both (w->pointm, w->contents,
@@ -2118,7 +2118,7 @@ whether or not it is currently displayed in some window.  
*/)
   if (noninteractive)
     {
       struct position pos;
-      pos = *vmotion (PT, PT_BYTE, XINT (lines), w);
+      pos = *vmotion (PT, PT_BYTE, XFIXNUM (lines), w);
       SET_PT_BOTH (pos.bufpos, pos.bytepos);
       it.vpos = pos.vpos;
     }
@@ -2128,7 +2128,7 @@ whether or not it is currently displayed in some window.  
*/)
       int first_x;
       bool overshoot_handled = 0;
       bool disp_string_at_start_p = 0;
-      ptrdiff_t nlines = XINT (lines);
+      ptrdiff_t nlines = XFIXNUM (lines);
       int vpos_init = 0;
       double start_col UNINIT;
       int start_x UNINIT;
@@ -2356,7 +2356,7 @@ whether or not it is currently displayed in some window.  
*/)
       bidi_unshelve_cache (itdata, 0);
     }
 
-  return unbind_to (count, make_number (it.vpos));
+  return unbind_to (count, make_fixnum (it.vpos));
 }
 
 
diff --git a/src/inotify.c b/src/inotify.c
index e06cc97..9e76060 100644
--- a/src/inotify.c
+++ b/src/inotify.c
@@ -176,7 +176,7 @@ inotifyevent_to_event (Lisp_Object watch, struct 
inotify_event const *ev)
 {
   Lisp_Object name;
   uint32_t mask;
-  CONS_TO_INTEGER (Fnth (make_number (3), watch), uint32_t, mask);
+  CONS_TO_INTEGER (Fnth (make_fixnum (3), watch), uint32_t, mask);
 
   if (! (mask & ev->mask))
     return Qnil;
@@ -194,7 +194,7 @@ inotifyevent_to_event (Lisp_Object watch, struct 
inotify_event const *ev)
                        mask_to_aspects (ev->mask),
                        name,
                       INTEGER_TO_CONS (ev->cookie)),
-               Fnth (make_number (2), watch));
+               Fnth (make_fixnum (2), watch));
 }
 
 /* Add a new watch to watch-descriptor WD watching FILENAME and using
@@ -220,7 +220,7 @@ add_watch (int wd, Lisp_Object filename,
       /* Assign a watch ID that is not already in use, by looking
         for a gap in the existing sorted list.  */
       for (; ! NILP (XCDR (tail)); tail = XCDR (tail), id++)
-       if (!EQ (XCAR (XCAR (XCDR (tail))), make_number (id)))
+       if (!EQ (XCAR (XCAR (XCDR (tail))), make_fixnum (id)))
          break;
       if (MOST_POSITIVE_FIXNUM < id)
        emacs_abort ();
@@ -229,7 +229,7 @@ add_watch (int wd, Lisp_Object filename,
   /* Insert the newly-assigned ID into the previously-discovered gap,
      which is possibly at the end of the list.  Inserting it there
      keeps the list sorted.  */
-  watch_id = make_number (id);
+  watch_id = make_fixnum (id);
   watch = list4 (watch_id, filename, callback, mask);
   XSETCDR (tail, Fcons (watch, XCDR (tail)));
 
@@ -446,12 +446,12 @@ static bool
 valid_watch_descriptor (Lisp_Object wd)
 {
   return (CONSP (wd)
-         && (RANGED_INTEGERP (0, XCAR (wd), INT_MAX)
+         && (RANGED_FIXNUMP (0, XCAR (wd), INT_MAX)
              || (CONSP (XCAR (wd))
-                 && RANGED_INTEGERP ((MOST_POSITIVE_FIXNUM >> 16) + 1,
+                 && RANGED_FIXNUMP ((MOST_POSITIVE_FIXNUM >> 16) + 1,
                                      XCAR (XCAR (wd)), INT_MAX >> 16)
-                 && RANGED_INTEGERP (0, XCDR (XCAR (wd)), (1 << 16) - 1)))
-         && NATNUMP (XCDR (wd)));
+                 && RANGED_FIXNUMP (0, XCDR (XCAR (wd)), (1 << 16) - 1)))
+         && FIXNATP (XCDR (wd)));
 }
 
 DEFUN ("inotify-rm-watch", Finotify_rm_watch, Sinotify_rm_watch, 1, 1, 0,
diff --git a/src/insdel.c b/src/insdel.c
index 173c243..70cebc0 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -930,7 +930,7 @@ insert_1_both (const char *string,
   offset_intervals (current_buffer, PT, nchars);
 
   if (!inherit && buffer_intervals (current_buffer))
-    set_text_properties (make_number (PT), make_number (PT + nchars),
+    set_text_properties (make_fixnum (PT), make_fixnum (PT + nchars),
                         Qnil, Qnil, Qnil);
 
   adjust_point (nchars, nbytes);
@@ -1936,7 +1936,7 @@ prepare_to_modify_buffer_1 (ptrdiff_t start, ptrdiff_t 
end,
       if (preserve_ptr)
        {
          Lisp_Object preserve_marker;
-         preserve_marker = Fcopy_marker (make_number (*preserve_ptr), Qnil);
+         preserve_marker = Fcopy_marker (make_fixnum (*preserve_ptr), Qnil);
          verify_interval_modification (current_buffer, start, end);
          *preserve_ptr = marker_position (preserve_marker);
          unchain_marker (XMARKER (preserve_marker));
@@ -2046,7 +2046,7 @@ invalidate_buffer_caches (struct buffer *buf, ptrdiff_t 
start, ptrdiff_t end)
 
 #define PRESERVE_VALUE                                                 \
   if (preserve_ptr && NILP (preserve_marker))                          \
-    preserve_marker = Fcopy_marker (make_number (*preserve_ptr), Qnil)
+    preserve_marker = Fcopy_marker (make_fixnum (*preserve_ptr), Qnil)
 
 #define RESTORE_VALUE                                          \
   if (! NILP (preserve_marker))                                        \
@@ -2103,8 +2103,8 @@ signal_before_change (ptrdiff_t start_int, ptrdiff_t 
end_int,
   ptrdiff_t count = SPECPDL_INDEX ();
   struct rvoe_arg rvoe_arg;
 
-  start = make_number (start_int);
-  end = make_number (end_int);
+  start = make_fixnum (start_int);
+  end = make_fixnum (end_int);
   preserve_marker = Qnil;
   start_marker = Qnil;
   end_marker = Qnil;
@@ -2210,26 +2210,26 @@ signal_after_change (ptrdiff_t charpos, ptrdiff_t 
lendel, ptrdiff_t lenins)
 
       /* Actually run the hook functions.  */
       CALLN (Frun_hook_with_args, Qafter_change_functions,
-            make_number (charpos), make_number (charpos + lenins),
-            make_number (lendel));
+            make_fixnum (charpos), make_fixnum (charpos + lenins),
+            make_fixnum (lendel));
 
       /* There was no error: unarm the reset_on_error.  */
       rvoe_arg.errorp = 0;
     }
 
   if (buffer_has_overlays ())
-    report_overlay_modification (make_number (charpos),
-                                make_number (charpos + lenins),
+    report_overlay_modification (make_fixnum (charpos),
+                                make_fixnum (charpos + lenins),
                                 1,
-                                make_number (charpos),
-                                make_number (charpos + lenins),
-                                make_number (lendel));
+                                make_fixnum (charpos),
+                                make_fixnum (charpos + lenins),
+                                make_fixnum (lendel));
 
   /* After an insertion, call the text properties
      insert-behind-hooks or insert-in-front-hooks.  */
   if (lendel == 0)
-    report_interval_modification (make_number (charpos),
-                                 make_number (charpos + lenins));
+    report_interval_modification (make_fixnum (charpos),
+                                 make_fixnum (charpos + lenins));
 
   unbind_to (count, Qnil);
 }
@@ -2287,17 +2287,17 @@ DEFUN ("combine-after-change-execute", 
Fcombine_after_change_execute,
       elt = XCAR (tail);
       if (! CONSP (elt))
        continue;
-      thisbeg = XINT (XCAR (elt));
+      thisbeg = XFIXNUM (XCAR (elt));
 
       elt = XCDR (elt);
       if (! CONSP (elt))
        continue;
-      thisend = XINT (XCAR (elt));
+      thisend = XFIXNUM (XCAR (elt));
 
       elt = XCDR (elt);
       if (! CONSP (elt))
        continue;
-      thischange = XINT (XCAR (elt));
+      thischange = XFIXNUM (XCAR (elt));
 
       /* Merge this range into the accumulated range.  */
       change += thischange;
diff --git a/src/intervals.c b/src/intervals.c
index c3e137c..7e77714 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -1557,8 +1557,8 @@ graft_intervals_into_buffer (INTERVAL source, ptrdiff_t 
position,
       if (!inherit && tree && length > 0)
        {
          XSETBUFFER (buf, buffer);
-         set_text_properties_1 (make_number (position),
-                                make_number (position + length),
+         set_text_properties_1 (make_fixnum (position),
+                                make_fixnum (position + length),
                                 Qnil, buf,
                                 find_interval (tree, position));
        }
@@ -1793,7 +1793,7 @@ adjust_for_invis_intang (ptrdiff_t pos, ptrdiff_t 
test_offs, ptrdiff_t adj,
     /* POS + ADJ would be beyond the buffer bounds, so do no adjustment.  */
     return pos;
 
-  test_pos = make_number (pos + test_offs);
+  test_pos = make_fixnum (pos + test_offs);
 
   invis_propval
     = get_char_property_and_overlay (test_pos, Qinvisible, Qnil,
@@ -1806,7 +1806,7 @@ adjust_for_invis_intang (ptrdiff_t pos, ptrdiff_t 
test_offs, ptrdiff_t adj,
         such that an insertion at POS would inherit it.  */
       && (NILP (invis_overlay)
          /* Invisible property is from a text-property.  */
-         ? (text_property_stickiness (Qinvisible, make_number (pos), Qnil)
+         ? (text_property_stickiness (Qinvisible, make_fixnum (pos), Qnil)
             == (test_offs == 0 ? 1 : -1))
          /* Invisible property is from an overlay.  */
          : (test_offs == 0
@@ -1926,8 +1926,8 @@ set_point_both (ptrdiff_t charpos, ptrdiff_t bytepos)
 
          if (! NILP (intangible_propval))
            {
-             while (XINT (pos) > BEGV
-                    && EQ (Fget_char_property (make_number (XINT (pos) - 1),
+             while (XFIXNUM (pos) > BEGV
+                    && EQ (Fget_char_property (make_fixnum (XFIXNUM (pos) - 1),
                                                Qintangible, Qnil),
                            intangible_propval))
                pos = Fprevious_char_property_change (pos, Qnil);
@@ -1937,7 +1937,7 @@ set_point_both (ptrdiff_t charpos, ptrdiff_t bytepos)
                 property is `front-sticky', perturb it to be one character
                 earlier -- this ensures that point can never move to the
                 beginning of an invisible/intangible/front-sticky region.  */
-             charpos = adjust_for_invis_intang (XINT (pos), 0, -1, 0);
+             charpos = adjust_for_invis_intang (XFIXNUM (pos), 0, -1, 0);
            }
        }
       else
@@ -1954,12 +1954,12 @@ set_point_both (ptrdiff_t charpos, ptrdiff_t bytepos)
          /* If preceding char is intangible,
             skip forward over all chars with matching intangible property.  */
 
-         intangible_propval = Fget_char_property (make_number (charpos - 1),
+         intangible_propval = Fget_char_property (make_fixnum (charpos - 1),
                                                   Qintangible, Qnil);
 
          if (! NILP (intangible_propval))
            {
-             while (XINT (pos) < ZV
+             while (XFIXNUM (pos) < ZV
                     && EQ (Fget_char_property (pos, Qintangible, Qnil),
                            intangible_propval))
                pos = Fnext_char_property_change (pos, Qnil);
@@ -1969,7 +1969,7 @@ set_point_both (ptrdiff_t charpos, ptrdiff_t bytepos)
                 property is `rear-sticky', perturb it to be one character
                 later -- this ensures that point can never move to the
                 end of an invisible/intangible/rear-sticky region.  */
-             charpos = adjust_for_invis_intang (XINT (pos), -1, 1, 0);
+             charpos = adjust_for_invis_intang (XFIXNUM (pos), -1, 1, 0);
            }
        }
 
@@ -2026,18 +2026,18 @@ set_point_both (ptrdiff_t charpos, ptrdiff_t bytepos)
        enter_after = Qnil;
 
       if (! EQ (leave_before, enter_before) && !NILP (leave_before))
-       call2 (leave_before, make_number (old_position),
-              make_number (charpos));
+       call2 (leave_before, make_fixnum (old_position),
+              make_fixnum (charpos));
       if (! EQ (leave_after, enter_after) && !NILP (leave_after))
-       call2 (leave_after, make_number (old_position),
-              make_number (charpos));
+       call2 (leave_after, make_fixnum (old_position),
+              make_fixnum (charpos));
 
       if (! EQ (enter_before, leave_before) && !NILP (enter_before))
-       call2 (enter_before, make_number (old_position),
-              make_number (charpos));
+       call2 (enter_before, make_fixnum (old_position),
+              make_fixnum (charpos));
       if (! EQ (enter_after, leave_after) && !NILP (enter_after))
-       call2 (enter_after, make_number (old_position),
-              make_number (charpos));
+       call2 (enter_after, make_fixnum (old_position),
+              make_fixnum (charpos));
     }
 }
 
@@ -2055,7 +2055,7 @@ move_if_not_intangible (ptrdiff_t position)
   if (! NILP (Vinhibit_point_motion_hooks))
     /* If intangible is inhibited, always move point to POSITION.  */
     ;
-  else if (PT < position && XINT (pos) < ZV)
+  else if (PT < position && XFIXNUM (pos) < ZV)
     {
       /* We want to move forward, so check the text before POSITION.  */
 
@@ -2065,23 +2065,23 @@ move_if_not_intangible (ptrdiff_t position)
       /* If following char is intangible,
         skip back over all chars with matching intangible property.  */
       if (! NILP (intangible_propval))
-       while (XINT (pos) > BEGV
-              && EQ (Fget_char_property (make_number (XINT (pos) - 1),
+       while (XFIXNUM (pos) > BEGV
+              && EQ (Fget_char_property (make_fixnum (XFIXNUM (pos) - 1),
                                          Qintangible, Qnil),
                      intangible_propval))
          pos = Fprevious_char_property_change (pos, Qnil);
     }
-  else if (XINT (pos) > BEGV)
+  else if (XFIXNUM (pos) > BEGV)
     {
       /* We want to move backward, so check the text after POSITION.  */
 
-      intangible_propval = Fget_char_property (make_number (XINT (pos) - 1),
+      intangible_propval = Fget_char_property (make_fixnum (XFIXNUM (pos) - 1),
                                               Qintangible, Qnil);
 
       /* If following char is intangible,
         skip forward over all chars with matching intangible property.  */
       if (! NILP (intangible_propval))
-       while (XINT (pos) < ZV
+       while (XFIXNUM (pos) < ZV
               && EQ (Fget_char_property (pos, Qintangible, Qnil),
                      intangible_propval))
          pos = Fnext_char_property_change (pos, Qnil);
@@ -2096,7 +2096,7 @@ move_if_not_intangible (ptrdiff_t position)
      try moving to POSITION (which means we actually move farther
      if POSITION is inside of intangible text).  */
 
-  if (XINT (pos) != PT)
+  if (XFIXNUM (pos) != PT)
     SET_PT (position);
 }
 
diff --git a/src/json.c b/src/json.c
index afdd9a2..4e413a2 100644
--- a/src/json.c
+++ b/src/json.c
@@ -159,7 +159,12 @@ init_json_functions (void)
    than PTRDIFF_MAX.  Such objects wouldn't play well with the rest of
    Emacs's codebase, which generally uses ptrdiff_t for sizes and
    indices.  The other functions in this file also generally assume
-   that size_t values never exceed PTRDIFF_MAX.  */
+   that size_t values never exceed PTRDIFF_MAX.
+
+   In addition, we need to use a custom allocator because on
+   MS-Windows we replace malloc/free with our own functions, see
+   w32heap.c, so we must force the library to use our allocator, or
+   else we won't be able to free storage allocated by the library.  */
 
 static void *
 json_malloc (size_t size)
@@ -284,8 +289,8 @@ json_parse_error (const json_error_t *error)
 #endif
   xsignal (symbol,
            list5 (json_build_string (error->text),
-                  json_build_string (error->source), make_natnum (error->line),
-                  make_natnum (error->column), make_natnum (error->position)));
+                  json_build_string (error->source), make_fixed_natnum 
(error->line),
+                  make_fixed_natnum (error->column), make_fixed_natnum 
(error->position)));
 }
 
 static void
@@ -482,10 +487,10 @@ lisp_to_json (Lisp_Object lisp, struct json_configuration 
*conf)
     return json_check (json_false ());
   else if (EQ (lisp, Qt))
     return json_check (json_true ());
-  else if (INTEGERP (lisp))
+  else if (FIXNUMP (lisp))
     {
       CHECK_TYPE_RANGED_INTEGER (json_int_t, lisp);
-      return json_check (json_integer (XINT (lisp)));
+      return json_check (json_integer (XFIXNUM (lisp)));
     }
   else if (FLOATP (lisp))
     return json_check (json_real (XFLOAT_DATA (lisp)));
@@ -605,7 +610,7 @@ usage: (json-serialize OBJECT &rest ARGS)  */)
   char *string = json_dumps (json, JSON_COMPACT);
   if (string == NULL)
     json_out_of_memory ();
-  record_unwind_protect_ptr (free, string);
+  record_unwind_protect_ptr (json_free, string);
 
   return unbind_to (count, json_build_string (string));
 }
@@ -735,7 +740,7 @@ json_to_lisp (json_t *json, struct json_configuration *conf)
         size_t size = json_array_size (json);
         if (FIXNUM_OVERFLOW_P (size))
           xsignal0 (Qoverflow_error);
-        Lisp_Object result = Fmake_vector (make_natnum (size), Qunbound);
+        Lisp_Object result = Fmake_vector (make_fixed_natnum (size), Qunbound);
         for (ptrdiff_t i = 0; i < size; ++i)
           ASET (result, i,
                 json_to_lisp (json_array_get (json, i), conf));
@@ -755,7 +760,7 @@ json_to_lisp (json_t *json, struct json_configuration *conf)
               if (FIXNUM_OVERFLOW_P (size))
                 xsignal0 (Qoverflow_error);
               result = CALLN (Fmake_hash_table, QCtest, Qequal, QCsize,
-                              make_natnum (size));
+                              make_fixed_natnum (size));
               struct Lisp_Hash_Table *h = XHASH_TABLE (result);
               const char *key_str;
               json_t *value;
diff --git a/src/keyboard.c b/src/keyboard.c
index 7ab9a60..0b38e09 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -441,7 +441,7 @@ static bool
 echo_keystrokes_p (void)
 {
   return (FLOATP (Vecho_keystrokes) ? XFLOAT_DATA (Vecho_keystrokes) > 0.0
-         : INTEGERP (Vecho_keystrokes) ? XINT (Vecho_keystrokes) > 0
+         : FIXNUMP (Vecho_keystrokes) ? XFIXNUM (Vecho_keystrokes) > 0
           : false);
 }
 
@@ -466,8 +466,8 @@ echo_add_key (Lisp_Object c)
   /* If someone has passed us a composite event, use its head symbol.  */
   c = EVENT_HEAD (c);
 
-  if (INTEGERP (c))
-    ptr = push_key_description (XINT (c), ptr);
+  if (FIXNUMP (c))
+    ptr = push_key_description (XFIXNUM (c), ptr);
   else if (SYMBOLP (c))
     {
       Lisp_Object name = SYMBOL_NAME (c);
@@ -535,13 +535,13 @@ echo_dash (void)
     {
       Lisp_Object last_char, prev_char, idx;
 
-      idx = make_number (SCHARS (KVAR (current_kboard, echo_string)) - 2);
+      idx = make_fixnum (SCHARS (KVAR (current_kboard, echo_string)) - 2);
       prev_char = Faref (KVAR (current_kboard, echo_string), idx);
 
-      idx = make_number (SCHARS (KVAR (current_kboard, echo_string)) - 1);
+      idx = make_fixnum (SCHARS (KVAR (current_kboard, echo_string)) - 1);
       last_char = Faref (KVAR (current_kboard, echo_string), idx);
 
-      if (XINT (last_char) == '-' && XINT (prev_char) != ' ')
+      if (XFIXNUM (last_char) == '-' && XFIXNUM (prev_char) != ' ')
        return;
     }
 
@@ -643,7 +643,7 @@ echo_truncate (ptrdiff_t nchars)
   if (STRINGP (es) && SCHARS (es) > nchars)
     kset_echo_string (current_kboard,
                      Fsubstring (KVAR (current_kboard, echo_string),
-                                 make_number (0), make_number (nchars)));
+                                 make_fixnum (0), make_fixnum (nchars)));
   truncate_echo_area (nchars);
 }
 
@@ -945,7 +945,7 @@ cmd_error (Lisp_Object data)
   Vquit_flag = Qnil;
   Vinhibit_quit = Qnil;
 
-  return make_number (0);
+  return make_fixnum (0);
 }
 
 /* Take actions on handling an error.  DATA is the data that describes
@@ -1005,7 +1005,7 @@ Default value of `command-error-function'.  */)
       print_error_message (data, Qexternal_debugging_output,
                           SSDATA (context), signal);
       Fterpri (Qexternal_debugging_output, Qnil);
-      Fkill_emacs (make_number (-1));
+      Fkill_emacs (make_fixnum (-1));
     }
   else
     {
@@ -1298,7 +1298,7 @@ command_loop_1 (void)
       if (minibuf_level
          && !NILP (echo_area_buffer[0])
          && EQ (minibuf_window, echo_area_window)
-         && NUMBERP (Vminibuffer_message_timeout))
+         && FIXED_OR_FLOATP (Vminibuffer_message_timeout))
        {
          /* Bind inhibit-quit to t so that C-g gets read in
             rather than quitting back to the minibuffer.  */
@@ -1317,7 +1317,7 @@ command_loop_1 (void)
          if (!NILP (Vquit_flag))
            {
              Vquit_flag = Qnil;
-             Vunread_command_events = list1 (make_number (quit_char));
+             Vunread_command_events = list1 (make_fixnum (quit_char));
            }
        }
 
@@ -1525,7 +1525,7 @@ command_loop_1 (void)
                {
                  Lisp_Object txt
                    = call1 (Fsymbol_value (Qregion_extract_function), Qnil);
-                 if (XINT (Flength (txt)) > 0)
+                 if (XFIXNUM (Flength (txt)) > 0)
                    /* Don't set empty selections.  */
                    call2 (Qgui_set_selection, QPRIMARY, txt);
                }
@@ -1575,7 +1575,7 @@ read_menu_command (void)
 
   /* We don't want to echo the keystrokes while navigating the
      menus.  */
-  specbind (Qecho_keystrokes, make_number (0));
+  specbind (Qecho_keystrokes, make_fixnum (0));
 
   Lisp_Object keybuf[READ_KEY_ELTS];
   int i = read_key_sequence (keybuf, Qnil, false, true, true, true);
@@ -1626,7 +1626,7 @@ adjust_point_for_property (ptrdiff_t last_pt, bool 
modified)
       if (check_display
          && PT > BEGV && PT < ZV
          && !NILP (val = get_char_property_and_overlay
-                             (make_number (PT), Qdisplay, selected_window,
+                             (make_fixnum (PT), Qdisplay, selected_window,
                               &overlay))
          && display_prop_intangible_p (val, overlay, PT, PT_BYTE)
          && (!OVERLAYP (overlay)
@@ -1663,12 +1663,12 @@ adjust_point_for_property (ptrdiff_t last_pt, bool 
modified)
                    than skip both boundaries.  However, this code
                    also stops anywhere in a non-sticky text-property,
                    which breaks (e.g.) Org mode.  */
-                && (val = Fget_pos_property (make_number (end),
+                && (val = Fget_pos_property (make_fixnum (end),
                                              Qinvisible, Qnil),
                     TEXT_PROP_MEANS_INVISIBLE (val))
 #endif
                 && !NILP (val = get_char_property_and_overlay
-                          (make_number (end), Qinvisible, Qnil, &overlay))
+                          (make_fixnum (end), Qinvisible, Qnil, &overlay))
                 && (inv = TEXT_PROP_MEANS_INVISIBLE (val)))
            {
              ellipsis = ellipsis || inv > 1
@@ -1676,17 +1676,17 @@ adjust_point_for_property (ptrdiff_t last_pt, bool 
modified)
                    && (!NILP (Foverlay_get (overlay, Qafter_string))
                        || !NILP (Foverlay_get (overlay, Qbefore_string))));
              tmp = Fnext_single_char_property_change
-               (make_number (end), Qinvisible, Qnil, Qnil);
-             end = NATNUMP (tmp) ? XFASTINT (tmp) : ZV;
+               (make_fixnum (end), Qinvisible, Qnil, Qnil);
+             end = FIXNATP (tmp) ? XFIXNAT (tmp) : ZV;
            }
          while (beg > BEGV
 #if 0
-                && (val = Fget_pos_property (make_number (beg),
+                && (val = Fget_pos_property (make_fixnum (beg),
                                              Qinvisible, Qnil),
                     TEXT_PROP_MEANS_INVISIBLE (val))
 #endif
                 && !NILP (val = get_char_property_and_overlay
-                          (make_number (beg - 1), Qinvisible, Qnil, &overlay))
+                          (make_fixnum (beg - 1), Qinvisible, Qnil, &overlay))
                 && (inv = TEXT_PROP_MEANS_INVISIBLE (val)))
            {
              ellipsis = ellipsis || inv > 1
@@ -1694,8 +1694,8 @@ adjust_point_for_property (ptrdiff_t last_pt, bool 
modified)
                    && (!NILP (Foverlay_get (overlay, Qafter_string))
                        || !NILP (Foverlay_get (overlay, Qbefore_string))));
              tmp = Fprevious_single_char_property_change
-               (make_number (beg), Qinvisible, Qnil, Qnil);
-             beg = NATNUMP (tmp) ? XFASTINT (tmp) : BEGV;
+               (make_fixnum (beg), Qinvisible, Qnil, Qnil);
+             beg = FIXNATP (tmp) ? XFIXNAT (tmp) : BEGV;
            }
 
          /* Move away from the inside area.  */
@@ -1735,11 +1735,11 @@ adjust_point_for_property (ptrdiff_t last_pt, bool 
modified)
                   to the other end would mean moving backwards and thus
                   could lead to an infinite loop.  */
                ;
-             else if (val = Fget_pos_property (make_number (PT),
+             else if (val = Fget_pos_property (make_fixnum (PT),
                                                Qinvisible, Qnil),
                       TEXT_PROP_MEANS_INVISIBLE (val)
                       && (val = (Fget_pos_property
-                                 (make_number (PT == beg ? end : beg),
+                                 (make_fixnum (PT == beg ? end : beg),
                                   Qinvisible, Qnil)),
                           !TEXT_PROP_MEANS_INVISIBLE (val)))
                (check_composition = check_display = true,
@@ -1962,7 +1962,7 @@ bind_polling_period (int n)
 
   stop_other_atimers (poll_timer);
   stop_polling ();
-  specbind (Qpolling_period, make_number (new));
+  specbind (Qpolling_period, make_fixnum (new));
   /* Start a new alarm with the new period.  */
   start_polling ();
 #endif
@@ -2141,25 +2141,25 @@ read_event_from_main_queue (struct timespec *end_time,
       if (single_kboard)
         goto start;
       current_kboard = kb;
-      return make_number (-2);
+      return make_fixnum (-2);
     }
 
   /* Terminate Emacs in batch mode if at eof.  */
-  if (noninteractive && INTEGERP (c) && XINT (c) < 0)
-    Fkill_emacs (make_number (1));
+  if (noninteractive && FIXNUMP (c) && XFIXNUM (c) < 0)
+    Fkill_emacs (make_fixnum (1));
 
-  if (INTEGERP (c))
+  if (FIXNUMP (c))
     {
       /* Add in any extra modifiers, where appropriate.  */
       if ((extra_keyboard_modifiers & CHAR_CTL)
          || ((extra_keyboard_modifiers & 0177) < ' '
              && (extra_keyboard_modifiers & 0177) != 0))
-       XSETINT (c, make_ctrl_char (XINT (c)));
+       XSETINT (c, make_ctrl_char (XFIXNUM (c)));
 
       /* Transfer any other modifier bits directly from
         extra_keyboard_modifiers to c.  Ignore the actual character code
         in the low 16 bits of extra_keyboard_modifiers.  */
-      XSETINT (c, XINT (c) | (extra_keyboard_modifiers & ~0xff7f & ~CHAR_CTL));
+      XSETINT (c, XFIXNUM (c) | (extra_keyboard_modifiers & ~0xff7f & 
~CHAR_CTL));
     }
 
   return c;
@@ -2207,8 +2207,8 @@ read_decoded_event_from_main_queue (struct timespec 
*end_time,
          int meta_key = terminal->display_info.tty->meta_key;
          eassert (n < MAX_ENCODED_BYTES);
          events[n++] = nextevt;
-         if (NATNUMP (nextevt)
-             && XINT (nextevt) < (meta_key == 1 ? 0x80 : 0x100))
+         if (FIXNATP (nextevt)
+             && XFIXNUM (nextevt) < (meta_key == 1 ? 0x80 : 0x100))
            { /* An encoded byte sequence, let's try to decode it.  */
              struct coding_system *coding
                = TERMINAL_KEYBOARD_CODING (terminal);
@@ -2218,7 +2218,7 @@ read_decoded_event_from_main_queue (struct timespec 
*end_time,
                  int i;
                  if (meta_key != 2)
                    for (i = 0; i < n; i++)
-                     events[i] = make_number (XINT (events[i]) & ~0x80);
+                     events[i] = make_fixnum (XFIXNUM (events[i]) & ~0x80);
                }
              else
                {
@@ -2226,7 +2226,7 @@ read_decoded_event_from_main_queue (struct timespec 
*end_time,
                  unsigned char dest[MAX_ENCODED_BYTES * MAX_MULTIBYTE_LENGTH];
                  int i;
                  for (i = 0; i < n; i++)
-                   src[i] = XINT (events[i]);
+                   src[i] = XFIXNUM (events[i]);
                  if (meta_key != 2)
                    for (i = 0; i < n; i++)
                      src[i] &= ~0x80;
@@ -2245,7 +2245,7 @@ read_decoded_event_from_main_queue (struct timespec 
*end_time,
                      eassert (coding->carryover_bytes == 0);
                      n = 0;
                      while (n < coding->produced_char)
-                       events[n++] = make_number (STRING_CHAR_ADVANCE (p));
+                       events[n++] = make_fixnum (STRING_CHAR_ADVANCE (p));
                    }
                }
            }
@@ -2323,7 +2323,7 @@ read_char (int commandflag, Lisp_Object map,
       /* Undo what read_char_x_menu_prompt did when it unread
         additional keys returned by Fx_popup_menu.  */
       if (CONSP (c)
-         && (SYMBOLP (XCAR (c)) || INTEGERP (XCAR (c)))
+         && (SYMBOLP (XCAR (c)) || FIXNUMP (XCAR (c)))
          && NILP (XCDR (c)))
        c = XCAR (c);
 
@@ -2353,7 +2353,7 @@ read_char (int commandflag, Lisp_Object map,
         additional keys returned by Fx_popup_menu.  */
       if (CONSP (c)
          && EQ (XCDR (c), Qdisabled)
-         && (SYMBOLP (XCAR (c)) || INTEGERP (XCAR (c))))
+         && (SYMBOLP (XCAR (c)) || FIXNUMP (XCAR (c))))
        {
          was_disabled = true;
          c = XCAR (c);
@@ -2378,7 +2378,7 @@ read_char (int commandflag, Lisp_Object map,
       /* Undo what read_char_x_menu_prompt did when it unread
         additional keys returned by Fx_popup_menu.  */
       if (CONSP (c)
-         && (SYMBOLP (XCAR (c)) || INTEGERP (XCAR (c)))
+         && (SYMBOLP (XCAR (c)) || FIXNUMP (XCAR (c)))
          && NILP (XCDR (c)))
        c = XCAR (c);
       reread = true;
@@ -2403,16 +2403,16 @@ read_char (int commandflag, Lisp_Object map,
         Also, some things replace the macro with t
         to force an early exit.  */
       if (EQ (Vexecuting_kbd_macro, Qt)
-         || executing_kbd_macro_index >= XFASTINT (Flength 
(Vexecuting_kbd_macro)))
+         || executing_kbd_macro_index >= XFIXNAT (Flength 
(Vexecuting_kbd_macro)))
        {
          XSETINT (c, -1);
          goto exit;
        }
 
-      c = Faref (Vexecuting_kbd_macro, make_number 
(executing_kbd_macro_index));
+      c = Faref (Vexecuting_kbd_macro, make_fixnum 
(executing_kbd_macro_index));
       if (STRINGP (Vexecuting_kbd_macro)
-         && (XFASTINT (c) & 0x80) && (XFASTINT (c) <= 0xff))
-       XSETFASTINT (c, CHAR_META | (XFASTINT (c) & ~0x80));
+         && (XFIXNAT (c) & 0x80) && (XFIXNAT (c) <= 0xff))
+       XSETFASTINT (c, CHAR_META | (XFIXNAT (c) & ~0x80));
 
       executing_kbd_macro_index++;
 
@@ -2516,7 +2516,7 @@ read_char (int commandflag, Lisp_Object map,
     {
       c = read_char_minibuf_menu_prompt (commandflag, map);
 
-      if (INTEGERP (c) && XINT (c) == -2)
+      if (FIXNUMP (c) && XFIXNUM (c) == -2)
         return c;               /* wrong_kboard_jmpbuf */
 
       if (! NILP (c))
@@ -2567,7 +2567,7 @@ read_char (int commandflag, Lisp_Object map,
              XSETCDR (last, list1 (c));
            kb->kbd_queue_has_data = true;
            current_kboard = kb;
-            return make_number (-2); /* wrong_kboard_jmpbuf */
+            return make_fixnum (-2); /* wrong_kboard_jmpbuf */
          }
       }
       goto non_reread;
@@ -2626,7 +2626,7 @@ read_char (int commandflag, Lisp_Object map,
       && num_nonmacro_input_events - last_auto_save > max (auto_save_interval, 
20)
       && !detect_input_pending_run_timers (0))
     {
-      Fdo_auto_save (Qnil, Qnil);
+      Fdo_auto_save (auto_save_no_message ? Qt : Qnil, Qnil);
       /* Hooks can actually change some buffers in auto save.  */
       redisplay ();
     }
@@ -2675,23 +2675,23 @@ read_char (int commandflag, Lisp_Object map,
       /* Auto save if enough time goes by without input.  */
       if (commandflag != 0 && commandflag != -2
          && num_nonmacro_input_events > last_auto_save
-         && INTEGERP (Vauto_save_timeout)
-         && XINT (Vauto_save_timeout) > 0)
+         && FIXNUMP (Vauto_save_timeout)
+         && XFIXNUM (Vauto_save_timeout) > 0)
        {
          Lisp_Object tem0;
-         EMACS_INT timeout = XFASTINT (Vauto_save_timeout);
+         EMACS_INT timeout = XFIXNAT (Vauto_save_timeout);
 
          timeout = min (timeout, MOST_POSITIVE_FIXNUM / delay_level * 4);
          timeout = delay_level * timeout / 4;
          save_getcjmp (save_jump);
          restore_getcjmp (local_getcjmp);
-         tem0 = sit_for (make_number (timeout), 1, 1);
+         tem0 = sit_for (make_fixnum (timeout), 1, 1);
          restore_getcjmp (save_jump);
 
          if (EQ (tem0, Qt)
              && ! CONSP (Vunread_command_events))
            {
-             Fdo_auto_save (Qnil, Qnil);
+             Fdo_auto_save (auto_save_no_message ? Qt : Qnil, Qnil);
              redisplay ();
            }
        }
@@ -2709,7 +2709,7 @@ read_char (int commandflag, Lisp_Object map,
      interpret the next key sequence using the wrong translation
      tables and function keymaps.  */
   if (NILP (c) && current_kboard != orig_kboard)
-    return make_number (-2);  /* wrong_kboard_jmpbuf */
+    return make_fixnum (-2);  /* wrong_kboard_jmpbuf */
 
   /* If this has become non-nil here, it has been set by a timer
      or sentinel or filter.  */
@@ -2760,7 +2760,7 @@ read_char (int commandflag, Lisp_Object map,
        if (kb->kbd_queue_has_data)
          {
            current_kboard = kb;
-            return make_number (-2); /* wrong_kboard_jmpbuf */
+            return make_fixnum (-2); /* wrong_kboard_jmpbuf */
          }
     }
 
@@ -2778,7 +2778,7 @@ read_char (int commandflag, Lisp_Object map,
           goto exit;
         }
 
-      if (EQ (c, make_number (-2)))
+      if (EQ (c, make_fixnum (-2)))
        return c;
 
       if (CONSP (c) && EQ (XCAR (c), Qt))
@@ -2841,7 +2841,7 @@ read_char (int commandflag, Lisp_Object map,
          /* The command may have changed the keymaps.  Pretend there
             is input in another keyboard and return.  This will
             recalculate keymaps.  */
-         c = make_number (-2);
+         c = make_fixnum (-2);
          goto exit;
        }
       else
@@ -2849,18 +2849,18 @@ read_char (int commandflag, Lisp_Object map,
     }
 
   /* Handle things that only apply to characters.  */
-  if (INTEGERP (c))
+  if (FIXNUMP (c))
     {
       /* If kbd_buffer_get_event gave us an EOF, return that.  */
-      if (XINT (c) == -1)
+      if (XFIXNUM (c) == -1)
        goto exit;
 
       if ((STRINGP (KVAR (current_kboard, Vkeyboard_translate_table))
-          && UNSIGNED_CMP (XFASTINT (c), <,
+          && UNSIGNED_CMP (XFIXNAT (c), <,
                            SCHARS (KVAR (current_kboard,
                                          Vkeyboard_translate_table))))
          || (VECTORP (KVAR (current_kboard, Vkeyboard_translate_table))
-             && UNSIGNED_CMP (XFASTINT (c), <,
+             && UNSIGNED_CMP (XFIXNAT (c), <,
                               ASIZE (KVAR (current_kboard,
                                            Vkeyboard_translate_table))))
          || (CHAR_TABLE_P (KVAR (current_kboard, Vkeyboard_translate_table))
@@ -2908,9 +2908,9 @@ read_char (int commandflag, Lisp_Object map,
   /* Wipe the echo area.
      But first, if we are about to use an input method,
      save the echo area contents for it to refer to.  */
-  if (INTEGERP (c)
+  if (FIXNUMP (c)
       && ! NILP (Vinput_method_function)
-      && ' ' <= XINT (c) && XINT (c) < 256 && XINT (c) != 127)
+      && ' ' <= XFIXNUM (c) && XFIXNUM (c) < 256 && XFIXNUM (c) != 127)
     {
       previous_echo_area_message = Fcurrent_message ();
       Vinput_method_previous_message = previous_echo_area_message;
@@ -2935,12 +2935,12 @@ read_char (int commandflag, Lisp_Object map,
  reread_for_input_method:
  from_macro:
   /* Pass this to the input method, if appropriate.  */
-  if (INTEGERP (c)
+  if (FIXNUMP (c)
       && ! NILP (Vinput_method_function)
       /* Don't run the input method within a key sequence,
         after the first event of the key sequence.  */
       && NILP (prev_event)
-      && ' ' <= XINT (c) && XINT (c) < 256 && XINT (c) != 127)
+      && ' ' <= XFIXNUM (c) && XFIXNUM (c) < 256 && XFIXNUM (c) != 127)
     {
       Lisp_Object keys;
       ptrdiff_t key_count;
@@ -3091,7 +3091,7 @@ read_char (int commandflag, Lisp_Object map,
       unbind_to (count, Qnil);
 
       redisplay ();
-      if (EQ (c, make_number (040)))
+      if (EQ (c, make_fixnum (040)))
        {
          cancel_echoing ();
          do
@@ -3263,12 +3263,12 @@ record_char (Lisp_Object c)
   if (dribble && NILP (Vexecuting_kbd_macro))
     {
       block_input ();
-      if (INTEGERP (c))
+      if (FIXNUMP (c))
        {
-         if (XUINT (c) < 0x100)
-           putc_unlocked (XUINT (c), dribble);
+         if (XUFIXNUM (c) < 0x100)
+           putc_unlocked (XUFIXNUM (c), dribble);
          else
-           fprintf (dribble, " 0x%"pI"x", XUINT (c));
+           fprintf (dribble, " 0x%"pI"x", XUFIXNUM (c));
        }
       else
        {
@@ -3460,7 +3460,7 @@ kbd_buffer_store_buffered_event (union 
buffered_input_event *event,
            {
              kset_kbd_queue
                (kb, list2 (make_lispy_switch_frame (event->ie.frame_or_window),
-                           make_number (c)));
+                           make_fixnum (c)));
              kb->kbd_queue_has_data = true;
              union buffered_input_event *sp;
              for (sp = kbd_fetch_ptr; sp != kbd_store_ptr; sp++)
@@ -4160,7 +4160,7 @@ decode_timer (Lisp_Object timer, struct timespec *result)
   vec = XVECTOR (timer)->contents;
   if (! NILP (vec[0]))
     return 0;
-  if (! INTEGERP (vec[2]))
+  if (! FIXNUMP (vec[2]))
     return false;
 
   struct lisp_time t;
@@ -5013,7 +5013,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, 
Lisp_Object y,
   int xret = 0, yret = 0;
   /* The window or frame under frame pixel coordinates (x,y)  */
   Lisp_Object window_or_frame = f
-    ? window_from_coordinates (f, XINT (x), XINT (y), &part, 0)
+    ? window_from_coordinates (f, XFIXNUM (x), XFIXNUM (y), &part, 0)
     : Qnil;
 
   if (WINDOWP (window_or_frame))
@@ -5028,15 +5028,15 @@ make_lispy_position (struct frame *f, Lisp_Object x, 
Lisp_Object y,
       Lisp_Object object = Qnil;
 
       /* Pixel coordinates relative to the window corner.  */
-      int wx = XINT (x) - WINDOW_LEFT_EDGE_X (w);
-      int wy = XINT (y) - WINDOW_TOP_EDGE_Y (w);
+      int wx = XFIXNUM (x) - WINDOW_LEFT_EDGE_X (w);
+      int wy = XFIXNUM (y) - WINDOW_TOP_EDGE_Y (w);
 
       /* For text area clicks, return X, Y relative to the corner of
         this text area.  Note that dX, dY etc are set below, by
         buffer_posn_from_coords.  */
       if (part == ON_TEXT)
        {
-         xret = XINT (x) - window_box_left (w, TEXT_AREA);
+         xret = XFIXNUM (x) - window_box_left (w, TEXT_AREA);
          yret = wy - WINDOW_HEADER_LINE_HEIGHT (w);
        }
       /* For mode line and header line clicks, return X, Y relative to
@@ -5055,7 +5055,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, 
Lisp_Object y,
          string = mode_line_string (w, part, &col, &row, &charpos,
                                     &object, &dx, &dy, &width, &height);
          if (STRINGP (string))
-           string_info = Fcons (string, make_number (charpos));
+           string_info = Fcons (string, make_fixnum (charpos));
          textpos = -1;
 
          xret = wx;
@@ -5074,7 +5074,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, 
Lisp_Object y,
          string = marginal_area_string (w, part, &col, &row, &charpos,
                                         &object, &dx, &dy, &width, &height);
          if (STRINGP (string))
-           string_info = Fcons (string, make_number (charpos));
+           string_info = Fcons (string, make_fixnum (charpos));
          xret = wx;
          yret = wy - WINDOW_HEADER_LINE_HEIGHT (w);
        }
@@ -5156,7 +5156,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, 
Lisp_Object y,
            : (part == ON_RIGHT_FRINGE || part == ON_RIGHT_MARGIN
               || (part == ON_VERTICAL_SCROLL_BAR
                   && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)))
-           ? (XINT (x) - window_box_left (w, TEXT_AREA))
+           ? (XFIXNUM (x) - window_box_left (w, TEXT_AREA))
            : 0;
          int y2 = wy;
 
@@ -5173,10 +5173,10 @@ make_lispy_position (struct frame *f, Lisp_Object x, 
Lisp_Object y,
 
          if (NILP (posn))
            {
-             posn = make_number (textpos);
+             posn = make_fixnum (textpos);
              if (STRINGP (string2))
                string_info = Fcons (string2,
-                                    make_number (CHARPOS (p.string_pos)));
+                                    make_fixnum (CHARPOS (p.string_pos)));
            }
          if (NILP (object))
            object = object2;
@@ -5198,14 +5198,14 @@ make_lispy_position (struct frame *f, Lisp_Object x, 
Lisp_Object y,
       /* Object info.  */
       extra_info
        = list3 (object,
-                Fcons (make_number (dx), make_number (dy)),
-                Fcons (make_number (width), make_number (height)));
+                Fcons (make_fixnum (dx), make_fixnum (dy)),
+                Fcons (make_fixnum (width), make_fixnum (height)));
 
       /* String info.  */
       extra_info = Fcons (string_info,
-                         Fcons (textpos < 0 ? Qnil : make_number (textpos),
-                                Fcons (Fcons (make_number (col),
-                                              make_number (row)),
+                         Fcons (textpos < 0 ? Qnil : make_fixnum (textpos),
+                                Fcons (Fcons (make_fixnum (col),
+                                              make_fixnum (row)),
                                        extra_info)));
     }
 
@@ -5214,8 +5214,8 @@ make_lispy_position (struct frame *f, Lisp_Object x, 
Lisp_Object y,
     {
       /* Return mouse pixel coordinates here.  */
       XSETFRAME (window_or_frame, f);
-      xret = XINT (x);
-      yret = XINT (y);
+      xret = XFIXNUM (x);
+      yret = XFIXNUM (y);
 
       if (FRAME_LIVE_P (f)
          && FRAME_INTERNAL_BORDER_WIDTH (f) > 0
@@ -5234,9 +5234,9 @@ make_lispy_position (struct frame *f, Lisp_Object x, 
Lisp_Object y,
 
   return Fcons (window_or_frame,
                Fcons (posn,
-                      Fcons (Fcons (make_number (xret),
-                                    make_number (yret)),
-                             Fcons (make_number (t),
+                      Fcons (Fcons (make_fixnum (xret),
+                                    make_fixnum (yret)),
+                             Fcons (make_fixnum (t),
                                     extra_info))));
 }
 
@@ -5261,7 +5261,7 @@ static Lisp_Object
 make_scroll_bar_position (struct input_event *ev, Lisp_Object type)
 {
   return list5 (ev->frame_or_window, type, Fcons (ev->x, ev->y),
-               make_number (ev->timestamp),
+               make_fixnum (ev->timestamp),
                builtin_lisp_symbol (scroll_bar_parts[ev->part]));
 }
 
@@ -5322,7 +5322,7 @@ make_lispy_event (struct input_event *event)
        Lisp_Object frame = event->frame_or_window;
        Lisp_Object object = event->arg;
        Lisp_Object position
-          = make_number (Time_to_position (event->timestamp));
+          = make_fixnum (Time_to_position (event->timestamp));
        Lisp_Object window = event->x;
        Lisp_Object help = event->y;
        clear_event (event);
@@ -5478,8 +5478,8 @@ make_lispy_event (struct input_event *event)
       /* Make an event (language-change FRAME CODEPAGE LANGUAGE-ID).  */
       return list4 (Qlanguage_change,
                    event->frame_or_window,
-                   make_number (event->code),
-                   make_number (event->modifiers));
+                   make_fixnum (event->code),
+                   make_fixnum (event->modifiers));
 
     case MULTIMEDIA_KEY_EVENT:
       if (event->code < ARRAYELTS (lispy_multimedia_keys)
@@ -5534,7 +5534,7 @@ make_lispy_event (struct input_event *event)
               in a menu (non-toolkit version).  */
            if (!toolkit_menubar_in_use (f))
              {
-               pixel_to_glyph_coords (f, XINT (event->x), XINT (event->y),
+               pixel_to_glyph_coords (f, XFIXNUM (event->x), XFIXNUM 
(event->y),
                                       &column, &row, NULL, 1);
 
                /* In the non-toolkit version, clicks on the menu bar
@@ -5559,8 +5559,8 @@ make_lispy_event (struct input_event *event)
                        pos = AREF (items, i + 3);
                        if (NILP (string))
                          break;
-                       if (column >= XINT (pos)
-                           && column < XINT (pos) + SCHARS (string))
+                       if (column >= XFIXNUM (pos)
+                           && column < XFIXNUM (pos) + SCHARS (string))
                          {
                            item = AREF (items, i);
                            break;
@@ -5573,7 +5573,7 @@ make_lispy_event (struct input_event *event)
                    position = list4 (event->frame_or_window,
                                      Qmenu_bar,
                                      Fcons (event->x, event->y),
-                                     make_number (event->timestamp));
+                                     make_fixnum (event->timestamp));
 
                    return list2 (item, position);
                  }
@@ -5620,18 +5620,18 @@ make_lispy_event (struct input_event *event)
            fuzz = double_click_fuzz / 8;
 
          is_double = (button == last_mouse_button
-                      && (eabs (XINT (event->x) - last_mouse_x) <= fuzz)
-                      && (eabs (XINT (event->y) - last_mouse_y) <= fuzz)
+                      && (eabs (XFIXNUM (event->x) - last_mouse_x) <= fuzz)
+                      && (eabs (XFIXNUM (event->y) - last_mouse_y) <= fuzz)
                       && button_down_time != 0
                       && (EQ (Vdouble_click_time, Qt)
-                          || (NATNUMP (Vdouble_click_time)
+                          || (FIXNATP (Vdouble_click_time)
                               && (event->timestamp - button_down_time
-                                  < XFASTINT (Vdouble_click_time)))));
+                                  < XFIXNAT (Vdouble_click_time)))));
        }
 
        last_mouse_button = button;
-       last_mouse_x = XINT (event->x);
-       last_mouse_y = XINT (event->y);
+       last_mouse_x = XFIXNUM (event->x);
+       last_mouse_y = XFIXNUM (event->y);
 
        /* If this is a button press, squirrel away the location, so
            we can decide later whether it was a click or a drag.  */
@@ -5676,10 +5676,10 @@ make_lispy_event (struct input_event *event)
                new_down = Fcar (Fcdr (Fcdr (position)));
 
                if (CONSP (down)
-                   && INTEGERP (XCAR (down)) && INTEGERP (XCDR (down)))
+                   && FIXNUMP (XCAR (down)) && FIXNUMP (XCDR (down)))
                  {
-                   xdiff = XINT (XCAR (new_down)) - XINT (XCAR (down));
-                   ydiff = XINT (XCDR (new_down)) - XINT (XCDR (down));
+                   xdiff = XFIXNUM (XCAR (new_down)) - XFIXNUM (XCAR (down));
+                   ydiff = XFIXNUM (XCDR (new_down)) - XFIXNUM (XCDR (down));
                  }
 
                if (ignore_mouse_drag_p)
@@ -5734,7 +5734,7 @@ make_lispy_event (struct input_event *event)
          if (event->modifiers & drag_modifier)
            return list3 (head, start_pos, position);
          else if (event->modifiers & (double_modifier | triple_modifier))
-           return list3 (head, position, make_number (double_click_count));
+           return list3 (head, position, make_fixnum (double_click_count));
          else
            return list2 (head, position);
        }
@@ -5798,13 +5798,13 @@ make_lispy_event (struct input_event *event)
             symbol_num += 2;
 
          is_double = (last_mouse_button == - (1 + symbol_num)
-                      && (eabs (XINT (event->x) - last_mouse_x) <= fuzz)
-                      && (eabs (XINT (event->y) - last_mouse_y) <= fuzz)
+                      && (eabs (XFIXNUM (event->x) - last_mouse_x) <= fuzz)
+                      && (eabs (XFIXNUM (event->y) - last_mouse_y) <= fuzz)
                       && button_down_time != 0
                       && (EQ (Vdouble_click_time, Qt)
-                          || (NATNUMP (Vdouble_click_time)
+                          || (FIXNATP (Vdouble_click_time)
                               && (event->timestamp - button_down_time
-                                  < XFASTINT (Vdouble_click_time)))));
+                                  < XFIXNAT (Vdouble_click_time)))));
          if (is_double)
            {
              double_click_count++;
@@ -5821,8 +5821,8 @@ make_lispy_event (struct input_event *event)
          button_down_time = event->timestamp;
          /* Use a negative value to distinguish wheel from mouse button.  */
          last_mouse_button = - (1 + symbol_num);
-         last_mouse_x = XINT (event->x);
-         last_mouse_y = XINT (event->y);
+         last_mouse_x = XFIXNUM (event->x);
+         last_mouse_y = XFIXNUM (event->y);
 
          /* Get the symbol we should use for the wheel event.  */
          head = modify_event_symbol (symbol_num,
@@ -5834,11 +5834,11 @@ make_lispy_event (struct input_event *event)
                                      ASIZE (wheel_syms));
        }
 
-        if (NUMBERP (event->arg))
-          return list4 (head, position, make_number (double_click_count),
+        if (FIXED_OR_FLOATP (event->arg))
+          return list4 (head, position, make_fixnum (double_click_count),
                         event->arg);
        else if (event->modifiers & (double_modifier | triple_modifier))
-         return list3 (head, position, make_number (double_click_count));
+         return list3 (head, position, make_fixnum (double_click_count));
        else
          return list2 (head, position);
       }
@@ -6024,7 +6024,7 @@ make_lispy_movement (struct frame *frame, Lisp_Object 
bar_window, enum scroll_ba
                    list5 (bar_window,
                           Qvertical_scroll_bar,
                           Fcons (x, y),
-                          make_number (t),
+                          make_fixnum (t),
                           part_sym));
     }
   /* Or is it an ordinary mouse movement?  */
@@ -6264,15 +6264,15 @@ lispy_modifier_list (int modifiers)
    SYMBOL's Qevent_symbol_element_mask property, and maintains the
    Qevent_symbol_elements property.  */
 
-#define KEY_TO_CHAR(k) (XINT (k) & ((1 << CHARACTERBITS) - 1))
+#define KEY_TO_CHAR(k) (XFIXNUM (k) & ((1 << CHARACTERBITS) - 1))
 
 Lisp_Object
 parse_modifiers (Lisp_Object symbol)
 {
   Lisp_Object elements;
 
-  if (INTEGERP (symbol))
-    return list2i (KEY_TO_CHAR (symbol), XINT (symbol) & CHAR_MODIFIER_MASK);
+  if (FIXNUMP (symbol))
+    return list2i (KEY_TO_CHAR (symbol), XFIXNUM (symbol) & 
CHAR_MODIFIER_MASK);
   else if (!SYMBOLP (symbol))
     return Qnil;
 
@@ -6339,8 +6339,8 @@ apply_modifiers (int modifiers, Lisp_Object base)
   /* Mask out upper bits.  We don't know where this value's been.  */
   modifiers &= INTMASK;
 
-  if (INTEGERP (base))
-    return make_number (XINT (base) | modifiers);
+  if (FIXNUMP (base))
+    return make_fixnum (XFIXNUM (base) | modifiers);
 
   /* The click modifier never figures into cache indices.  */
   cache = Fget (base, Qmodifier_cache);
@@ -6408,7 +6408,7 @@ reorder_modifiers (Lisp_Object symbol)
   Lisp_Object parsed;
 
   parsed = parse_modifiers (symbol);
-  return apply_modifiers (XFASTINT (XCAR (XCDR (parsed))),
+  return apply_modifiers (XFIXNAT (XCAR (XCDR (parsed))),
                          XCAR (parsed));
 }
 
@@ -6495,7 +6495,7 @@ modify_event_symbol (ptrdiff_t symbol_num, int modifiers, 
Lisp_Object symbol_kin
          USE_SAFE_ALLOCA;
          buf = SAFE_ALLOCA (len);
          esprintf (buf, "%s-%"pI"d", SDATA (name_alist_or_stem),
-                   XINT (symbol_int) + 1);
+                   XFIXNUM (symbol_int) + 1);
          value = intern (buf);
          SAFE_FREE ();
        }
@@ -6578,22 +6578,22 @@ has the same base event type and all the specified 
modifiers.  */)
   if (SYMBOLP (base) && SCHARS (SYMBOL_NAME (base)) == 1)
     XSETINT (base, SREF (SYMBOL_NAME (base), 0));
 
-  if (INTEGERP (base))
+  if (FIXNUMP (base))
     {
       /* Turn (shift a) into A.  */
       if ((modifiers & shift_modifier) != 0
-         && (XINT (base) >= 'a' && XINT (base) <= 'z'))
+         && (XFIXNUM (base) >= 'a' && XFIXNUM (base) <= 'z'))
        {
-         XSETINT (base, XINT (base) - ('a' - 'A'));
+         XSETINT (base, XFIXNUM (base) - ('a' - 'A'));
          modifiers &= ~shift_modifier;
        }
 
       /* Turn (control a) into C-a.  */
       if (modifiers & ctrl_modifier)
-       return make_number ((modifiers & ~ctrl_modifier)
-                           | make_ctrl_char (XINT (base)));
+       return make_fixnum ((modifiers & ~ctrl_modifier)
+                           | make_ctrl_char (XFIXNUM (base)));
       else
-       return make_number (modifiers | XINT (base));
+       return make_fixnum (modifiers | XFIXNUM (base));
     }
   else if (SYMBOLP (base))
     return apply_modifiers (modifiers, base);
@@ -6736,7 +6736,7 @@ lucid_event_type_list_p (Lisp_Object object)
     {
       Lisp_Object elt;
       elt = XCAR (tail);
-      if (! (INTEGERP (elt) || SYMBOLP (elt)))
+      if (! (FIXNUMP (elt) || SYMBOLP (elt)))
        return 0;
     }
 
@@ -7385,7 +7385,7 @@ menu_bar_items (Lisp_Object old)
   if (!NILP (old))
     menu_bar_items_vector = old;
   else
-    menu_bar_items_vector = Fmake_vector (make_number (24), Qnil);
+    menu_bar_items_vector = Fmake_vector (make_fixnum (24), Qnil);
   menu_bar_items_index = 0;
 
   /* Build our list of keymaps.
@@ -7557,7 +7557,7 @@ menu_bar_item (Lisp_Object key, Lisp_Object item, 
Lisp_Object dummy1, void *dumm
       ASET (menu_bar_items_vector, i,
            AREF (item_properties, ITEM_PROPERTY_NAME)); i++;
       ASET (menu_bar_items_vector, i, list1 (item)); i++;
-      ASET (menu_bar_items_vector, i, make_number (0)); i++;
+      ASET (menu_bar_items_vector, i, make_fixnum (0)); i++;
       menu_bar_items_index = i;
     }
   /* We did find an item for this KEY.  Add ITEM to its list of maps.  */
@@ -7629,7 +7629,7 @@ parse_menu_item (Lisp_Object item, int inmenubar)
   /* Create item_properties vector if necessary.  */
   if (NILP (item_properties))
     item_properties
-      = Fmake_vector (make_number (ITEM_PROPERTY_ENABLE + 1), Qnil);
+      = Fmake_vector (make_fixnum (ITEM_PROPERTY_ENABLE + 1), Qnil);
 
   /* Initialize optional entries.  */
   for (i = ITEM_PROPERTY_DEF; i < ITEM_PROPERTY_ENABLE; i++)
@@ -8124,7 +8124,7 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
     }
   else
     tool_bar_item_properties
-      = Fmake_vector (make_number (TOOL_BAR_ITEM_NSLOTS), Qnil);
+      = Fmake_vector (make_fixnum (TOOL_BAR_ITEM_NSLOTS), Qnil);
 
   /* Set defaults.  */
   set_prop (TOOL_BAR_ITEM_KEY, key);
@@ -8319,7 +8319,7 @@ init_tool_bar_items (Lisp_Object reuse)
   if (VECTORP (reuse))
     tool_bar_items_vector = reuse;
   else
-    tool_bar_items_vector = Fmake_vector (make_number (64), Qnil);
+    tool_bar_items_vector = Fmake_vector (make_fixnum (64), Qnil);
   ntool_bar_items = 0;
 }
 
@@ -8409,7 +8409,7 @@ read_char_x_menu_prompt (Lisp_Object map,
            {
              record_menu_key (XCAR (tem));
              if (SYMBOLP (XCAR (tem))
-                 || INTEGERP (XCAR (tem)))
+                 || FIXNUMP (XCAR (tem)))
                XSETCAR (tem, Fcons (XCAR (tem), Qdisabled));
            }
 
@@ -8520,7 +8520,7 @@ read_char_minibuf_menu_prompt (int commandflag,
                }
 
              /* Ignore the element if it has no prompt string.  */
-             if (INTEGERP (event) && parse_menu_item (elt, -1))
+             if (FIXNUMP (event) && parse_menu_item (elt, -1))
                {
                  /* True if the char to type matches the string.  */
                  bool char_matches;
@@ -8531,8 +8531,8 @@ read_char_minibuf_menu_prompt (int commandflag,
 
                  upcased_event = Fupcase (event);
                  downcased_event = Fdowncase (event);
-                 char_matches = (XINT (upcased_event) == SREF (s, 0)
-                                 || XINT (downcased_event) == SREF (s, 0));
+                 char_matches = (XFIXNUM (upcased_event) == SREF (s, 0)
+                                 || XFIXNUM (downcased_event) == SREF (s, 0));
                  if (! char_matches)
                    desc = Fsingle_key_description (event, Qnil);
 
@@ -8588,8 +8588,8 @@ read_char_minibuf_menu_prompt (int commandflag,
                          /* Add as much of string as fits.  */
                          thiswidth = min (SCHARS (desc), width - i);
                          menu_strings
-                           = Fcons (Fsubstring (desc, make_number (0),
-                                                make_number (thiswidth)),
+                           = Fcons (Fsubstring (desc, make_fixnum (0),
+                                                make_fixnum (thiswidth)),
                                     menu_strings);
                          i += thiswidth;
                          PUSH_C_STR (" = ", menu_strings);
@@ -8599,8 +8599,8 @@ read_char_minibuf_menu_prompt (int commandflag,
                      /* Add as much of string as fits.  */
                      thiswidth = min (SCHARS (s), width - i);
                      menu_strings
-                       = Fcons (Fsubstring (s, make_number (0),
-                                            make_number (thiswidth)),
+                       = Fcons (Fsubstring (s, make_fixnum (0),
+                                            make_fixnum (thiswidth)),
                                 menu_strings);
                      i += thiswidth;
                    }
@@ -8637,10 +8637,10 @@ read_char_minibuf_menu_prompt (int commandflag,
       while (BUFFERP (obj));
       kset_defining_kbd_macro (current_kboard, orig_defn_macro);
 
-      if (!INTEGERP (obj) || XINT (obj) == -2
+      if (!FIXNUMP (obj) || XFIXNUM (obj) == -2
          || (! EQ (obj, menu_prompt_more_char)
-             && (!INTEGERP (menu_prompt_more_char)
-                 || ! EQ (obj, make_number (Ctl (XINT 
(menu_prompt_more_char)))))))
+             && (!FIXNUMP (menu_prompt_more_char)
+                 || ! EQ (obj, make_fixnum (Ctl (XFIXNUM 
(menu_prompt_more_char)))))))
        {
          if (!NILP (KVAR (current_kboard, defining_kbd_macro)))
            store_kbd_macro_char (obj);
@@ -8761,7 +8761,7 @@ keyremap_step (Lisp_Object *keybuf, volatile keyremap 
*fkey,
      the binding and restart with fkey->start at the end.  */
   if ((VECTORP (next) || STRINGP (next)) && doit)
     {
-      int len = XFASTINT (Flength (next));
+      int len = XFIXNAT (Flength (next));
       int i;
 
       *diff = len - (fkey->end - fkey->start);
@@ -8779,7 +8779,7 @@ keyremap_step (Lisp_Object *keybuf, volatile keyremap 
*fkey,
       /* Overwrite the old keys with the new ones.  */
       for (i = 0; i < len; i++)
        keybuf[fkey->start + i]
-         = Faref (next, make_number (i));
+         = Faref (next, make_fixnum (i));
 
       fkey->start = fkey->end += *diff;
       fkey->map = fkey->parent;
@@ -9109,7 +9109,7 @@ read_key_sequence (Lisp_Object *keybuf, Lisp_Object 
prompt,
                             current_binding, last_nonmenu_event,
                              &used_mouse_menu, NULL);
            used_mouse_menu_history[t] = used_mouse_menu;
-           if ((INTEGERP (key) && XINT (key) == -2) /* wrong_kboard_jmpbuf */
+           if ((FIXNUMP (key) && XFIXNUM (key) == -2) /* wrong_kboard_jmpbuf */
                /* When switching to a new tty (with a new keyboard),
                   read_char returns the new buffer, rather than -2
                   (Bug#5095).  This is because `terminal-init-xterm'
@@ -9177,7 +9177,7 @@ read_key_sequence (Lisp_Object *keybuf, Lisp_Object 
prompt,
          /* read_char returns -1 at the end of a macro.
             Emacs 18 handles this by returning immediately with a
             zero, so that's what we'll do.  */
-         if (INTEGERP (key) && XINT (key) == -1)
+         if (FIXNUMP (key) && XFIXNUM (key) == -1)
            {
              t = 0;
              /* The Microsoft C compiler can't handle the goto that
@@ -9212,8 +9212,8 @@ read_key_sequence (Lisp_Object *keybuf, Lisp_Object 
prompt,
          /* If we have a quit that was typed in another frame, and
             quit_throw_to_read_char switched buffers,
             replay to get the right keymap.  */
-         if (INTEGERP (key)
-             && XINT (key) == quit_char
+         if (FIXNUMP (key)
+             && XFIXNUM (key) == quit_char
              && current_buffer != starting_buffer)
            {
              GROW_RAW_KEYBUF;
@@ -9413,7 +9413,7 @@ read_key_sequence (Lisp_Object *keybuf, Lisp_Object 
prompt,
              int modifiers;
 
              breakdown = parse_modifiers (head);
-             modifiers = XINT (XCAR (XCDR (breakdown)));
+             modifiers = XFIXNUM (XCAR (XCDR (breakdown)));
              /* Attempt to reduce an unbound mouse event to a simpler
                 event that is bound:
                   Drags reduce to clicks.
@@ -9643,14 +9643,14 @@ read_key_sequence (Lisp_Object *keybuf, Lisp_Object 
prompt,
         use the corresponding lower-case letter instead.  */
       if (NILP (current_binding)
          && /* indec.start >= t && fkey.start >= t && */ keytran.start >= t
-         && INTEGERP (key))
+         && FIXNUMP (key))
        {
          Lisp_Object new_key;
-         EMACS_INT k = XINT (key);
+         EMACS_INT k = XFIXNUM (key);
 
          if (k & shift_modifier)
            XSETINT (new_key, k & ~shift_modifier);
-         else if (CHARACTERP (make_number (k & ~CHAR_MODIFIER_MASK)))
+         else if (CHARACTERP (make_fixnum (k & ~CHAR_MODIFIER_MASK)))
            {
              int dc = downcase (k & ~CHAR_MODIFIER_MASK);
              if (dc == (k & ~CHAR_MODIFIER_MASK))
@@ -9693,11 +9693,11 @@ read_key_sequence (Lisp_Object *keybuf, Lisp_Object 
prompt,
        {
          Lisp_Object breakdown = parse_modifiers (key);
          int modifiers
-           = CONSP (breakdown) ? (XINT (XCAR (XCDR (breakdown)))) : 0;
+           = CONSP (breakdown) ? (XFIXNUM (XCAR (XCDR (breakdown)))) : 0;
 
          if (modifiers & shift_modifier
              /* Treat uppercase keys as shifted.  */
-             || (INTEGERP (key)
+             || (FIXNUMP (key)
                  && (KEY_TO_CHAR (key)
                      < XCHAR_TABLE (BVAR (current_buffer, 
downcase_table))->header.size)
                  && uppercasep (KEY_TO_CHAR (key))))
@@ -9706,7 +9706,7 @@ read_key_sequence (Lisp_Object *keybuf, Lisp_Object 
prompt,
                = (modifiers & shift_modifier
                   ? apply_modifiers (modifiers & ~shift_modifier,
                                      XCAR (breakdown))
-                  : make_number (downcase (KEY_TO_CHAR (key)) | modifiers));
+                  : make_fixnum (downcase (KEY_TO_CHAR (key)) | modifiers));
 
              original_uppercase = key;
              original_uppercase_position = t - 1;
@@ -10027,16 +10027,16 @@ Internal use only.  */)
   /* Kludge alert: this makes M-x be in the form expected by
      novice.el.  (248 is \370, a.k.a. "Meta-x".)  Any better ideas?  */
   if (key0 == 248)
-    add_command_key (make_number ('x' | meta_modifier));
+    add_command_key (make_fixnum ('x' | meta_modifier));
   else
-    add_command_key (make_number (key0));
+    add_command_key (make_fixnum (key0));
   for (ptrdiff_t i = 1; i < SCHARS (keys); i++)
     {
       int key_i;
       FETCH_STRING_CHAR_ADVANCE (key_i, keys, charidx, byteidx);
       if (CHAR_BYTE8_P (key_i))
        key_i = CHAR_TO_BYTE8 (key_i);
-      add_command_key (make_number (key_i));
+      add_command_key (make_fixnum (key_i));
     }
   return Qnil;
 }
@@ -10109,7 +10109,7 @@ DEFUN ("recursion-depth", Frecursion_depth, 
Srecursion_depth, 0, 0, 0,
 {
   EMACS_INT sum;
   INT_ADD_WRAPV (command_loop_level, minibuf_level, &sum);
-  return make_number (sum);
+  return make_fixnum (sum);
 }
 
 DEFUN ("open-dribble-file", Fopen_dribble_file, Sopen_dribble_file, 1, 1,
@@ -10662,7 +10662,7 @@ See also `current-input-mode'.  */)
     return Qnil;
   tty = t->display_info.tty;
 
-  if (NILP (quit) || !INTEGERP (quit) || XINT (quit) < 0 || XINT (quit) > 0400)
+  if (NILP (quit) || !FIXNUMP (quit) || XFIXNUM (quit) < 0 || XFIXNUM (quit) > 
0400)
     error ("QUIT must be an ASCII character");
 
 #ifndef DOS_NT
@@ -10671,7 +10671,7 @@ See also `current-input-mode'.  */)
 #endif
 
   /* Don't let this value be out of range.  */
-  quit_char = XINT (quit) & (tty->meta_key == 0 ? 0177 : 0377);
+  quit_char = XFIXNUM (quit) & (tty->meta_key == 0 ? 0177 : 0377);
 
 #ifndef DOS_NT
   init_sys_modes (tty);
@@ -10725,7 +10725,7 @@ The elements of this list correspond to the arguments of
     {
       flow = FRAME_TTY (sf)->flow_control ? Qt : Qnil;
       meta = (FRAME_TTY (sf)->meta_key == 2
-             ? make_number (0)
+             ? make_fixnum (0)
              : (CURTTY ()->meta_key == 1 ? Qt : Qnil));
     }
   else
@@ -10733,7 +10733,7 @@ The elements of this list correspond to the arguments of
       flow = Qnil;
       meta = Qt;
     }
-  Lisp_Object quit = make_number (quit_char);
+  Lisp_Object quit = make_fixnum (quit_char);
 
   return list4 (interrupt, flow, meta, quit);
 }
@@ -10751,12 +10751,12 @@ The return value is similar to a mouse click position:
 The `posn-' functions access elements of such lists.  */)
   (Lisp_Object x, Lisp_Object y, Lisp_Object frame_or_window, Lisp_Object 
whole)
 {
-  CHECK_NUMBER (x);
+  CHECK_FIXNUM (x);
   /* We allow X of -1, for the newline in a R2L line that overflowed
      into the left fringe.  */
-  if (XINT (x) != -1)
-    CHECK_NATNUM (x);
-  CHECK_NATNUM (y);
+  if (XFIXNUM (x) != -1)
+    CHECK_FIXNAT (x);
+  CHECK_FIXNAT (y);
 
   if (NILP (frame_or_window))
     frame_or_window = selected_window;
@@ -10765,12 +10765,12 @@ The `posn-' functions access elements of such lists.  
*/)
     {
       struct window *w = decode_live_window (frame_or_window);
 
-      XSETINT (x, (XINT (x)
+      XSETINT (x, (XFIXNUM (x)
                   + WINDOW_LEFT_EDGE_X (w)
                   + (NILP (whole)
                      ? window_box_left_offset (w, TEXT_AREA)
                      : 0)));
-      XSETINT (y, WINDOW_TO_FRAME_PIXEL_Y (w, XINT (y)));
+      XSETINT (y, WINDOW_TO_FRAME_PIXEL_Y (w, XFIXNUM (y)));
       frame_or_window = w->frame;
     }
 
@@ -10803,17 +10803,17 @@ The `posn-' functions access elements of such lists.  
*/)
       Lisp_Object x = XCAR (tem);
       Lisp_Object y = XCAR (XCDR (tem));
       Lisp_Object aux_info = XCDR (XCDR (tem));
-      int y_coord = XINT (y);
+      int y_coord = XFIXNUM (y);
 
       /* Point invisible due to hscrolling?  X can be -1 when a
         newline in a R2L line overflows into the left fringe.  */
-      if (XINT (x) < -1)
+      if (XFIXNUM (x) < -1)
        return Qnil;
       if (!NILP (aux_info) && y_coord < 0)
        {
-         int rtop = XINT (XCAR (aux_info));
+         int rtop = XFIXNUM (XCAR (aux_info));
 
-         y = make_number (y_coord + rtop);
+         y = make_fixnum (y_coord + rtop);
        }
       tem = Fposn_at_x_y (x, y, window, Qnil);
     }
@@ -11202,11 +11202,11 @@ syms_of_keyboard (void)
       }
   }
 
-  button_down_location = Fmake_vector (make_number (5), Qnil);
+  button_down_location = Fmake_vector (make_fixnum (5), Qnil);
   staticpro (&button_down_location);
-  mouse_syms = Fmake_vector (make_number (5), Qnil);
+  mouse_syms = Fmake_vector (make_fixnum (5), Qnil);
   staticpro (&mouse_syms);
-  wheel_syms = Fmake_vector (make_number (ARRAYELTS (lispy_wheel_names)),
+  wheel_syms = Fmake_vector (make_fixnum (ARRAYELTS (lispy_wheel_names)),
                             Qnil);
   staticpro (&wheel_syms);
 
@@ -11214,20 +11214,20 @@ syms_of_keyboard (void)
     int i;
     int len = ARRAYELTS (modifier_names);
 
-    modifier_symbols = Fmake_vector (make_number (len), Qnil);
+    modifier_symbols = Fmake_vector (make_fixnum (len), Qnil);
     for (i = 0; i < len; i++)
       if (modifier_names[i])
        ASET (modifier_symbols, i, intern_c_string (modifier_names[i]));
     staticpro (&modifier_symbols);
   }
 
-  recent_keys = Fmake_vector (make_number (NUM_RECENT_KEYS), Qnil);
+  recent_keys = Fmake_vector (make_fixnum (NUM_RECENT_KEYS), Qnil);
   staticpro (&recent_keys);
 
-  this_command_keys = Fmake_vector (make_number (40), Qnil);
+  this_command_keys = Fmake_vector (make_fixnum (40), Qnil);
   staticpro (&this_command_keys);
 
-  raw_keybuf = Fmake_vector (make_number (30), Qnil);
+  raw_keybuf = Fmake_vector (make_fixnum (30), Qnil);
   staticpro (&raw_keybuf);
 
   DEFSYM (Qcommand_execute, "command-execute");
@@ -11391,6 +11391,10 @@ result of looking up the original command in the 
active keymaps.  */);
 Zero means disable autosaving due to number of characters typed.  */);
   auto_save_interval = 300;
 
+  DEFVAR_BOOL ("auto-save-no-message", auto_save_no_message,
+              doc: /* Non-nil means do not print any message when auto-saving. 
*/);
+  auto_save_no_message = false;
+
   DEFVAR_LISP ("auto-save-timeout", Vauto_save_timeout,
               doc: /* Number of seconds idle time before auto-save.
 Zero or nil means disable auto-saving due to idleness.
@@ -11402,7 +11406,7 @@ Emacs also does a garbage collection if that seems to 
be warranted.  */);
               doc: /* Nonzero means echo unfinished commands after this many 
seconds of pause.
 The value may be integer or floating point.
 If the value is zero, don't echo at all.  */);
-  Vecho_keystrokes = make_number (1);
+  Vecho_keystrokes = make_fixnum (1);
 
   DEFVAR_INT ("polling-period", polling_period,
              doc: /* Interval between polling for input during Lisp execution.
@@ -11416,7 +11420,7 @@ Polling is automatically disabled in all other cases.  
*/);
 Measured in milliseconds.  The value nil means disable double-click
 recognition; t means double-clicks have no time limit and are detected
 by position only.  */);
-  Vdouble_click_time = make_number (500);
+  Vdouble_click_time = make_fixnum (500);
 
   DEFVAR_INT ("double-click-fuzz", double_click_fuzz,
              doc: /* Maximum mouse movement between clicks to make a 
double-click.
@@ -11766,7 +11770,7 @@ suppressed only after special commands that leave
               doc: /* How long to display an echo-area message when the 
minibuffer is active.
 If the value is a number, it should be specified in seconds.
 If the value is not a number, such messages never time out.  */);
-  Vminibuffer_message_timeout = make_number (2);
+  Vminibuffer_message_timeout = make_fixnum (2);
 
   DEFVAR_LISP ("throw-on-input", Vthrow_on_input,
               doc: /* If non-nil, any keyboard input throws to this symbol.
diff --git a/src/keyboard.h b/src/keyboard.h
index cae9498..ce4630b 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -391,7 +391,7 @@ extern void unuse_menu_items (void);
 #define EVENT_END(event) (CAR_SAFE (CDR_SAFE (CDR_SAFE (event))))
 
 /* Extract the click count from a multi-click event.  */
-#define EVENT_CLICK_COUNT(event) (Fnth (make_number (2), (event)))
+#define EVENT_CLICK_COUNT(event) (Fnth (make_fixnum (2), (event)))
 
 /* Extract the fields of a position.  */
 #define POSN_WINDOW(posn) (CAR_SAFE (posn))
@@ -399,17 +399,17 @@ extern void unuse_menu_items (void);
 #define POSN_SET_POSN(posn,x) (XSETCAR (XCDR (posn), (x)))
 #define POSN_WINDOW_POSN(posn) (CAR_SAFE (CDR_SAFE (CDR_SAFE (posn))))
 #define POSN_TIMESTAMP(posn) (CAR_SAFE (CDR_SAFE (CDR_SAFE (CDR_SAFE (posn)))))
-#define POSN_SCROLLBAR_PART(posn)      (Fnth (make_number (4), (posn)))
+#define POSN_SCROLLBAR_PART(posn)      (Fnth (make_fixnum (4), (posn)))
 
 /* A cons (STRING . STRING-CHARPOS), or nil in mouse-click events.
    It's a cons if the click is over a string in the mode line.  */
 
-#define POSN_STRING(posn) (Fnth (make_number (4), (posn)))
+#define POSN_STRING(posn) (Fnth (make_fixnum (4), (posn)))
 
 /* If POSN_STRING is nil, event refers to buffer location.  */
 
 #define POSN_INBUFFER_P(posn) (NILP (POSN_STRING (posn)))
-#define POSN_BUFFER_POSN(posn) (Fnth (make_number (5), (posn)))
+#define POSN_BUFFER_POSN(posn) (Fnth (make_fixnum (5), (posn)))
 
 /* Getting the kind of an event head.  */
 #define EVENT_HEAD_KIND(event_head) \
diff --git a/src/keymap.c b/src/keymap.c
index fcee788..bdd3af2 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -159,7 +159,7 @@ in case you use it as a menu with `x-popup-menu'.  */)
 void
 initial_define_key (Lisp_Object keymap, int key, const char *defname)
 {
-  store_in_keymap (keymap, make_number (key), intern_c_string (defname));
+  store_in_keymap (keymap, make_fixnum (key), intern_c_string (defname));
 }
 
 void
@@ -248,7 +248,7 @@ get_keymap (Lisp_Object object, bool error_if_not_keymap, 
bool autoload)
        {
          Lisp_Object tail;
 
-         tail = Fnth (make_number (4), tem);
+         tail = Fnth (make_fixnum (4), tem);
          if (EQ (tail, Qkeymap))
            {
              if (autoload)
@@ -379,28 +379,28 @@ access_keymap_1 (Lisp_Object map, Lisp_Object idx,
      be put in the canonical order.  */
   if (SYMBOLP (idx))
     idx = reorder_modifiers (idx);
-  else if (INTEGERP (idx))
+  else if (FIXNUMP (idx))
     /* Clobber the high bits that can be present on a machine
        with more than 24 bits of integer.  */
-    XSETFASTINT (idx, XINT (idx) & (CHAR_META | (CHAR_META - 1)));
+    XSETFASTINT (idx, XFIXNUM (idx) & (CHAR_META | (CHAR_META - 1)));
 
   /* Handle the special meta -> esc mapping.  */
-  if (INTEGERP (idx) && XFASTINT (idx) & meta_modifier)
+  if (FIXNUMP (idx) && XFIXNAT (idx) & meta_modifier)
     {
       /* See if there is a meta-map.  If there's none, there is
          no binding for IDX, unless a default binding exists in MAP.  */
       Lisp_Object event_meta_binding, event_meta_map;
       /* A strange value in which Meta is set would cause
         infinite recursion.  Protect against that.  */
-      if (XINT (meta_prefix_char) & CHAR_META)
-       meta_prefix_char = make_number (27);
+      if (XFIXNUM (meta_prefix_char) & CHAR_META)
+       meta_prefix_char = make_fixnum (27);
       event_meta_binding = access_keymap_1 (map, meta_prefix_char, t_ok,
                                            noinherit, autoload);
       event_meta_map = get_keymap (event_meta_binding, 0, autoload);
       if (CONSP (event_meta_map))
        {
          map = event_meta_map;
-         idx = make_number (XFASTINT (idx) & ~meta_modifier);
+         idx = make_fixnum (XFIXNAT (idx) & ~meta_modifier);
        }
       else if (t_ok)
        /* Set IDX to t, so that we only find a default binding.  */
@@ -473,15 +473,15 @@ access_keymap_1 (Lisp_Object map, Lisp_Object idx,
          }
        else if (VECTORP (binding))
          {
-           if (INTEGERP (idx) && XFASTINT (idx) < ASIZE (binding))
-             val = AREF (binding, XFASTINT (idx));
+           if (FIXNUMP (idx) && XFIXNAT (idx) < ASIZE (binding))
+             val = AREF (binding, XFIXNAT (idx));
          }
        else if (CHAR_TABLE_P (binding))
          {
            /* Character codes with modifiers
               are not included in a char-table.
               All character codes without modifiers are included.  */
-           if (INTEGERP (idx) && (XFASTINT (idx) & CHAR_MODIFIER_MASK) == 0)
+           if (FIXNUMP (idx) && (XFIXNAT (idx) & CHAR_MODIFIER_MASK) == 0)
              {
                val = Faref (binding, idx);
                /* nil has a special meaning for char-tables, so
@@ -567,7 +567,7 @@ map_keymap_char_table_item (Lisp_Object args, Lisp_Object 
key, Lisp_Object val)
         it in place.  */
       if (CONSP (key))
        key = Fcons (XCAR (key), XCDR (key));
-      union map_keymap *md = XINTPTR (args);
+      union map_keymap *md = XFIXNUMPTR (args);
       map_keymap_item (md->s.fun, md->s.args, key, val, md->s.data);
     }
 }
@@ -782,10 +782,10 @@ store_in_keymap (Lisp_Object keymap, register Lisp_Object 
idx, Lisp_Object def)
      be put in the canonical order.  */
   if (SYMBOLP (idx))
     idx = reorder_modifiers (idx);
-  else if (INTEGERP (idx))
+  else if (FIXNUMP (idx))
     /* Clobber the high bits that can be present on a machine
        with more than 24 bits of integer.  */
-    XSETFASTINT (idx, XINT (idx) & (CHAR_META | (CHAR_META - 1)));
+    XSETFASTINT (idx, XFIXNUM (idx) & (CHAR_META | (CHAR_META - 1)));
 
   /* Scan the keymap for a binding of idx.  */
   {
@@ -807,22 +807,22 @@ store_in_keymap (Lisp_Object keymap, register Lisp_Object 
idx, Lisp_Object def)
        elt = XCAR (tail);
        if (VECTORP (elt))
          {
-           if (NATNUMP (idx) && XFASTINT (idx) < ASIZE (elt))
+           if (FIXNATP (idx) && XFIXNAT (idx) < ASIZE (elt))
              {
                CHECK_IMPURE (elt, XVECTOR (elt));
-               ASET (elt, XFASTINT (idx), def);
+               ASET (elt, XFIXNAT (idx), def);
                return def;
              }
            else if (CONSP (idx) && CHARACTERP (XCAR (idx)))
              {
-               int from = XFASTINT (XCAR (idx));
-               int to = XFASTINT (XCDR (idx));
+               int from = XFIXNAT (XCAR (idx));
+               int to = XFIXNAT (XCDR (idx));
 
                if (to >= ASIZE (elt))
                  to = ASIZE (elt) - 1;
                for (; from <= to; from++)
                  ASET (elt, from, def);
-               if (to == XFASTINT (XCDR (idx)))
+               if (to == XFIXNAT (XCDR (idx)))
                  /* We have defined all keys in IDX.  */
                  return def;
              }
@@ -833,7 +833,7 @@ store_in_keymap (Lisp_Object keymap, register Lisp_Object 
idx, Lisp_Object def)
            /* Character codes with modifiers
               are not included in a char-table.
               All character codes without modifiers are included.  */
-           if (NATNUMP (idx) && !(XFASTINT (idx) & CHAR_MODIFIER_MASK))
+           if (FIXNATP (idx) && !(XFIXNAT (idx) & CHAR_MODIFIER_MASK))
              {
                Faset (elt, idx,
                       /* nil has a special meaning for char-tables, so
@@ -870,11 +870,11 @@ store_in_keymap (Lisp_Object keymap, register Lisp_Object 
idx, Lisp_Object def)
                     && CHARACTERP (XCAR (idx))
                     && CHARACTERP (XCAR (elt)))
              {
-               int from = XFASTINT (XCAR (idx));
-               int to = XFASTINT (XCDR (idx));
+               int from = XFIXNAT (XCAR (idx));
+               int to = XFIXNAT (XCDR (idx));
 
-               if (from <= XFASTINT (XCAR (elt))
-                   && to >= XFASTINT (XCAR (elt)))
+               if (from <= XFIXNAT (XCAR (elt))
+                   && to >= XFIXNAT (XCAR (elt)))
                  {
                    XSETCDR (elt, def);
                    if (from == to)
@@ -1093,7 +1093,7 @@ binding KEY to DEF is added at the front of KEYMAP.  */)
 
   if (VECTORP (def) && ASIZE (def) > 0 && CONSP (AREF (def, 0)))
     { /* DEF is apparently an XEmacs-style keyboard macro.  */
-      Lisp_Object tmp = Fmake_vector (make_number (ASIZE (def)), Qnil);
+      Lisp_Object tmp = Fmake_vector (make_fixnum (ASIZE (def)), Qnil);
       ptrdiff_t i = ASIZE (def);
       while (--i >= 0)
        {
@@ -1108,7 +1108,7 @@ binding KEY to DEF is added at the front of KEYMAP.  */)
   idx = 0;
   while (1)
     {
-      c = Faref (key, make_number (idx));
+      c = Faref (key, make_fixnum (idx));
 
       if (CONSP (c))
        {
@@ -1123,8 +1123,8 @@ binding KEY to DEF is added at the front of KEYMAP.  */)
       if (SYMBOLP (c))
        silly_event_symbol_error (c);
 
-      if (INTEGERP (c)
-         && (XINT (c) & meta_bit)
+      if (FIXNUMP (c)
+         && (XFIXNUM (c) & meta_bit)
          && !metized)
        {
          c = meta_prefix_char;
@@ -1132,17 +1132,17 @@ binding KEY to DEF is added at the front of KEYMAP.  */)
        }
       else
        {
-         if (INTEGERP (c))
-           XSETINT (c, XINT (c) & ~meta_bit);
+         if (FIXNUMP (c))
+           XSETINT (c, XFIXNUM (c) & ~meta_bit);
 
          metized = 0;
          idx++;
        }
 
-      if (!INTEGERP (c) && !SYMBOLP (c)
+      if (!FIXNUMP (c) && !SYMBOLP (c)
          && (!CONSP (c)
              /* If C is a range, it must be a leaf.  */
-             || (INTEGERP (XCAR (c)) && idx != length)))
+             || (FIXNUMP (XCAR (c)) && idx != length)))
        message_with_string ("Key sequence contains invalid event %s", c, 1);
 
       if (idx == length)
@@ -1165,8 +1165,8 @@ binding KEY to DEF is added at the front of KEYMAP.  */)
             error; key might be a vector, not a string.  */
          error ("Key sequence %s starts with non-prefix key %s%s",
                 SDATA (Fkey_description (key, Qnil)),
-                SDATA (Fkey_description (Fsubstring (key, make_number (0),
-                                                     make_number (idx)),
+                SDATA (Fkey_description (Fsubstring (key, make_fixnum (0),
+                                                     make_fixnum (idx)),
                                          Qnil)),
                 trailing_esc);
        }
@@ -1201,7 +1201,7 @@ remapping in all currently active keymaps.  */)
   else
     command = Flookup_key (Fcons (Qkeymap, keymaps),
                           command_remapping_vector, Qnil);
-  return INTEGERP (command) ? Qnil : command;
+  return FIXNUMP (command) ? Qnil : command;
 }
 
 /* Value is number if KEY is too long; nil if valid but has no definition.  */
@@ -1240,18 +1240,18 @@ recognize the default bindings, just as 
`read-key-sequence' does.  */)
   idx = 0;
   while (1)
     {
-      c = Faref (key, make_number (idx++));
+      c = Faref (key, make_fixnum (idx++));
 
       if (CONSP (c) && lucid_event_type_list_p (c))
        c = Fevent_convert_list (c);
 
       /* Turn the 8th bit of string chars into a meta modifier.  */
-      if (STRINGP (key) && XINT (c) & 0x80 && !STRING_MULTIBYTE (key))
-       XSETINT (c, (XINT (c) | meta_modifier) & ~0x80);
+      if (STRINGP (key) && XFIXNUM (c) & 0x80 && !STRING_MULTIBYTE (key))
+       XSETINT (c, (XFIXNUM (c) | meta_modifier) & ~0x80);
 
       /* Allow string since binding for `menu-bar-select-buffer'
         includes the buffer name in the key sequence.  */
-      if (!INTEGERP (c) && !SYMBOLP (c) && !CONSP (c) && !STRINGP (c))
+      if (!FIXNUMP (c) && !SYMBOLP (c) && !CONSP (c) && !STRINGP (c))
        message_with_string ("Key sequence contains invalid event %s", c, 1);
 
       cmd = access_keymap (keymap, c, t_ok, 0, 1);
@@ -1260,7 +1260,7 @@ recognize the default bindings, just as 
`read-key-sequence' does.  */)
 
       keymap = get_keymap (cmd, 0, 1);
       if (!CONSP (keymap))
-       return make_number (idx);
+       return make_fixnum (idx);
 
       maybe_quit ();
     }
@@ -1300,7 +1300,7 @@ silly_event_symbol_error (Lisp_Object c)
   int modifiers;
 
   parsed = parse_modifiers (c);
-  modifiers = XFASTINT (XCAR (XCDR (parsed)));
+  modifiers = XFIXNAT (XCAR (XCDR (parsed)));
   base = XCAR (parsed);
   name = Fsymbol_name (base);
   /* This alist includes elements such as ("RET" . "\\r").  */
@@ -1474,7 +1474,7 @@ current_minor_maps (Lisp_Object **modeptr, Lisp_Object 
**mapptr)
 static ptrdiff_t
 click_position (Lisp_Object position)
 {
-  EMACS_INT pos = (INTEGERP (position) ? XINT (position)
+  EMACS_INT pos = (FIXNUMP (position) ? XFIXNUM (position)
                   : MARKERP (position) ? marker_position (position)
                   : PT);
   if (! (BEGV <= pos && pos <= ZV))
@@ -1552,13 +1552,13 @@ like in the respective argument of `key-binding'.  */)
              Lisp_Object pos;
 
              pos = POSN_BUFFER_POSN (position);
-             if (INTEGERP (pos)
-                 && XINT (pos) >= BEG && XINT (pos) <= Z)
+             if (FIXNUMP (pos)
+                 && XFIXNUM (pos) >= BEG && XFIXNUM (pos) <= Z)
                {
-                 local_map = get_local_map (XINT (pos),
+                 local_map = get_local_map (XFIXNUM (pos),
                                             current_buffer, Qlocal_map);
 
-                 keymap = get_local_map (XINT (pos),
+                 keymap = get_local_map (XFIXNUM (pos),
                                          current_buffer, Qkeymap);
                }
            }
@@ -1575,9 +1575,9 @@ like in the respective argument of `key-binding'.  */)
 
              pos = XCDR (string);
              string = XCAR (string);
-             if (INTEGERP (pos)
-                 && XINT (pos) >= 0
-                 && XINT (pos) < SCHARS (string))
+             if (FIXNUMP (pos)
+                 && XFIXNUM (pos) >= 0
+                 && XFIXNUM (pos) < SCHARS (string))
                {
                  map = Fget_text_property (pos, Qlocal_map, string);
                  if (!NILP (map))
@@ -1667,7 +1667,7 @@ specified buffer position instead of point are used.
   value = Flookup_key (Fcons (Qkeymap, Fcurrent_active_maps (Qt, position)),
                       key, accept_default);
 
-  if (NILP (value) || INTEGERP (value))
+  if (NILP (value) || FIXNUMP (value))
     return Qnil;
 
   /* If the result of the ordinary keymap lookup is an interactive
@@ -1745,7 +1745,7 @@ bindings; see the description of `lookup-key' for more 
details about this.  */)
   for (i = j = 0; i < nmaps; i++)
     if (!NILP (maps[i])
        && !NILP (binding = Flookup_key (maps[i], key, accept_default))
-       && !INTEGERP (binding))
+       && !FIXNUMP (binding))
       {
        if (KEYMAPP (binding))
          maps[j++] = Fcons (modes[i], binding);
@@ -1843,7 +1843,7 @@ accessible_keymaps_1 (Lisp_Object key, Lisp_Object cmd, 
Lisp_Object args, void *
   Lisp_Object maps = d->maps;
   Lisp_Object tail = d->tail;
   Lisp_Object thisseq = d->thisseq;
-  bool is_metized = d->is_metized && INTEGERP (key);
+  bool is_metized = d->is_metized && FIXNUMP (key);
   Lisp_Object tem;
 
   cmd = get_keymap (get_keyelt (cmd, 0), 0, 0);
@@ -1854,12 +1854,12 @@ accessible_keymaps_1 (Lisp_Object key, Lisp_Object cmd, 
Lisp_Object args, void *
   while (!NILP (tem = Frassq (cmd, maps)))
     {
       Lisp_Object prefix = XCAR (tem);
-      ptrdiff_t lim = XINT (Flength (XCAR (tem)));
-      if (lim <= XINT (Flength (thisseq)))
+      ptrdiff_t lim = XFIXNUM (Flength (XCAR (tem)));
+      if (lim <= XFIXNUM (Flength (thisseq)))
        { /* This keymap was already seen with a smaller prefix.  */
          ptrdiff_t i = 0;
-         while (i < lim && EQ (Faref (prefix, make_number (i)),
-                               Faref (thisseq, make_number (i))))
+         while (i < lim && EQ (Faref (prefix, make_fixnum (i)),
+                               Faref (thisseq, make_fixnum (i))))
            i++;
          if (i >= lim)
            /* `prefix' is a prefix of `thisseq' => there's a cycle.  */
@@ -1879,10 +1879,10 @@ accessible_keymaps_1 (Lisp_Object key, Lisp_Object cmd, 
Lisp_Object args, void *
   if (is_metized)
     {
       int meta_bit = meta_modifier;
-      Lisp_Object last = make_number (XINT (Flength (thisseq)) - 1);
+      Lisp_Object last = make_fixnum (XFIXNUM (Flength (thisseq)) - 1);
       tem = Fcopy_sequence (thisseq);
 
-      Faset (tem, last, make_number (XINT (key) | meta_bit));
+      Faset (tem, last, make_fixnum (XFIXNUM (key) | meta_bit));
 
       /* This new sequence is the same length as
         thisseq, so stick it in the list right
@@ -1910,7 +1910,7 @@ then the value includes only maps for prefixes that start 
with PREFIX.  */)
   (Lisp_Object keymap, Lisp_Object prefix)
 {
   Lisp_Object maps, tail;
-  EMACS_INT prefixlen = XFASTINT (Flength (prefix));
+  EMACS_INT prefixlen = XFIXNAT (Flength (prefix));
 
   if (!NILP (prefix))
     {
@@ -1933,7 +1933,7 @@ then the value includes only maps for prefixes that start 
with PREFIX.  */)
              int i, i_byte, c;
              Lisp_Object copy;
 
-             copy = Fmake_vector (make_number (SCHARS (prefix)), Qnil);
+             copy = Fmake_vector (make_fixnum (SCHARS (prefix)), Qnil);
              for (i = 0, i_byte = 0; i < SCHARS (prefix);)
                {
                  int i_before = i;
@@ -1941,7 +1941,7 @@ then the value includes only maps for prefixes that start 
with PREFIX.  */)
                  FETCH_STRING_CHAR_ADVANCE (c, prefix, i, i_byte);
                  if (SINGLE_BYTE_CHAR_P (c) && (c & 0200))
                    c ^= 0200 | meta_modifier;
-                 ASET (copy, i_before, make_number (c));
+                 ASET (copy, i_before, make_fixnum (c));
                }
              prefix = copy;
            }
@@ -1969,11 +1969,11 @@ then the value includes only maps for prefixes that 
start with PREFIX.  */)
       data.thisseq = Fcar (XCAR (tail));
       data.maps = maps;
       data.tail = tail;
-      last = make_number (XINT (Flength (data.thisseq)) - 1);
+      last = make_fixnum (XFIXNUM (Flength (data.thisseq)) - 1);
       /* Does the current sequence end in the meta-prefix-char?  */
-      data.is_metized = (XINT (last) >= 0
+      data.is_metized = (XFIXNUM (last) >= 0
                    /* Don't metize the last char of PREFIX.  */
-                   && XINT (last) >= prefixlen
+                   && XFIXNUM (last) >= prefixlen
                    && EQ (Faref (data.thisseq, last), meta_prefix_char));
 
       /* Since we can't run lisp code, we can't scan autoloaded maps.  */
@@ -1997,7 +1997,7 @@ For an approximate inverse of this, see `kbd'.  */)
   EMACS_INT i;
   ptrdiff_t i_byte;
   Lisp_Object *args;
-  EMACS_INT size = XINT (Flength (keys));
+  EMACS_INT size = XFIXNUM (Flength (keys));
   Lisp_Object list;
   Lisp_Object sep = build_string (" ");
   Lisp_Object key;
@@ -2006,7 +2006,7 @@ For an approximate inverse of this, see `kbd'.  */)
   USE_SAFE_ALLOCA;
 
   if (!NILP (prefix))
-    size += XINT (Flength (prefix));
+    size += XFIXNUM (Flength (prefix));
 
   /* This has one extra element at the end that we don't pass to Fconcat.  */
   EMACS_INT size4;
@@ -2043,7 +2043,7 @@ For an approximate inverse of this, see `kbd'.  */)
   else if (VECTORP (list))
     size = ASIZE (list);
   else if (CONSP (list))
-    size = XINT (Flength (list));
+    size = XFIXNUM (Flength (list));
   else
     wrong_type_argument (Qarrayp, list);
 
@@ -2072,9 +2072,9 @@ For an approximate inverse of this, see `kbd'.  */)
 
       if (add_meta)
        {
-         if (!INTEGERP (key)
+         if (!FIXNUMP (key)
              || EQ (key, meta_prefix_char)
-             || (XINT (key) & meta_modifier))
+             || (XFIXNUM (key) & meta_modifier))
            {
              args[len++] = Fsingle_key_description (meta_prefix_char, Qnil);
              args[len++] = sep;
@@ -2082,7 +2082,7 @@ For an approximate inverse of this, see `kbd'.  */)
                continue;
            }
          else
-           XSETINT (key, XINT (key) | meta_modifier);
+           XSETINT (key, XFIXNUM (key) | meta_modifier);
          add_meta = 0;
        }
       else if (EQ (key, meta_prefix_char))
@@ -2108,7 +2108,7 @@ push_key_description (EMACS_INT ch, char *p)
   c2 = c & ~(alt_modifier | ctrl_modifier | hyper_modifier
             | meta_modifier | shift_modifier | super_modifier);
 
-  if (! CHARACTERP (make_number (c2)))
+  if (! CHARACTERP (make_fixnum (c2)))
     {
       /* KEY_DESCRIPTION_SIZE is large enough for this.  */
       p += sprintf (p, "[%d]", c);
@@ -2226,7 +2226,7 @@ around function keys and event symbols.  */)
   if (CONSP (key) && lucid_event_type_list_p (key))
     key = Fevent_convert_list (key);
 
-  if (CONSP (key) && INTEGERP (XCAR (key)) && INTEGERP (XCDR (key)))
+  if (CONSP (key) && FIXNUMP (XCAR (key)) && FIXNUMP (XCDR (key)))
     /* An interval from a map-char-table.  */
     {
       AUTO_STRING (dot_dot, "..");
@@ -2237,10 +2237,10 @@ around function keys and event symbols.  */)
 
   key = EVENT_HEAD (key);
 
-  if (INTEGERP (key))          /* Normal character.  */
+  if (FIXNUMP (key))           /* Normal character.  */
     {
       char tem[KEY_DESCRIPTION_SIZE];
-      char *p = push_key_description (XINT (key), tem);
+      char *p = push_key_description (XFIXNUM (key), tem);
       *p = 0;
       return make_specified_string (tem, -1, p - tem, 1);
     }
@@ -2306,7 +2306,7 @@ See Info node `(elisp)Describing Characters' for 
examples.  */)
 
   CHECK_CHARACTER (character);
 
-  c = XINT (character);
+  c = XFIXNUM (character);
   if (!ASCII_CHAR_P (c))
     {
       int len = CHAR_STRING (c, (unsigned char *) str);
@@ -2328,7 +2328,7 @@ static int
 preferred_sequence_p (Lisp_Object seq)
 {
   EMACS_INT i;
-  EMACS_INT len = XFASTINT (Flength (seq));
+  EMACS_INT len = XFIXNAT (Flength (seq));
   int result = 1;
 
   for (i = 0; i < len; i++)
@@ -2338,11 +2338,11 @@ preferred_sequence_p (Lisp_Object seq)
       XSETFASTINT (ii, i);
       elt = Faref (seq, ii);
 
-      if (!INTEGERP (elt))
+      if (!FIXNUMP (elt))
        return 0;
       else
        {
-         int modifiers = XINT (elt) & (CHAR_MODIFIER_MASK & ~CHAR_META);
+         int modifiers = XFIXNUM (elt) & (CHAR_MODIFIER_MASK & ~CHAR_META);
          if (modifiers == where_is_preferred_modifier)
            result = 2;
          else if (modifiers)
@@ -2373,10 +2373,10 @@ shadow_lookup (Lisp_Object shadow, Lisp_Object key, 
Lisp_Object flag,
   for (tail = shadow; CONSP (tail); tail = XCDR (tail))
     {
       value = Flookup_key (XCAR (tail), key, flag);
-      if (NATNUMP (value))
+      if (FIXNATP (value))
        {
          value = Flookup_key (XCAR (tail),
-                              Fsubstring (key, make_number (0), value), flag);
+                              Fsubstring (key, make_fixnum (0), value), flag);
          if (!NILP (value))
            return Qnil;
        }
@@ -2463,13 +2463,13 @@ where_is_internal (Lisp_Object definition, Lisp_Object 
keymaps,
 
       this = Fcar (XCAR (maps));
       map  = Fcdr (XCAR (maps));
-      last = make_number (XINT (Flength (this)) - 1);
-      last_is_meta = (XINT (last) >= 0
+      last = make_fixnum (XFIXNUM (Flength (this)) - 1);
+      last_is_meta = (XFIXNUM (last) >= 0
                      && EQ (Faref (this, last), meta_prefix_char));
 
       /* if (nomenus && !preferred_sequence_p (this)) */
-      if (nomenus && XINT (last) >= 0
-         && SYMBOLP (tem = Faref (this, make_number (0)))
+      if (nomenus && XFIXNUM (last) >= 0
+         && SYMBOLP (tem = Faref (this, make_fixnum (0)))
          && !NILP (Fmemq (XCAR (parse_modifiers (tem)), Vmouse_events)))
        /* If no menu entries should be returned, skip over the
           keymaps bound to `menu-bar' and `tool-bar' and other
@@ -2646,9 +2646,9 @@ The optional 5th arg NO-REMAP alters how command 
remapping is handled:
       if (! NILP (sequence))
        {
          Lisp_Object tem1;
-         tem1 = Faref (sequence, make_number (ASIZE (sequence) - 1));
+         tem1 = Faref (sequence, make_fixnum (ASIZE (sequence) - 1));
          if (STRINGP (tem1))
-           Faset (sequence, make_number (ASIZE (sequence) - 1),
+           Faset (sequence, make_fixnum (ASIZE (sequence) - 1),
                   build_string ("(any string)"));
        }
 
@@ -2717,10 +2717,10 @@ where_is_internal_1 (Lisp_Object key, Lisp_Object 
binding, Lisp_Object args, voi
     return;
 
   /* We have found a match.  Construct the key sequence where we found it.  */
-  if (INTEGERP (key) && last_is_meta)
+  if (FIXNUMP (key) && last_is_meta)
     {
       sequence = Fcopy_sequence (this);
-      Faset (sequence, last, make_number (XINT (key) | meta_modifier));
+      Faset (sequence, last, make_fixnum (XFIXNUM (key) | meta_modifier));
     }
   else
     {
@@ -2786,7 +2786,7 @@ You type        Translation\n\
 
            bufend = push_key_description (translate[c], buf);
            insert (buf, bufend - buf);
-           Findent_to (make_number (16), make_number (1));
+           Findent_to (make_fixnum (16), make_fixnum (1));
            bufend = push_key_description (c, buf);
            insert (buf, bufend - buf);
 
@@ -2962,7 +2962,7 @@ key             binding\n\
          elt_prefix = Fcar (elt);
          if (ASIZE (elt_prefix) >= 1)
            {
-             tem = Faref (elt_prefix, make_number (0));
+             tem = Faref (elt_prefix, make_fixnum (0));
              if (EQ (tem, Qmenu_bar))
                maps = Fdelq (elt, maps);
            }
@@ -3011,7 +3011,7 @@ key             binding\n\
          else
            {
              shmap = Flookup_key (shmap, Fcar (elt), Qt);
-             if (INTEGERP (shmap))
+             if (FIXNUMP (shmap))
                shmap = Qnil;
            }
 
@@ -3066,7 +3066,7 @@ describe_command (Lisp_Object definition, Lisp_Object 
args)
   else
     description_column = 16;
 
-  Findent_to (make_number (description_column), make_number (1));
+  Findent_to (make_fixnum (description_column), make_fixnum (1));
   previous_description_column = description_column;
 
   if (SYMBOLP (definition))
@@ -3088,7 +3088,7 @@ describe_translation (Lisp_Object definition, Lisp_Object 
args)
 {
   register Lisp_Object tem1;
 
-  Findent_to (make_number (16), make_number (1));
+  Findent_to (make_fixnum (16), make_fixnum (1));
 
   if (SYMBOLP (definition))
     {
@@ -3125,12 +3125,12 @@ static int
 describe_map_compare (const void *aa, const void *bb)
 {
   const struct describe_map_elt *a = aa, *b = bb;
-  if (INTEGERP (a->event) && INTEGERP (b->event))
-    return ((XINT (a->event) > XINT (b->event))
-           - (XINT (a->event) < XINT (b->event)));
-  if (!INTEGERP (a->event) && INTEGERP (b->event))
+  if (FIXNUMP (a->event) && FIXNUMP (b->event))
+    return ((XFIXNUM (a->event) > XFIXNUM (b->event))
+           - (XFIXNUM (a->event) < XFIXNUM (b->event)));
+  if (!FIXNUMP (a->event) && FIXNUMP (b->event))
     return 1;
-  if (INTEGERP (a->event) && !INTEGERP (b->event))
+  if (FIXNUMP (a->event) && !FIXNUMP (b->event))
     return -1;
   if (SYMBOLP (a->event) && SYMBOLP (b->event))
     return (!NILP (Fstring_lessp (a->event, b->event)) ? -1
@@ -3170,7 +3170,7 @@ describe_map (Lisp_Object map, Lisp_Object prefix,
   /* This vector gets used to present single keys to Flookup_key.  Since
      that is done once per keymap element, we don't want to cons up a
      fresh vector every time.  */
-  kludge = Fmake_vector (make_number (1), Qnil);
+  kludge = Fmake_vector (make_fixnum (1), Qnil);
   definition = Qnil;
 
   map = call1 (Qkeymap_canonicalize, map);
@@ -3198,7 +3198,7 @@ describe_map (Lisp_Object map, Lisp_Object prefix,
 
          /* Ignore bindings whose "prefix" are not really valid events.
             (We get these in the frames and buffers menu.)  */
-         if (!(SYMBOLP (event) || INTEGERP (event)))
+         if (!(SYMBOLP (event) || FIXNUMP (event)))
            continue;
 
          if (nomenu && EQ (event, Qmenu_bar))
@@ -3282,10 +3282,10 @@ describe_map (Lisp_Object map, Lisp_Object prefix,
       definition = vect[i].definition;
 
       /* Find consecutive chars that are identically defined.  */
-      if (INTEGERP (vect[i].event))
+      if (FIXNUMP (vect[i].event))
        {
          while (i + 1 < slots_used
-                && EQ (vect[i+1].event, make_number (XINT (vect[i].event) + 1))
+                && EQ (vect[i+1].event, make_fixnum (XFIXNUM (vect[i].event) + 
1))
                 && !NILP (Fequal (vect[i + 1].definition, definition))
                 && vect[i].shadowed == vect[i + 1].shadowed)
            i++;
@@ -3328,7 +3328,7 @@ describe_map (Lisp_Object map, Lisp_Object prefix,
 static void
 describe_vector_princ (Lisp_Object elt, Lisp_Object fun)
 {
-  Findent_to (make_number (16), make_number (1));
+  Findent_to (make_fixnum (16), make_fixnum (1));
   call1 (fun, elt);
   Fterpri (Qnil, Qnil);
 }
@@ -3407,7 +3407,7 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, 
Lisp_Object args,
   if (!keymap_p)
     {
       /* Call Fkey_description first, to avoid GC bug for the other string.  */
-      if (!NILP (prefix) && XFASTINT (Flength (prefix)) > 0)
+      if (!NILP (prefix) && XFIXNAT (Flength (prefix)) > 0)
        {
          Lisp_Object tem = Fkey_description (prefix, Qnil);
          AUTO_STRING (space, " ");
@@ -3419,7 +3419,7 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, 
Lisp_Object args,
   /* This vector gets used to present single keys to Flookup_key.  Since
      that is done once per vector element, we don't want to cons up a
      fresh vector every time.  */
-  kludge = Fmake_vector (make_number (1), Qnil);
+  kludge = Fmake_vector (make_fixnum (1), Qnil);
 
   if (partial)
     suppress = intern ("suppress-keymap");
@@ -3469,7 +3469,7 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, 
Lisp_Object args,
          if (!NILP (tem)) continue;
        }
 
-      character = make_number (starting_i);
+      character = make_fixnum (starting_i);
       ASET (kludge, 0, character);
 
       /* If this binding is shadowed by some other map, ignore it.  */
@@ -3541,7 +3541,7 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, 
Lisp_Object args,
        {
          insert (" .. ", 4);
 
-         ASET (kludge, 0, make_number (i));
+         ASET (kludge, 0, make_fixnum (i));
 
          if (!NILP (elt_prefix))
            insert1 (elt_prefix);
@@ -3618,7 +3618,7 @@ syms_of_keymap (void)
 
   /* Now we are ready to set up this property, so we can
      create char tables.  */
-  Fput (Qkeymap, Qchar_table_extra_slots, make_number (0));
+  Fput (Qkeymap, Qchar_table_extra_slots, make_fixnum (0));
 
   /* Initialize the keymaps standardly used.
      Each one is the value of a Lisp variable, and is also
@@ -3719,7 +3719,7 @@ be preferred.  */);
   DEFSYM (Qremap, "remap");
   DEFSYM (QCadvertised_binding, ":advertised-binding");
 
-  command_remapping_vector = Fmake_vector (make_number (2), Qremap);
+  command_remapping_vector = Fmake_vector (make_fixnum (2), Qremap);
   staticpro (&command_remapping_vector);
 
   where_is_cache_keymaps = Qt;
diff --git a/src/kqueue.c b/src/kqueue.c
index 7a4f6a4..bc01ab5 100644
--- a/src/kqueue.c
+++ b/src/kqueue.c
@@ -55,15 +55,15 @@ kqueue_directory_listing (Lisp_Object directory_files)
 
     result = Fcons
       (list5 (/* inode.  */
-             Fnth (make_number (11), XCAR (dl)),
+             Fnth (make_fixnum (11), XCAR (dl)),
              /* filename.  */
              XCAR (XCAR (dl)),
              /* last modification time.  */
-             Fnth (make_number (6), XCAR (dl)),
+             Fnth (make_fixnum (6), XCAR (dl)),
              /* last status change time.  */
-             Fnth (make_number (7), XCAR (dl)),
+             Fnth (make_fixnum (7), XCAR (dl)),
              /* size.  */
-             Fnth (make_number (8), XCAR (dl))),
+             Fnth (make_fixnum (8), XCAR (dl))),
        result);
   }
   return result;
@@ -78,7 +78,7 @@ kqueue_generate_event (Lisp_Object watch_object, Lisp_Object 
actions,
   struct input_event event;
 
   /* Check, whether all actions shall be monitored.  */
-  flags = Fnth (make_number (2), watch_object);
+  flags = Fnth (make_fixnum (2), watch_object);
   action = actions;
   do {
     if (NILP (action))
@@ -101,7 +101,7 @@ kqueue_generate_event (Lisp_Object watch_object, 
Lisp_Object actions,
                                     NILP (file1)
                                     ? Fcons (file, Qnil)
                                     : list2 (file, file1))),
-                      Fnth (make_number (3), watch_object));
+                      Fnth (make_fixnum (3), watch_object));
     kbd_buffer_store_event (&event);
   }
 }
@@ -121,7 +121,7 @@ kqueue_compare_dir_list (Lisp_Object watch_object)
   pending_dl = Qnil;
   deleted_dl = Qnil;
 
-  old_directory_files = Fnth (make_number (4), watch_object);
+  old_directory_files = Fnth (make_fixnum (4), watch_object);
   old_dl = kqueue_directory_listing (old_directory_files);
 
   /* When the directory is not accessible anymore, it has been deleted.  */
@@ -155,14 +155,14 @@ kqueue_compare_dir_list (Lisp_Object watch_object)
       if (strcmp (SSDATA (XCAR (XCDR (old_entry))),
                  SSDATA (XCAR (XCDR (new_entry)))) == 0) {
        /* Modification time has been changed, the file has been written.  */
-       if (NILP (Fequal (Fnth (make_number (2), old_entry),
-                         Fnth (make_number (2), new_entry))))
+       if (NILP (Fequal (Fnth (make_fixnum (2), old_entry),
+                         Fnth (make_fixnum (2), new_entry))))
          kqueue_generate_event
            (watch_object, Fcons (Qwrite, Qnil), XCAR (XCDR (old_entry)), Qnil);
        /* Status change time has been changed, the file attributes
           have changed.  */
-         if (NILP (Fequal (Fnth (make_number (3), old_entry),
-                           Fnth (make_number (3), new_entry))))
+         if (NILP (Fequal (Fnth (make_fixnum (3), old_entry),
+                           Fnth (make_fixnum (3), new_entry))))
          kqueue_generate_event
            (watch_object, Fcons (Qattrib, Qnil),
             XCAR (XCDR (old_entry)), Qnil);
@@ -233,8 +233,8 @@ kqueue_compare_dir_list (Lisp_Object watch_object)
       (watch_object, Fcons (Qcreate, Qnil), XCAR (XCDR (entry)), Qnil);
 
     /* Check size of that file.  */
-    Lisp_Object size = Fnth (make_number (4), entry);
-    if (FLOATP (size) || (XINT (size) > 0))
+    Lisp_Object size = Fnth (make_fixnum (4), entry);
+    if (FLOATP (size) || (XFIXNUM (size) > 0))
       kqueue_generate_event
        (watch_object, Fcons (Qwrite, Qnil), XCAR (XCDR (entry)), Qnil);
 
@@ -270,7 +270,7 @@ kqueue_compare_dir_list (Lisp_Object watch_object)
     report_file_error ("Pending events list not empty", pending_dl);
 
   /* Replace old directory listing with the new one.  */
-  XSETCDR (Fnthcdr (make_number (3), watch_object),
+  XSETCDR (Fnthcdr (make_fixnum (3), watch_object),
           Fcons (new_directory_files, Qnil));
   return;
 }
@@ -293,7 +293,7 @@ kqueue_callback (int fd, void *data)
     }
 
     /* Determine descriptor and file name.  */
-    descriptor = make_number (kev.ident);
+    descriptor = make_fixnum (kev.ident);
     watch_object = assq_no_quit (descriptor, watch_list);
     if (CONSP (watch_object))
       file = XCAR (XCDR (watch_object));
@@ -306,7 +306,7 @@ kqueue_callback (int fd, void *data)
       actions = Fcons (Qdelete, actions);
     if (kev.fflags & NOTE_WRITE) {
       /* Check, whether this is a directory event.  */
-      if (NILP (Fnth (make_number (4), watch_object)))
+      if (NILP (Fnth (make_fixnum (4), watch_object)))
        actions = Fcons (Qwrite, actions);
       else
        kqueue_compare_dir_list (watch_object);
@@ -395,7 +395,7 @@ only when the upper directory of the renamed file is 
watched.  */)
     maxfd = 256;
 
   /* We assume 50 file descriptors are sufficient for the rest of Emacs.  */
-  if ((maxfd - 50) < XINT (Flength (watch_list)))
+  if ((maxfd - 50) < XFIXNUM (Flength (watch_list)))
     xsignal2
       (Qfile_notify_error,
        build_string ("File watching not possible, no file descriptor left"),
@@ -449,7 +449,7 @@ only when the upper directory of the renamed file is 
watched.  */)
   }
 
   /* Store watch object in watch list.  */
-  Lisp_Object watch_descriptor = make_number (fd);
+  Lisp_Object watch_descriptor = make_fixnum (fd);
   if (NILP (Ffile_directory_p (file)))
     watch_object = list4 (watch_descriptor, file, flags, callback);
   else {
@@ -473,8 +473,8 @@ WATCH-DESCRIPTOR should be an object returned by 
`kqueue-add-watch'.  */)
     xsignal2 (Qfile_notify_error, build_string ("Not a watch descriptor"),
              watch_descriptor);
 
-  eassert (INTEGERP (watch_descriptor));
-  int fd = XINT (watch_descriptor);
+  eassert (FIXNUMP (watch_descriptor));
+  int fd = XFIXNUM (watch_descriptor);
   if ( fd >= 0)
     emacs_close (fd);
 
diff --git a/src/lcms.c b/src/lcms.c
index 3dcb77c..a3a9822 100644
--- a/src/lcms.c
+++ b/src/lcms.c
@@ -92,7 +92,7 @@ static bool
 parse_lab_list (Lisp_Object lab_list, cmsCIELab *color)
 {
 #define PARSE_LAB_LIST_FIELD(field)                                    \
-  if (CONSP (lab_list) && NUMBERP (XCAR (lab_list)))                   \
+  if (CONSP (lab_list) && FIXED_OR_FLOATP (XCAR (lab_list)))                   
\
     {                                                                  \
       color->field = XFLOATINT (XCAR (lab_list));                      \
       lab_list = XCDR (lab_list);                                      \
@@ -137,15 +137,15 @@ chroma, and hue, respectively. The parameters each 
default to 1.  */)
     signal_error ("Invalid color", color1);
   if (NILP (kL))
     Kl = 1.0f;
-  else if (!(NUMBERP (kL) && (Kl = XFLOATINT(kL))))
+  else if (!(FIXED_OR_FLOATP (kL) && (Kl = XFLOATINT(kL))))
     wrong_type_argument(Qnumberp, kL);
   if (NILP (kC))
     Kc = 1.0f;
-  else if (!(NUMBERP (kC) && (Kc = XFLOATINT(kC))))
+  else if (!(FIXED_OR_FLOATP (kC) && (Kc = XFLOATINT(kC))))
     wrong_type_argument(Qnumberp, kC);
   if (NILP (kL))
     Kh = 1.0f;
-  else if (!(NUMBERP (kH) && (Kh = XFLOATINT(kH))))
+  else if (!(FIXED_OR_FLOATP (kH) && (Kh = XFLOATINT(kH))))
     wrong_type_argument(Qnumberp, kH);
 
   return make_float (cmsCIE2000DeltaE (&Lab1, &Lab2, Kl, Kc, Kh));
@@ -183,7 +183,7 @@ static bool
 parse_xyz_list (Lisp_Object xyz_list, cmsCIEXYZ *color)
 {
 #define PARSE_XYZ_LIST_FIELD(field)                                    \
-  if (CONSP (xyz_list) && NUMBERP (XCAR (xyz_list)))                   \
+  if (CONSP (xyz_list) && FIXED_OR_FLOATP (XCAR (xyz_list)))                   
\
     {                                                                  \
       color->field = 100.0 * XFLOATINT (XCAR (xyz_list));              \
       xyz_list = XCDR (xyz_list);                                      \
@@ -202,7 +202,7 @@ static bool
 parse_jch_list (Lisp_Object jch_list, cmsJCh *color)
 {
 #define PARSE_JCH_LIST_FIELD(field)                                    \
-  if (CONSP (jch_list) && NUMBERP (XCAR (jch_list)))                   \
+  if (CONSP (jch_list) && FIXED_OR_FLOATP (XCAR (jch_list)))                   
\
     {                                                                  \
       color->field = XFLOATINT (XCAR (jch_list));                      \
       jch_list = XCDR (jch_list);                                      \
@@ -223,7 +223,7 @@ static bool
 parse_jab_list (Lisp_Object jab_list, lcmsJab_t *color)
 {
 #define PARSE_JAB_LIST_FIELD(field)                                    \
-  if (CONSP (jab_list) && NUMBERP (XCAR (jab_list)))                   \
+  if (CONSP (jab_list) && FIXED_OR_FLOATP (XCAR (jab_list)))                   
\
     {                                                                  \
       color->field = XFLOATINT (XCAR (jab_list));                      \
       jab_list = XCDR (jab_list);                                      \
@@ -243,7 +243,7 @@ parse_viewing_conditions (Lisp_Object view, const cmsCIEXYZ 
*wp,
                           cmsViewingConditions *vc)
 {
 #define PARSE_VIEW_CONDITION_FLOAT(field)                              \
-  if (CONSP (view) && NUMBERP (XCAR (view)))                           \
+  if (CONSP (view) && FIXED_OR_FLOATP (XCAR (view)))                           
\
     {                                                                  \
       vc->field = XFLOATINT (XCAR (view));                             \
       view = XCDR (view);                                              \
@@ -251,10 +251,10 @@ parse_viewing_conditions (Lisp_Object view, const 
cmsCIEXYZ *wp,
   else                                                                 \
     return false;
 #define PARSE_VIEW_CONDITION_INT(field)                                        
\
-  if (CONSP (view) && NATNUMP (XCAR (view)))                           \
+  if (CONSP (view) && FIXNATP (XCAR (view)))                           \
     {                                                                  \
       CHECK_RANGED_INTEGER (XCAR (view), 1, 4);                                
\
-      vc->field = XINT (XCAR (view));                                  \
+      vc->field = XFIXNUM (XCAR (view));                                       
\
       view = XCDR (view);                                              \
     }                                                                  \
   else                                                                 \
@@ -554,7 +554,7 @@ Valid range of TEMPERATURE is from 4000K to 25000K.  */)
     }
 #endif
 
-  CHECK_NUMBER_OR_FLOAT (temperature);
+  CHECK_FIXNUM_OR_FLOAT (temperature);
 
   tempK = XFLOATINT (temperature);
   if (!(cmsWhitePointFromTemp (&whitepoint, tempK)))
diff --git a/src/lisp.h b/src/lisp.h
index bdece81..f2cfe81 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -30,6 +30,11 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include <float.h>
 #include <inttypes.h>
 #include <limits.h>
+#ifdef HAVE_GMP
+#include <gmp.h>
+#else
+#include "mini-gmp.h"
+#endif
 
 #include <intprops.h>
 #include <verify.h>
@@ -352,16 +357,14 @@ typedef EMACS_INT Lisp_Word;
 # endif
 #endif
 
-#define lisp_h_CHECK_NUMBER(x) CHECK_TYPE (INTEGERP (x), Qintegerp, x)
+#define lisp_h_CHECK_FIXNUM(x) CHECK_TYPE (FIXNUMP (x), Qfixnump, x)
 #define lisp_h_CHECK_SYMBOL(x) CHECK_TYPE (SYMBOLP (x), Qsymbolp, x)
 #define lisp_h_CHECK_TYPE(ok, predicate, x) \
    ((ok) ? (void) 0 : wrong_type_argument (predicate, x))
 #define lisp_h_CONSP(x) (XTYPE (x) == Lisp_Cons)
 #define lisp_h_EQ(x, y) (XLI (x) == XLI (y))
 #define lisp_h_FLOATP(x) (XTYPE (x) == Lisp_Float)
-#define lisp_h_INTEGERP(x) ((XTYPE (x) & (Lisp_Int0 | ~Lisp_Int1)) == 
Lisp_Int0)
-#define lisp_h_MARKERP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Marker)
-#define lisp_h_MISCP(x) (XTYPE (x) == Lisp_Misc)
+#define lisp_h_FIXNUMP(x) ((XTYPE (x) & (Lisp_Int0 | ~Lisp_Int1)) == Lisp_Int0)
 #define lisp_h_NILP(x) EQ (x, Qnil)
 #define lisp_h_SET_SYMBOL_VAL(sym, v) \
    (eassert ((sym)->u.s.redirect == SYMBOL_PLAINVAL), \
@@ -377,15 +380,15 @@ typedef EMACS_INT Lisp_Word;
 #define lisp_h_XCDR(c) XCONS (c)->u.s.u.cdr
 #define lisp_h_XCONS(a) \
    (eassert (CONSP (a)), XUNTAG (a, Lisp_Cons, struct Lisp_Cons))
-#define lisp_h_XHASH(a) XUINT (a)
+#define lisp_h_XHASH(a) XUFIXNUM (a)
 #ifndef GC_CHECK_CONS_LIST
 # define lisp_h_check_cons_list() ((void) 0)
 #endif
 #if USE_LSB_TAG
-# define lisp_h_make_number(n) \
+# define lisp_h_make_fixnum(n) \
     XIL ((EMACS_INT) (((EMACS_UINT) (n) << INTTYPEBITS) + Lisp_Int0))
-# define lisp_h_XFASTINT(a) XINT (a)
-# define lisp_h_XINT(a) (XLI (a) >> INTTYPEBITS)
+# define lisp_h_XFIXNAT(a) XFIXNUM (a)
+# define lisp_h_XFIXNUM(a) (XLI (a) >> INTTYPEBITS)
 # ifdef __CHKP__
 #  define lisp_h_XSYMBOL(a) \
     (eassert (SYMBOLP (a)), \
@@ -418,15 +421,13 @@ typedef EMACS_INT Lisp_Word;
 # define XIL(i) lisp_h_XIL (i)
 # define XLP(o) lisp_h_XLP (o)
 # define XPL(p) lisp_h_XPL (p)
-# define CHECK_NUMBER(x) lisp_h_CHECK_NUMBER (x)
+# define CHECK_FIXNUM(x) lisp_h_CHECK_FIXNUM (x)
 # define CHECK_SYMBOL(x) lisp_h_CHECK_SYMBOL (x)
 # define CHECK_TYPE(ok, predicate, x) lisp_h_CHECK_TYPE (ok, predicate, x)
 # define CONSP(x) lisp_h_CONSP (x)
 # define EQ(x, y) lisp_h_EQ (x, y)
 # define FLOATP(x) lisp_h_FLOATP (x)
-# define INTEGERP(x) lisp_h_INTEGERP (x)
-# define MARKERP(x) lisp_h_MARKERP (x)
-# define MISCP(x) lisp_h_MISCP (x)
+# define FIXNUMP(x) lisp_h_FIXNUMP (x)
 # define NILP(x) lisp_h_NILP (x)
 # define SET_SYMBOL_VAL(sym, v) lisp_h_SET_SYMBOL_VAL (sym, v)
 # define SYMBOL_CONSTANT_P(sym) lisp_h_SYMBOL_CONSTANT_P (sym)
@@ -442,9 +443,9 @@ typedef EMACS_INT Lisp_Word;
 #  define check_cons_list() lisp_h_check_cons_list ()
 # endif
 # if USE_LSB_TAG
-#  define make_number(n) lisp_h_make_number (n)
-#  define XFASTINT(a) lisp_h_XFASTINT (a)
-#  define XINT(a) lisp_h_XINT (a)
+#  define make_fixnum(n) lisp_h_make_fixnum (n)
+#  define XFIXNAT(a) lisp_h_XFIXNAT (a)
+#  define XFIXNUM(a) lisp_h_XFIXNUM (a)
 #  define XSYMBOL(a) lisp_h_XSYMBOL (a)
 #  define XTYPE(a) lisp_h_XTYPE (a)
 # endif
@@ -477,11 +478,9 @@ enum Lisp_Type
     /* Symbol.  XSYMBOL (object) points to a struct Lisp_Symbol.  */
     Lisp_Symbol = 0,
 
-    /* Miscellaneous.  XMISC (object) points to a union Lisp_Misc,
-       whose first member indicates the subtype.  */
-    Lisp_Misc = 1,
+    /* Type 1 is currently unused.  */
 
-    /* Integer.  XINT (obj) is the integer value.  */
+    /* Fixnum.  XFIXNUM (obj) is the integer value.  */
     Lisp_Int0 = 2,
     Lisp_Int1 = USE_LSB_TAG ? 6 : 3,
 
@@ -501,25 +500,6 @@ enum Lisp_Type
     Lisp_Float = 7
   };
 
-/* This is the set of data types that share a common structure.
-   The first member of the structure is a type code from this set.
-   The enum values are arbitrary, but we'll use large numbers to make it
-   more likely that we'll spot the error if a random word in memory is
-   mistakenly interpreted as a Lisp_Misc.  */
-enum Lisp_Misc_Type
-  {
-    Lisp_Misc_Free = 0x5eab,
-    Lisp_Misc_Marker,
-    Lisp_Misc_Overlay,
-    Lisp_Misc_Finalizer,
-    Lisp_Misc_Ptr,
-#ifdef HAVE_MODULES
-    Lisp_Misc_User_Ptr,
-#endif
-    /* This is not a type code.  It is for range checking.  */
-    Lisp_Misc_Limit
-  };
-
 /* These are the types of forwarding objects used in the value slot
    of symbols for special built-in variables whose value is stored in
    C variables.  */
@@ -533,14 +513,12 @@ enum Lisp_Fwd_Type
   };
 
 /* If you want to define a new Lisp data type, here are some
-   instructions.  See the thread at
-   https://lists.gnu.org/r/emacs-devel/2012-10/msg00561.html
-   for more info.
+   instructions.
 
    First, there are already a couple of Lisp types that can be used if
    your new type does not need to be exposed to Lisp programs nor
-   displayed to users.  These are Lisp_Misc_Ptr, a Lisp_Misc
-   subtype; and PVEC_OTHER, a kind of vectorlike object.  The former
+   displayed to users.  These are Lisp_Misc_Ptr and PVEC_OTHER,
+   which are both vectorlike objects.  The former
    is suitable for stashing a pointer in a Lisp object; the pointer
    might be to some low-level C object that contains auxiliary
    information.  The latter is useful for vector-like Lisp objects
@@ -551,30 +529,14 @@ enum Lisp_Fwd_Type
    These two types don't look pretty when printed, so they are
    unsuitable for Lisp objects that can be exposed to users.
 
-   To define a new data type, add one more Lisp_Misc subtype or one
-   more pseudovector subtype.  Pseudovectors are more suitable for
-   objects with several slots that need to support fast random access,
-   while Lisp_Misc types are for everything else.  A pseudovector object
-   provides one or more slots for Lisp objects, followed by struct
-   members that are accessible only from C.  A Lisp_Misc object is a
-   wrapper for a C struct that can contain anything you like.
+   To define a new data type, add a pseudovector subtype by extending
+   the pvec_type enumeration.  A pseudovector provides one or more
+   slots for Lisp objects, followed by struct members that are
+   accessible only from C.
 
    There is no way to explicitly free a Lisp Object; only the garbage
    collector frees them.
 
-   To add a new pseudovector type, extend the pvec_type enumeration;
-   to add a new Lisp_Misc, extend the Lisp_Misc_Type enumeration.
-
-   For a Lisp_Misc, you will also need to add your entry to union
-   Lisp_Misc, but make sure the first word has the same structure as
-   the others, starting with a 16-bit member of the Lisp_Misc_Type
-   enumeration and a 1-bit GC markbit.  Also make sure the overall
-   size of the union is not increased by your addition.  The latter
-   requirement is to keep Lisp_Misc objects small enough, so they
-   are handled faster: since all Lisp_Misc types use the same space,
-   enlarging any of them will affect all the rest.  If you really
-   need a larger object, it is best to use Lisp_Vectorlike instead.
-
    For a new pseudovector, it's highly desirable to limit the size
    of your data type by VBLOCK_BYTES_MAX bytes (defined in alloc.c).
    Otherwise you will need to change sweep_vectors (also in alloc.c).
@@ -887,6 +849,8 @@ union vectorlike_header
         Current layout limits the pseudovectors to 63 PVEC_xxx subtypes,
         4095 Lisp_Objects in GC-ed area and 4095 word-sized other slots.  */
     ptrdiff_t size;
+    /* Align the union so that there is no padding after it.  */
+    Lisp_Object align;
     GCALIGNED_UNION
   };
 verify (alignof (union vectorlike_header) % GCALIGNMENT == 0);
@@ -967,6 +931,14 @@ enum pvec_type
 {
   PVEC_NORMAL_VECTOR,
   PVEC_FREE,
+  PVEC_BIGNUM,
+  PVEC_MARKER,
+  PVEC_OVERLAY,
+  PVEC_FINALIZER,
+  PVEC_MISC_PTR,
+#ifdef HAVE_MODULES
+  PVEC_USER_PTR,
+#endif
   PVEC_PROCESS,
   PVEC_FRAME,
   PVEC_WINDOW,
@@ -1026,21 +998,21 @@ enum More_Lisp_Bits
 #if USE_LSB_TAG
 
 INLINE Lisp_Object
-(make_number) (EMACS_INT n)
+(make_fixnum) (EMACS_INT n)
 {
-  return lisp_h_make_number (n);
+  return lisp_h_make_fixnum (n);
 }
 
 INLINE EMACS_INT
-(XINT) (Lisp_Object a)
+(XFIXNUM) (Lisp_Object a)
 {
-  return lisp_h_XINT (a);
+  return lisp_h_XFIXNUM (a);
 }
 
 INLINE EMACS_INT
-(XFASTINT) (Lisp_Object a)
+(XFIXNAT) (Lisp_Object a)
 {
-  EMACS_INT n = lisp_h_XFASTINT (a);
+  EMACS_INT n = lisp_h_XFIXNAT (a);
   eassume (0 <= n);
   return n;
 }
@@ -1054,7 +1026,7 @@ INLINE EMACS_INT
 /* Make a Lisp integer representing the value of the low order
    bits of N.  */
 INLINE Lisp_Object
-make_number (EMACS_INT n)
+make_fixnum (EMACS_INT n)
 {
   EMACS_INT int0 = Lisp_Int0;
   if (USE_LSB_TAG)
@@ -1073,7 +1045,7 @@ make_number (EMACS_INT n)
 
 /* Extract A's value as a signed integer.  */
 INLINE EMACS_INT
-XINT (Lisp_Object a)
+XFIXNUM (Lisp_Object a)
 {
   EMACS_INT i = XLI (a);
   if (! USE_LSB_TAG)
@@ -1084,14 +1056,14 @@ XINT (Lisp_Object a)
   return i >> INTTYPEBITS;
 }
 
-/* Like XINT (A), but may be faster.  A must be nonnegative.
+/* Like XFIXNUM (A), but may be faster.  A must be nonnegative.
    If ! USE_LSB_TAG, this takes advantage of the fact that Lisp
    integers have zero-bits in their tags.  */
 INLINE EMACS_INT
-XFASTINT (Lisp_Object a)
+XFIXNAT (Lisp_Object a)
 {
   EMACS_INT int0 = Lisp_Int0;
-  EMACS_INT n = USE_LSB_TAG ? XINT (a) : XLI (a) - (int0 << VALBITS);
+  EMACS_INT n = USE_LSB_TAG ? XFIXNUM (a) : XLI (a) - (int0 << VALBITS);
   eassume (0 <= n);
   return n;
 }
@@ -1100,14 +1072,14 @@ XFASTINT (Lisp_Object a)
 
 /* Extract A's value as an unsigned integer.  */
 INLINE EMACS_UINT
-XUINT (Lisp_Object a)
+XUFIXNUM (Lisp_Object a)
 {
   EMACS_UINT i = XLI (a);
   return USE_LSB_TAG ? i >> INTTYPEBITS : i & INTMASK;
 }
 
-/* Return A's (Lisp-integer sized) hash.  Happens to be like XUINT
-   right now, but XUINT should only be applied to objects we know are
+/* Return A's (Lisp-integer sized) hash.  Happens to be like XUFIXNUM
+   right now, but XUFIXNUM should only be applied to objects we know are
    integers.  */
 
 INLINE EMACS_INT
@@ -1116,13 +1088,13 @@ INLINE EMACS_INT
   return lisp_h_XHASH (a);
 }
 
-/* Like make_number (N), but may be faster.  N must be in nonnegative range.  
*/
+/* Like make_fixnum (N), but may be faster.  N must be in nonnegative range.  
*/
 INLINE Lisp_Object
-make_natnum (EMACS_INT n)
+make_fixed_natnum (EMACS_INT n)
 {
   eassert (0 <= n && n <= MOST_POSITIVE_FIXNUM);
   EMACS_INT int0 = Lisp_Int0;
-  return USE_LSB_TAG ? make_number (n) : XIL (n + (int0 << VALBITS));
+  return USE_LSB_TAG ? make_fixnum (n) : XIL (n + (int0 << VALBITS));
 }
 
 /* Return true if X and Y are the same object.  */
@@ -1155,19 +1127,18 @@ make_lisp_ptr (void *ptr, enum Lisp_Type type)
 }
 
 INLINE bool
-(INTEGERP) (Lisp_Object x)
+(FIXNUMP) (Lisp_Object x)
 {
-  return lisp_h_INTEGERP (x);
+  return lisp_h_FIXNUMP (x);
 }
 
-#define XSETINT(a, b) ((a) = make_number (b))
-#define XSETFASTINT(a, b) ((a) = make_natnum (b))
+#define XSETINT(a, b) ((a) = make_fixnum (b))
+#define XSETFASTINT(a, b) ((a) = make_fixed_natnum (b))
 #define XSETCONS(a, b) ((a) = make_lisp_ptr (b, Lisp_Cons))
 #define XSETVECTOR(a, b) ((a) = make_lisp_ptr (b, Lisp_Vectorlike))
 #define XSETSTRING(a, b) ((a) = make_lisp_ptr (b, Lisp_String))
 #define XSETSYMBOL(a, b) ((a) = make_lisp_symbol (b))
 #define XSETFLOAT(a, b) ((a) = make_lisp_ptr (b, Lisp_Float))
-#define XSETMISC(a, b) ((a) = make_lisp_ptr (b, Lisp_Misc))
 
 /* Pseudovector types.  */
 
@@ -1212,16 +1183,23 @@ INLINE bool
    bits set, which makes this conversion inherently unportable.  */
 
 INLINE void *
-XINTPTR (Lisp_Object a)
+XFIXNUMPTR (Lisp_Object a)
 {
   return XUNTAG (a, Lisp_Int0, char);
 }
 
 INLINE Lisp_Object
-make_pointer_integer (void *p)
+make_pointer_integer_unsafe (void *p)
 {
   Lisp_Object a = TAG_PTR (Lisp_Int0, p);
-  eassert (INTEGERP (a) && XINTPTR (a) == p);
+  return a;
+}
+
+INLINE Lisp_Object
+make_pointer_integer (void *p)
+{
+  Lisp_Object a = make_pointer_integer_unsafe (p);
+  eassert (FIXNUMP (a) && XFIXNUMPTR (a) == p);
   return a;
 }
 
@@ -1606,6 +1584,7 @@ enum
     bool_header_size = offsetof (struct Lisp_Bool_Vector, data),
     word_size = sizeof (Lisp_Object)
   };
+verify (header_size == sizeof (union vectorlike_header));
 
 /* The number of data words and bytes in a bool vector with SIZE bits.  */
 
@@ -2267,46 +2246,10 @@ SXHASH_REDUCE (EMACS_UINT x)
   return (x ^ x >> (EMACS_INT_WIDTH - FIXNUM_BITS)) & INTMASK;
 }
 
-/* These structures are used for various misc types.  */
-
-struct Lisp_Misc_Any           /* Supertype of all Misc types.  */
-{
-  ENUM_BF (Lisp_Misc_Type) type : 16;          /* = Lisp_Misc_??? */
-  bool_bf gcmarkbit : 1;
-  unsigned spacer : 15;
-};
-
-INLINE bool
-(MISCP) (Lisp_Object x)
-{
-  return lisp_h_MISCP (x);
-}
-
-INLINE struct Lisp_Misc_Any *
-XMISCANY (Lisp_Object a)
-{
-  eassert (MISCP (a));
-  return XUNTAG (a, Lisp_Misc, struct Lisp_Misc_Any);
-}
-
-INLINE enum Lisp_Misc_Type
-XMISCTYPE (Lisp_Object a)
-{
-  return XMISCANY (a)->type;
-}
-
 struct Lisp_Marker
 {
-  ENUM_BF (Lisp_Misc_Type) type : 16;          /* = Lisp_Misc_Marker */
-  bool_bf gcmarkbit : 1;
-  unsigned spacer : 13;
-  /* This flag is temporarily used in the functions
-     decode/encode_coding_object to record that the marker position
-     must be adjusted after the conversion.  */
-  bool_bf need_adjustment : 1;
-  /* True means normal insertion at the marker's position
-     leaves the marker after the inserted text.  */
-  bool_bf insertion_type : 1;
+  union vectorlike_header header;
+
   /* This is the buffer that the marker points into, or 0 if it points nowhere.
      Note: a chain of markers can contain markers pointing into different
      buffers (the chain is per buffer_text rather than per buffer, so it's
@@ -2319,11 +2262,21 @@ struct Lisp_Marker
      */
   struct buffer *buffer;
 
+  /* This flag is temporarily used in the functions
+     decode/encode_coding_object to record that the marker position
+     must be adjusted after the conversion.  */
+  bool_bf need_adjustment : 1;
+  /* True means normal insertion at the marker's position
+     leaves the marker after the inserted text.  */
+  bool_bf insertion_type : 1;
+
   /* The remaining fields are meaningless in a marker that
      does not point anywhere.  */
 
   /* For markers that point somewhere,
-     this is used to chain of all the markers in a given buffer.  */
+     this is used to chain of all the markers in a given buffer.
+     The chain does not preserve markers from garbage collection;
+     instead, markers are removed from the chain when freed by GC.  */
   /* We could remove it and use an array in buffer_text instead.
      That would also allow us to preserve it ordered.  */
   struct Lisp_Marker *next;
@@ -2351,20 +2304,16 @@ struct Lisp_Overlay
    I.e. 9words plus 2 bits, 3words of which are for external linked lists.
 */
   {
-    ENUM_BF (Lisp_Misc_Type) type : 16;        /* = Lisp_Misc_Overlay */
-    bool_bf gcmarkbit : 1;
-    unsigned spacer : 15;
-    struct Lisp_Overlay *next;
+    union vectorlike_header header;
     Lisp_Object start;
     Lisp_Object end;
     Lisp_Object plist;
+    struct Lisp_Overlay *next;
   };
 
 struct Lisp_Misc_Ptr
   {
-    ENUM_BF (Lisp_Misc_Type) type : 16;        /* = Lisp_Misc_Ptr */
-    bool_bf gcmarkbit : 1;
-    unsigned spacer : 15;
+    union vectorlike_header header;
     void *pointer;
   };
 
@@ -2372,48 +2321,45 @@ extern Lisp_Object make_misc_ptr (void *);
 
 /* A mint_ptr object OBJ represents a C-language pointer P efficiently.
    Preferably (and typically), OBJ is a Lisp integer I such that
-   XINTPTR (I) == P, as this represents P within a single Lisp value
+   XFIXNUMPTR (I) == P, as this represents P within a single Lisp value
    without requiring any auxiliary memory.  However, if P would be
    damaged by being tagged as an integer and then untagged via
-   XINTPTR, then OBJ is a Lisp_Misc_Ptr with pointer component P.
+   XFIXNUMPTR, then OBJ is a Lisp_Misc_Ptr with pointer component P.
 
    mint_ptr objects are efficiency hacks intended for C code.
    Although xmint_ptr can be given any mint_ptr generated by non-buggy
    C code, it should not be given a mint_ptr generated from Lisp code
    as that would allow Lisp code to coin pointers from integers and
    could lead to crashes.  To package a C pointer into a Lisp-visible
-   object you can put the pointer into a Lisp_Misc object instead; see
+   object you can put the pointer into a pseudovector instead; see
    Lisp_User_Ptr for an example.  */
 
 INLINE Lisp_Object
 make_mint_ptr (void *a)
 {
   Lisp_Object val = TAG_PTR (Lisp_Int0, a);
-  return INTEGERP (val) && XINTPTR (val) == a ? val : make_misc_ptr (a);
+  return FIXNUMP (val) && XFIXNUMPTR (val) == a ? val : make_misc_ptr (a);
 }
 
 INLINE bool
 mint_ptrp (Lisp_Object x)
 {
-  return INTEGERP (x) || (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Ptr);
+  return FIXNUMP (x) || PSEUDOVECTORP (x, PVEC_MISC_PTR);
 }
 
 INLINE void *
 xmint_pointer (Lisp_Object a)
 {
   eassert (mint_ptrp (a));
-  if (INTEGERP (a))
-    return XINTPTR (a);
-  return XUNTAG (a, Lisp_Misc, struct Lisp_Misc_Ptr)->pointer;
+  if (FIXNUMP (a))
+    return XFIXNUMPTR (a);
+  return XUNTAG (a, Lisp_Vectorlike, struct Lisp_Misc_Ptr)->pointer;
 }
 
 #ifdef HAVE_MODULES
 struct Lisp_User_Ptr
 {
-  ENUM_BF (Lisp_Misc_Type) type : 16;       /* = Lisp_Misc_User_Ptr */
-  bool_bf gcmarkbit : 1;
-  unsigned spacer : 15;
-
+  union vectorlike_header header;
   void (*finalizer) (void *);
   void *p;
 };
@@ -2422,103 +2368,97 @@ struct Lisp_User_Ptr
 /* A finalizer sentinel.  */
 struct Lisp_Finalizer
   {
-    struct Lisp_Misc_Any base;
-
-    /* Circular list of all active weak references.  */
-    struct Lisp_Finalizer *prev;
-    struct Lisp_Finalizer *next;
+    union vectorlike_header header;
 
     /* Call FUNCTION when the finalizer becomes unreachable, even if
        FUNCTION contains a reference to the finalizer; i.e., call
        FUNCTION when it is reachable _only_ through finalizers.  */
     Lisp_Object function;
+
+    /* Circular list of all active weak references.  */
+    struct Lisp_Finalizer *prev;
+    struct Lisp_Finalizer *next;
   };
 
 INLINE bool
 FINALIZERP (Lisp_Object x)
 {
-  return MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Finalizer;
+  return PSEUDOVECTORP (x, PVEC_FINALIZER);
 }
 
 INLINE struct Lisp_Finalizer *
 XFINALIZER (Lisp_Object a)
 {
   eassert (FINALIZERP (a));
-  return XUNTAG (a, Lisp_Misc, struct Lisp_Finalizer);
-}
-
-/* A miscellaneous object, when it's on the free list.  */
-struct Lisp_Free
-  {
-    ENUM_BF (Lisp_Misc_Type) type : 16;        /* = Lisp_Misc_Free */
-    bool_bf gcmarkbit : 1;
-    unsigned spacer : 15;
-    union Lisp_Misc *chain;
-  };
-
-/* To get the type field of a union Lisp_Misc, use XMISCTYPE.
-   It uses one of these struct subtypes to get the type field.  */
-
-union Lisp_Misc
-  {
-    struct Lisp_Misc_Any u_any;           /* Supertype of all Misc types.  */
-    struct Lisp_Free u_free;
-    struct Lisp_Marker u_marker;
-    struct Lisp_Overlay u_overlay;
-    struct Lisp_Finalizer u_finalizer;
-    struct Lisp_Misc_Ptr u_misc_ptr;
-#ifdef HAVE_MODULES
-    struct Lisp_User_Ptr u_user_ptr;
-#endif
-  };
-
-INLINE union Lisp_Misc *
-XMISC (Lisp_Object a)
-{
-  return XUNTAG (a, Lisp_Misc, union Lisp_Misc);
+  return XUNTAG (a, Lisp_Vectorlike, struct Lisp_Finalizer);
 }
 
 INLINE bool
-(MARKERP) (Lisp_Object x)
+MARKERP (Lisp_Object x)
 {
-  return lisp_h_MARKERP (x);
+  return PSEUDOVECTORP (x, PVEC_MARKER);
 }
 
 INLINE struct Lisp_Marker *
 XMARKER (Lisp_Object a)
 {
   eassert (MARKERP (a));
-  return XUNTAG (a, Lisp_Misc, struct Lisp_Marker);
+  return XUNTAG (a, Lisp_Vectorlike, struct Lisp_Marker);
 }
 
 INLINE bool
 OVERLAYP (Lisp_Object x)
 {
-  return MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Overlay;
+  return PSEUDOVECTORP (x, PVEC_OVERLAY);
 }
 
 INLINE struct Lisp_Overlay *
 XOVERLAY (Lisp_Object a)
 {
   eassert (OVERLAYP (a));
-  return XUNTAG (a, Lisp_Misc, struct Lisp_Overlay);
+  return XUNTAG (a, Lisp_Vectorlike, struct Lisp_Overlay);
 }
 
 #ifdef HAVE_MODULES
 INLINE bool
 USER_PTRP (Lisp_Object x)
 {
-  return MISCP (x) && XMISCTYPE (x) == Lisp_Misc_User_Ptr;
+  return PSEUDOVECTORP (x, PVEC_USER_PTR);
 }
 
 INLINE struct Lisp_User_Ptr *
 XUSER_PTR (Lisp_Object a)
 {
   eassert (USER_PTRP (a));
-  return XUNTAG (a, Lisp_Misc, struct Lisp_User_Ptr);
+  return XUNTAG (a, Lisp_Vectorlike, struct Lisp_User_Ptr);
 }
 #endif
 
+struct Lisp_Bignum
+{
+  union vectorlike_header header;
+  mpz_t value;
+};
+
+INLINE bool
+BIGNUMP (Lisp_Object x)
+{
+  return PSEUDOVECTORP (x, PVEC_BIGNUM);
+}
+
+INLINE struct Lisp_Bignum *
+XBIGNUM (Lisp_Object a)
+{
+  eassert (BIGNUMP (a));
+  return XUNTAG (a, Lisp_Vectorlike, struct Lisp_Bignum);
+}
+
+INLINE bool
+INTEGERP (Lisp_Object x)
+{
+  return FIXNUMP (x) || BIGNUMP (x);
+}
+
 
 /* Forwarding pointer to an int variable.
    This is allowed only in the value cell of a symbol,
@@ -2556,7 +2496,7 @@ struct Lisp_Buffer_Objfwd
   {
     enum Lisp_Fwd_Type type;   /* = Lisp_Fwd_Buffer_Obj */
     int offset;
-    /* One of Qnil, Qintegerp, Qsymbolp, Qstringp, Qfloatp or Qnumberp.  */
+    /* One of Qnil, Qfixnump, Qsymbolp, Qstringp, Qfloatp or Qnumberp.  */
     Lisp_Object predicate;
   };
 
@@ -2722,26 +2662,38 @@ enum char_bits
 /* Data type checking.  */
 
 INLINE bool
-NUMBERP (Lisp_Object x)
+FIXED_OR_FLOATP (Lisp_Object x)
 {
-  return INTEGERP (x) || FLOATP (x);
+  return FIXNUMP (x) || FLOATP (x);
+}
+INLINE bool
+FIXNATP (Lisp_Object x)
+{
+  return FIXNUMP (x) && 0 <= XFIXNUM (x);
 }
 INLINE bool
 NATNUMP (Lisp_Object x)
 {
-  return INTEGERP (x) && 0 <= XINT (x);
+  if (BIGNUMP (x))
+    return mpz_sgn (XBIGNUM (x)->value) >= 0;
+  return FIXNUMP (x) && 0 <= XFIXNUM (x);
+}
+INLINE bool
+NUMBERP (Lisp_Object x)
+{
+  return INTEGERP (x) || FLOATP (x);
 }
 
 INLINE bool
-RANGED_INTEGERP (intmax_t lo, Lisp_Object x, intmax_t hi)
+RANGED_FIXNUMP (intmax_t lo, Lisp_Object x, intmax_t hi)
 {
-  return INTEGERP (x) && lo <= XINT (x) && XINT (x) <= hi;
+  return FIXNUMP (x) && lo <= XFIXNUM (x) && XFIXNUM (x) <= hi;
 }
 
-#define TYPE_RANGED_INTEGERP(type, x) \
-  (INTEGERP (x)                              \
-   && (TYPE_SIGNED (type) ? TYPE_MINIMUM (type) <= XINT (x) : 0 <= XINT (x)) \
-   && XINT (x) <= TYPE_MAXIMUM (type))
+#define TYPE_RANGED_FIXNUMP(type, x) \
+  (FIXNUMP (x)                       \
+   && (TYPE_SIGNED (type) ? TYPE_MINIMUM (type) <= XFIXNUM (x) : 0 <= XFIXNUM 
(x)) \
+   && XFIXNUM (x) <= TYPE_MAXIMUM (type))
 
 INLINE bool
 AUTOLOADP (Lisp_Object x)
@@ -2809,9 +2761,9 @@ CHECK_LIST_END (Lisp_Object x, Lisp_Object y)
 }
 
 INLINE void
-(CHECK_NUMBER) (Lisp_Object x)
+(CHECK_FIXNUM) (Lisp_Object x)
 {
-  lisp_h_CHECK_NUMBER (x);
+  lisp_h_CHECK_FIXNUM (x);
 }
 
 INLINE void
@@ -2835,21 +2787,21 @@ CHECK_ARRAY (Lisp_Object x, Lisp_Object predicate)
   CHECK_TYPE (ARRAYP (x), predicate, x);
 }
 INLINE void
-CHECK_NATNUM (Lisp_Object x)
+CHECK_FIXNAT (Lisp_Object x)
 {
-  CHECK_TYPE (NATNUMP (x), Qwholenump, x);
+  CHECK_TYPE (FIXNATP (x), Qwholenump, x);
 }
 
 #define CHECK_RANGED_INTEGER(x, lo, hi)                                        
\
   do {                                                                 \
-    CHECK_NUMBER (x);                                                  \
-    if (! ((lo) <= XINT (x) && XINT (x) <= (hi)))                      \
+    CHECK_FIXNUM (x);                                                  \
+    if (! ((lo) <= XFIXNUM (x) && XFIXNUM (x) <= (hi)))                        
\
       args_out_of_range_3                                              \
        (x,                                                             \
-        make_number ((lo) < 0 && (lo) < MOST_NEGATIVE_FIXNUM           \
+        make_fixnum ((lo) < 0 && (lo) < MOST_NEGATIVE_FIXNUM           \
                      ? MOST_NEGATIVE_FIXNUM                            \
                      : (lo)),                                          \
-        make_number (min (hi, MOST_POSITIVE_FIXNUM)));                 \
+        make_fixnum (min (hi, MOST_POSITIVE_FIXNUM)));                 \
   } while (false)
 #define CHECK_TYPE_RANGED_INTEGER(type, x) \
   do {                                                                 \
@@ -2859,27 +2811,49 @@ CHECK_NATNUM (Lisp_Object x)
       CHECK_RANGED_INTEGER (x, 0, TYPE_MAXIMUM (type));                        
\
   } while (false)
 
-#define CHECK_NUMBER_COERCE_MARKER(x)                                  \
+#define CHECK_FIXNUM_COERCE_MARKER(x)                                  \
   do {                                                                 \
     if (MARKERP ((x)))                                                 \
       XSETFASTINT (x, marker_position (x));                            \
     else                                                               \
-      CHECK_TYPE (INTEGERP (x), Qinteger_or_marker_p, x);              \
+      CHECK_TYPE (FIXNUMP (x), Qinteger_or_marker_p, x);               \
   } while (false)
 
 INLINE double
 XFLOATINT (Lisp_Object n)
 {
-  return FLOATP (n) ? XFLOAT_DATA (n) : XINT (n);
+  if (BIGNUMP (n))
+    return mpz_get_d (XBIGNUM (n)->value);
+  return FLOATP (n) ? XFLOAT_DATA (n) : XFIXNUM (n);
+}
+
+INLINE void
+CHECK_FIXNUM_OR_FLOAT (Lisp_Object x)
+{
+  CHECK_TYPE (FIXED_OR_FLOATP (x), Qnumberp, x);
 }
 
 INLINE void
-CHECK_NUMBER_OR_FLOAT (Lisp_Object x)
+CHECK_NUMBER (Lisp_Object x)
 {
   CHECK_TYPE (NUMBERP (x), Qnumberp, x);
 }
 
-#define CHECK_NUMBER_OR_FLOAT_COERCE_MARKER(x)                         \
+INLINE void
+CHECK_INTEGER (Lisp_Object x)
+{
+  CHECK_TYPE (INTEGERP (x), Qnumberp, x);
+}
+
+#define CHECK_FIXNUM_OR_FLOAT_COERCE_MARKER(x)                         \
+  do {                                                                 \
+    if (MARKERP (x))                                                   \
+      XSETFASTINT (x, marker_position (x));                            \
+    else                                                               \
+      CHECK_TYPE (FIXED_OR_FLOATP (x), Qnumber_or_marker_p, x);                
\
+  } while (false)
+
+#define CHECK_NUMBER_COERCE_MARKER(x)                                  \
   do {                                                                 \
     if (MARKERP (x))                                                   \
       XSETFASTINT (x, marker_position (x));                            \
@@ -2887,21 +2861,29 @@ CHECK_NUMBER_OR_FLOAT (Lisp_Object x)
       CHECK_TYPE (NUMBERP (x), Qnumber_or_marker_p, x);                        
\
   } while (false)
 
+#define CHECK_INTEGER_COERCE_MARKER(x)                                 \
+  do {                                                                 \
+    if (MARKERP (x))                                                   \
+      XSETFASTINT (x, marker_position (x));                            \
+    else                                                               \
+      CHECK_TYPE (INTEGERP (x), Qnumber_or_marker_p, x);               \
+  } while (false)
+
 /* Since we can't assign directly to the CAR or CDR fields of a cons
    cell, use these when checking that those fields contain numbers.  */
 INLINE void
-CHECK_NUMBER_CAR (Lisp_Object x)
+CHECK_FIXNUM_CAR (Lisp_Object x)
 {
   Lisp_Object tmp = XCAR (x);
-  CHECK_NUMBER (tmp);
+  CHECK_FIXNUM (tmp);
   XSETCAR (x, tmp);
 }
 
 INLINE void
-CHECK_NUMBER_CDR (Lisp_Object x)
+CHECK_FIXNUM_CDR (Lisp_Object x)
 {
   Lisp_Object tmp = XCDR (x);
-  CHECK_NUMBER (tmp);
+  CHECK_FIXNUM (tmp);
   XSETCDR (x, tmp);
 }
 
@@ -3324,7 +3306,7 @@ extern Lisp_Object arithcompare (Lisp_Object num1, 
Lisp_Object num2,
    I should not have side effects.  */
 #define INTEGER_TO_CONS(i)                                         \
   (! FIXNUM_OVERFLOW_P (i)                                         \
-   ? make_number (i)                                               \
+   ? make_fixnum (i)                                               \
    : EXPR_SIGNED (i) ? intbig_to_lisp (i) : uintbig_to_lisp (i))
 extern Lisp_Object intbig_to_lisp (intmax_t);
 extern Lisp_Object uintbig_to_lisp (uintmax_t);
@@ -3574,25 +3556,41 @@ extern Lisp_Object list5 (Lisp_Object, Lisp_Object, 
Lisp_Object, Lisp_Object,
 enum constype {CONSTYPE_HEAP, CONSTYPE_PURE};
 extern Lisp_Object listn (enum constype, ptrdiff_t, Lisp_Object, ...);
 
+extern Lisp_Object make_bignum_str (const char *num, int base);
+extern Lisp_Object make_number (mpz_t value);
+extern void mpz_set_intmax_slow (mpz_t result, intmax_t v);
+
+INLINE void
+mpz_set_intmax (mpz_t result, intmax_t v)
+{
+  /* mpz_set_si works in terms of long, but Emacs may use a wider
+     integer type, and so sometimes will have to construct the mpz_t
+     by hand.  */
+  if (sizeof (intmax_t) > sizeof (long) && (long) v != v)
+    mpz_set_intmax_slow (result, v);
+  else
+    mpz_set_si (result, v);
+}
+
 /* Build a frequently used 2/3/4-integer lists.  */
 
 INLINE Lisp_Object
 list2i (EMACS_INT x, EMACS_INT y)
 {
-  return list2 (make_number (x), make_number (y));
+  return list2 (make_fixnum (x), make_fixnum (y));
 }
 
 INLINE Lisp_Object
 list3i (EMACS_INT x, EMACS_INT y, EMACS_INT w)
 {
-  return list3 (make_number (x), make_number (y), make_number (w));
+  return list3 (make_fixnum (x), make_fixnum (y), make_fixnum (w));
 }
 
 INLINE Lisp_Object
 list4i (EMACS_INT x, EMACS_INT y, EMACS_INT w, EMACS_INT h)
 {
-  return list4 (make_number (x), make_number (y),
-               make_number (w), make_number (h));
+  return list4 (make_fixnum (x), make_fixnum (y),
+               make_fixnum (w), make_fixnum (h));
 }
 
 extern Lisp_Object make_uninit_bool_vector (EMACS_INT);
@@ -3786,7 +3784,7 @@ LOADHIST_ATTACH (Lisp_Object x)
 }
 extern int openp (Lisp_Object, Lisp_Object, Lisp_Object,
                   Lisp_Object *, Lisp_Object, bool);
-enum { S2N_IGNORE_TRAILING = 1, S2N_OVERFLOW_TO_FLOAT = 2 };
+enum { S2N_IGNORE_TRAILING = 1 };
 extern Lisp_Object string_to_number (char const *, int, int);
 extern void map_obarray (Lisp_Object, void (*) (Lisp_Object, Lisp_Object),
                          Lisp_Object);
@@ -4486,7 +4484,7 @@ extern void init_system_name (void);
    in a Lisp fixnum.  */
 
 #define make_fixnum_or_float(val) \
-   (FIXNUM_OVERFLOW_P (val) ? make_float (val) : make_number (val))
+   (FIXNUM_OVERFLOW_P (val) ? make_float (val) : make_fixnum (val))
 
 /* SAFE_ALLOCA normally allocates memory on the stack, but if size is
    larger than MAX_ALLOCA, use xmalloc to avoid overflowing the stack.  */
diff --git a/src/lread.c b/src/lread.c
index 9a025d8..df2fe58 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -335,7 +335,7 @@ readchar (Lisp_Object readcharfun, bool *multibyte)
 
   if (NILP (tem))
     return -1;
-  return XINT (tem);
+  return XFIXNUM (tem);
 
  read_multibyte:
   if (unread_char >= 0)
@@ -467,7 +467,7 @@ unreadchar (Lisp_Object readcharfun, int c)
       unread_char = c;
     }
   else
-    call1 (readcharfun, make_number (c));
+    call1 (readcharfun, make_fixnum (c));
 }
 
 static int
@@ -665,7 +665,7 @@ read_filtered_event (bool no_switch_frame, bool 
ascii_required,
   delayed_switch_frame = Qnil;
 
   /* Compute timeout.  */
-  if (NUMBERP (seconds))
+  if (FIXED_OR_FLOATP (seconds))
     {
       double duration = XFLOATINT (seconds);
       struct timespec wait_time = dtotimespec (duration);
@@ -676,8 +676,8 @@ read_filtered_event (bool no_switch_frame, bool 
ascii_required,
  retry:
   do
     val = read_char (0, Qnil, (input_method ? Qnil : Qt), 0,
-                    NUMBERP (seconds) ? &end_time : NULL);
-  while (INTEGERP (val) && XINT (val) == -2); /* wrong_kboard_jmpbuf */
+                    FIXED_OR_FLOATP (seconds) ? &end_time : NULL);
+  while (FIXNUMP (val) && XFIXNUM (val) == -2); /* wrong_kboard_jmpbuf */
 
   if (BUFFERP (val))
     goto retry;
@@ -695,7 +695,7 @@ read_filtered_event (bool no_switch_frame, bool 
ascii_required,
       goto retry;
     }
 
-  if (ascii_required && !(NUMBERP (seconds) && NILP (val)))
+  if (ascii_required && !(FIXED_OR_FLOATP (seconds) && NILP (val)))
     {
       /* Convert certain symbols to their ASCII equivalents.  */
       if (SYMBOLP (val))
@@ -708,12 +708,12 @@ read_filtered_event (bool no_switch_frame, bool 
ascii_required,
              /* Merge this symbol's modifier bits
                 with the ASCII equivalent of its basic code.  */
              if (!NILP (tem1))
-               XSETFASTINT (val, XINT (tem1) | XINT (Fcar (Fcdr (tem))));
+               XSETFASTINT (val, XFIXNUM (tem1) | XFIXNUM (Fcar (Fcdr (tem))));
            }
        }
 
       /* If we don't have a character now, deal with it appropriately.  */
-      if (!INTEGERP (val))
+      if (!FIXNUMP (val))
        {
          if (error_nonascii)
            {
@@ -770,7 +770,7 @@ floating-point value.  */)
   val = read_filtered_event (1, 1, 1, ! NILP (inherit_input_method), seconds);
 
   return (NILP (val) ? Qnil
-         : make_number (char_resolve_modifier_mask (XINT (val))));
+         : make_fixnum (char_resolve_modifier_mask (XFIXNUM (val))));
 }
 
 DEFUN ("read-event", Fread_event, Sread_event, 0, 3, 0,
@@ -814,7 +814,7 @@ floating-point value.  */)
   val = read_filtered_event (1, 1, 0, ! NILP (inherit_input_method), seconds);
 
   return (NILP (val) ? Qnil
-         : make_number (char_resolve_modifier_mask (XINT (val))));
+         : make_fixnum (char_resolve_modifier_mask (XFIXNUM (val))));
 }
 
 DEFUN ("get-file-char", Fget_file_char, Sget_file_char, 0, 0, 0,
@@ -823,7 +823,7 @@ DEFUN ("get-file-char", Fget_file_char, Sget_file_char, 0, 
0, 0,
 {
   if (!infile)
     error ("get-file-char misused");
-  return make_number (readbyte_from_stdio ());
+  return make_fixnum (readbyte_from_stdio ());
 }
 
 
@@ -1349,7 +1349,7 @@ Return t if the file exists and loads successfully.  */)
                   if (!NILP (nomessage) && !force_load_messages)
                     {
                       Lisp_Object msg_file;
-                      msg_file = Fsubstring (found, make_number (0), 
make_number (-1));
+                      msg_file = Fsubstring (found, make_fixnum (0), 
make_fixnum (-1));
                       message_with_string ("Source file `%s' newer than 
byte-compiled file",
                                            msg_file, 1);
                     }
@@ -1664,7 +1664,7 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object 
suffixes,
          string = make_string (fn, fnlen);
        handler = Ffind_file_name_handler (string, Qfile_exists_p);
        if ((!NILP (handler) || (!NILP (predicate) && !EQ (predicate, Qt)))
-           && !NATNUMP (predicate))
+           && !FIXNATP (predicate))
          {
            bool exists;
            if (NILP (predicate) || EQ (predicate, Qt))
@@ -1703,12 +1703,12 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object 
suffixes,
            pfn = SSDATA (encoded_fn);
 
            /* Check that we can access or open it.  */
-           if (NATNUMP (predicate))
+           if (FIXNATP (predicate))
              {
                fd = -1;
-               if (INT_MAX < XFASTINT (predicate))
+               if (INT_MAX < XFIXNAT (predicate))
                  last_errno = EINVAL;
-               else if (faccessat (AT_FDCWD, pfn, XFASTINT (predicate),
+               else if (faccessat (AT_FDCWD, pfn, XFIXNAT (predicate),
                                    AT_EACCESS)
                         == 0)
                  {
@@ -1741,7 +1741,7 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object 
suffixes,
 
            if (fd >= 0)
              {
-               if (newer && !NATNUMP (predicate))
+               if (newer && !FIXNATP (predicate))
                  {
                    struct timespec mtime = get_stat_mtime (&st);
 
@@ -1992,11 +1992,11 @@ readevalloop (Lisp_Object readcharfun,
          /* Set point and ZV around stuff to be read.  */
          Fgoto_char (start);
          if (!NILP (end))
-           Fnarrow_to_region (make_number (BEGV), end);
+           Fnarrow_to_region (make_fixnum (BEGV), end);
 
          /* Just for cleanliness, convert END to a marker
             if it is an integer.  */
-         if (INTEGERP (end))
+         if (FIXNUMP (end))
            end = Fpoint_max_marker ();
        }
 
@@ -2226,7 +2226,7 @@ the end of STRING.  */)
   CHECK_STRING (string);
   /* `read_internal_start' sets `read_from_string_index'.  */
   ret = read_internal_start (string, start, end);
-  return Fcons (ret, make_number (read_from_string_index));
+  return Fcons (ret, make_fixnum (read_from_string_index));
 }
 
 /* Function to set up the global context we need in toplevel read
@@ -2312,7 +2312,7 @@ read0 (Lisp_Object readcharfun)
     return val;
 
   xsignal1 (Qinvalid_read_syntax,
-           Fmake_string (make_number (1), make_number (c), Qnil));
+           Fmake_string (make_fixnum (1), make_fixnum (c), Qnil));
 }
 
 /* Grow a read buffer BUF that contains OFFSET useful bytes of data,
@@ -2351,15 +2351,15 @@ character_name_to_code (char const *name, ptrdiff_t 
name_len)
        ? string_to_number (name + 1, 16, 0)
        : call2 (Qchar_from_name, make_unibyte_string (name, name_len), Qt));
 
-  if (! RANGED_INTEGERP (0, code, MAX_UNICODE_CHAR)
-      || char_surrogate_p (XINT (code)))
+  if (! RANGED_FIXNUMP (0, code, MAX_UNICODE_CHAR)
+      || char_surrogate_p (XFIXNUM (code)))
     {
       AUTO_STRING (format, "\\N{%s}");
       AUTO_STRING_WITH_LEN (namestr, name, name_len);
       xsignal1 (Qinvalid_read_syntax, CALLN (Fformat, format, namestr));
     }
 
-  return XINT (code);
+  return XFIXNUM (code);
 }
 
 /* Bound on the length of a Unicode character name.  As of
@@ -2583,7 +2583,7 @@ read_escape (Lisp_Object readcharfun, bool stringp)
                 AUTO_STRING (format,
                              "Invalid character U+%04X in character name");
                 xsignal1 (Qinvalid_read_syntax,
-                          CALLN (Fformat, format, make_natnum (c)));
+                          CALLN (Fformat, format, make_fixed_natnum (c)));
               }
             /* Treat multiple adjacent whitespace characters as a
                single space character.  This makes it easier to use
@@ -2635,6 +2635,13 @@ digit_to_number (int character, int base)
   return digit < base ? digit : -1;
 }
 
+static void
+free_contents (void *p)
+{
+  void **ptr = (void **) p;
+  xfree (*ptr);
+}
+
 /* Read an integer in radix RADIX using READCHARFUN to read
    characters.  RADIX must be in the interval [2..36]; if it isn't, a
    read error is signaled .  Value is the integer read.  Signals an
@@ -2646,17 +2653,24 @@ read_integer (Lisp_Object readcharfun, EMACS_INT radix)
 {
   /* Room for sign, leading 0, other digits, trailing null byte.
      Also, room for invalid syntax diagnostic.  */
-  char buf[max (1 + 1 + UINTMAX_WIDTH + 1,
-               sizeof "integer, radix " + INT_STRLEN_BOUND (EMACS_INT))];
+  size_t len = max (1 + 1 + UINTMAX_WIDTH + 1,
+                   sizeof "integer, radix " + INT_STRLEN_BOUND (EMACS_INT));
+  char *buf = NULL;
   char *p = buf;
   int valid = -1; /* 1 if valid, 0 if not, -1 if incomplete.  */
 
+  ptrdiff_t count = SPECPDL_INDEX ();
+
   if (radix < 2 || radix > 36)
     valid = 0;
   else
     {
       int c, digit;
 
+      buf = xmalloc (len);
+      record_unwind_protect_ptr (free_contents, &buf);
+      p = buf;
+
       c = READCHAR;
       if (c == '-' || c == '+')
        {
@@ -2682,8 +2696,15 @@ read_integer (Lisp_Object readcharfun, EMACS_INT radix)
            valid = 0;
          if (valid < 0)
            valid = 1;
-         if (p < buf + sizeof buf)
-           *p++ = c;
+         /* Allow 1 extra byte for the \0.  */
+         if (p + 1 == buf + len)
+           {
+             ptrdiff_t where = p - buf;
+             len *= 2;
+             buf = xrealloc (buf, len);
+             p = buf + where;
+           }
+         *p++ = c;
          c = READCHAR;
        }
 
@@ -2696,14 +2717,8 @@ read_integer (Lisp_Object readcharfun, EMACS_INT radix)
       invalid_syntax (buf);
     }
 
-  if (p == buf + sizeof buf)
-    {
-      memset (p - 3, '.', 3);
-      xsignal1 (Qoverflow_error, make_unibyte_string (buf, sizeof buf));
-    }
-
   *p = '\0';
-  return string_to_number (buf, radix, 0);
+  return unbind_to (count, string_to_number (buf, radix, 0));
 }
 
 
@@ -2768,9 +2783,9 @@ read1 (Lisp_Object readcharfun, int *pch, bool 
first_in_list)
 
              if (!EQ (head, Qhash_table))
                {
-                 ptrdiff_t size = XINT (Flength (tmp));
+                 ptrdiff_t size = XFIXNUM (Flength (tmp));
                  Lisp_Object record = Fmake_record (CAR_SAFE (tmp),
-                                                    make_number (size - 1),
+                                                    make_fixnum (size - 1),
                                                     Qnil);
                  for (int i = 1; i < size; i++)
                    {
@@ -2855,24 +2870,24 @@ read1 (Lisp_Object readcharfun, int *pch, bool 
first_in_list)
                  /* Sub char-table can't be read as a regular
                     vector because of a two C integer fields.  */
                  Lisp_Object tbl, tmp = read_list (1, readcharfun);
-                 ptrdiff_t size = XINT (Flength (tmp));
+                 ptrdiff_t size = XFIXNUM (Flength (tmp));
                  int i, depth, min_char;
                  struct Lisp_Cons *cell;
 
                  if (size == 0)
                    error ("Zero-sized sub char-table");
 
-                 if (! RANGED_INTEGERP (1, XCAR (tmp), 3))
+                 if (! RANGED_FIXNUMP (1, XCAR (tmp), 3))
                    error ("Invalid depth in sub char-table");
-                 depth = XINT (XCAR (tmp));
+                 depth = XFIXNUM (XCAR (tmp));
                  if (chartab_size[depth] != size - 2)
                    error ("Invalid size in sub char-table");
                  cell = XCONS (tmp), tmp = XCDR (tmp), size--;
                  free_cons (cell);
 
-                 if (! RANGED_INTEGERP (0, XCAR (tmp), MAX_CHAR))
+                 if (! RANGED_FIXNUMP (0, XCAR (tmp), MAX_CHAR))
                    error ("Invalid minimum character in sub-char-table");
-                 min_char = XINT (XCAR (tmp));
+                 min_char = XFIXNUM (XCAR (tmp));
                  cell = XCONS (tmp), tmp = XCDR (tmp), size--;
                  free_cons (cell);
 
@@ -2897,7 +2912,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool 
first_in_list)
          if (c == '"')
            {
              Lisp_Object tmp, val;
-             EMACS_INT size_in_chars = bool_vector_bytes (XFASTINT (length));
+             EMACS_INT size_in_chars = bool_vector_bytes (XFIXNAT (length));
              unsigned char *data;
 
              UNREAD (c);
@@ -2908,17 +2923,17 @@ read1 (Lisp_Object readcharfun, int *pch, bool 
first_in_list)
                         when the number of bits was a multiple of 8.
                         Accept such input in case it came from an old
                         version.  */
-                     && ! (XFASTINT (length)
+                     && ! (XFIXNAT (length)
                            == (SCHARS (tmp) - 1) * BOOL_VECTOR_BITS_PER_CHAR)))
                invalid_syntax ("#&...");
 
-             val = make_uninit_bool_vector (XFASTINT (length));
+             val = make_uninit_bool_vector (XFIXNAT (length));
              data = bool_vector_uchar_data (val);
              memcpy (data, SDATA (tmp), size_in_chars);
              /* Clear the extraneous bits in the last byte.  */
-             if (XINT (length) != size_in_chars * BOOL_VECTOR_BITS_PER_CHAR)
+             if (XFIXNUM (length) != size_in_chars * BOOL_VECTOR_BITS_PER_CHAR)
                data[size_in_chars - 1]
-                 &= (1 << (XINT (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 1;
+                 &= (1 << (XFIXNUM (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 1;
              return val;
            }
          invalid_syntax ("#&...");
@@ -3131,7 +3146,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool 
first_in_list)
                      struct Lisp_Hash_Table *h
                        = XHASH_TABLE (read_objects_map);
                      EMACS_UINT hash;
-                     Lisp_Object number = make_number (n);
+                     Lisp_Object number = make_fixnum (n);
 
                      ptrdiff_t i = hash_lookup (h, number, &hash);
                      if (i >= 0)
@@ -3146,7 +3161,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool 
first_in_list)
                      /* If it can be recursive, remember it for
                         future substitutions.  */
                      if (! SYMBOLP (tem)
-                         && ! NUMBERP (tem)
+                         && ! FIXED_OR_FLOATP (tem)
                          && ! (STRINGP (tem) && !string_intervals (tem)))
                        {
                          struct Lisp_Hash_Table *h2
@@ -3182,7 +3197,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool 
first_in_list)
                    {
                      struct Lisp_Hash_Table *h
                        = XHASH_TABLE (read_objects_map);
-                     ptrdiff_t i = hash_lookup (h, make_number (n), NULL);
+                     ptrdiff_t i = hash_lookup (h, make_fixnum (n), NULL);
                      if (i >= 0)
                        return HASH_VALUE (h, i);
                    }
@@ -3290,13 +3305,13 @@ read1 (Lisp_Object readcharfun, int *pch, bool 
first_in_list)
           Other literal whitespace like NL, CR, and FF are not accepted,
           as there are well-established escape sequences for these.  */
        if (c == ' ' || c == '\t')
-         return make_number (c);
+         return make_fixnum (c);
 
        if (c == '(' || c == ')' || c == '[' || c == ']'
             || c == '"' || c == ';')
          {
             CHECK_LIST (Vlread_unescaped_character_literals);
-            Lisp_Object char_obj = make_natnum (c);
+            Lisp_Object char_obj = make_fixed_natnum (c);
             if (NILP (Fmemq (char_obj, Vlread_unescaped_character_literals)))
               Vlread_unescaped_character_literals =
                 Fcons (char_obj, Vlread_unescaped_character_literals);
@@ -3316,7 +3331,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool 
first_in_list)
                  && strchr ("\"';()[]#?`,.", next_char) != NULL));
        UNREAD (next_char);
        if (ok)
-         return make_number (c);
+         return make_fixnum (c);
 
        invalid_syntax ("?");
       }
@@ -3425,7 +3440,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool 
first_in_list)
           return zero instead.  This is for doc strings
           that we are really going to find in etc/DOC.nn.nn.  */
        if (!NILP (Vpurify_flag) && NILP (Vdoc_file_name) && cancel)
-         return unbind_to (count, make_number (0));
+         return unbind_to (count, make_fixnum (0));
 
        if (! force_multibyte && force_singlebyte)
          {
@@ -3512,9 +3527,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool 
first_in_list)
 
        if (!quoted && !uninterned_symbol)
          {
-           int flags = (read_integer_overflow_as_float
-                        ? S2N_OVERFLOW_TO_FLOAT : 0);
-           Lisp_Object result = string_to_number (read_buffer, 10, flags);
+           Lisp_Object result = string_to_number (read_buffer, 10, 0);
            if (! NILP (result))
              return unbind_to (count, result);
          }
@@ -3523,7 +3536,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool 
first_in_list)
             int ch = STRING_CHAR ((unsigned char *) read_buffer);
             if (confusable_symbol_character_p (ch))
               xsignal2 (Qinvalid_read_syntax, build_string ("strange quote"),
-                        CALLN (Fstring, make_number (ch)));
+                        CALLN (Fstring, make_fixnum (ch)));
           }
        {
          Lisp_Object result;
@@ -3566,7 +3579,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool 
first_in_list)
          if (EQ (Vread_with_symbol_positions, Qt)
              || EQ (Vread_with_symbol_positions, readcharfun))
            Vread_symbol_positions_list
-             = Fcons (Fcons (result, make_number (start_position)),
+             = Fcons (Fcons (result, make_fixnum (start_position)),
                       Vread_symbol_positions_list);
          return unbind_to (count, result);
        }
@@ -3603,7 +3616,7 @@ substitute_object_recurse (struct subst *subst, 
Lisp_Object subtree)
      bother looking them up; we're done.  */
   if (SYMBOLP (subtree)
       || (STRINGP (subtree) && !string_intervals (subtree))
-      || NUMBERP (subtree))
+      || FIXED_OR_FLOATP (subtree))
     return subtree;
 
   /* If we've been to this node before, don't explore it again.  */
@@ -3681,12 +3694,10 @@ substitute_in_interval (INTERVAL interval, void *arg)
 
 /* Convert STRING to a number, assuming base BASE.  When STRING has
    floating point syntax and BASE is 10, return a nearest float.  When
-   STRING has integer syntax, return a fixnum if the integer fits, and
-   signal an overflow otherwise (unless BASE is 10 and STRING ends in
-   period or FLAGS & S2N_OVERFLOW_TO_FLOAT is nonzero; in this case,
-   return a nearest float instead).  Otherwise, return nil.  If FLAGS
-   & S2N_IGNORE_TRAILING is nonzero, consider just the longest prefix
-   of STRING that has valid syntax.  */
+   STRING has integer syntax, return a fixnum if the integer fits, or
+   else a bignum.  Otherwise, return nil.  If FLAGS &
+   S2N_IGNORE_TRAILING is nonzero, consider just the longest prefix of
+   STRING that has valid syntax.  */
 
 Lisp_Object
 string_to_number (char const *string, int base, int flags)
@@ -3789,29 +3800,17 @@ string_to_number (char const *string, int base, int 
flags)
      range, use its value, preferably as a fixnum.  */
   if (leading_digit >= 0 && ! float_syntax)
     {
-      if (state & INTOVERFLOW)
-       {
-         /* Unfortunately there's no simple and accurate way to convert
-            non-base-10 numbers that are out of C-language range.  */
-         if (base != 10)
-           flags = 0;
-       }
-      else if (n <= (negative ? -MOST_NEGATIVE_FIXNUM : MOST_POSITIVE_FIXNUM))
+      if ((state & INTOVERFLOW) == 0
+         && n <= (negative ? -MOST_NEGATIVE_FIXNUM : MOST_POSITIVE_FIXNUM))
        {
          EMACS_INT signed_n = n;
-         return make_number (negative ? -signed_n : signed_n);
+         return make_fixnum (negative ? -signed_n : signed_n);
        }
-      else
-       value = n;
 
-      if (! (state & DOT_CHAR) && ! (flags & S2N_OVERFLOW_TO_FLOAT))
-       {
-         AUTO_STRING (fmt, ("%s (base %d) is out of fixnum range; "
-                            "maybe set `read-integer-overflow-as-float'?"));
-         AUTO_STRING_WITH_LEN (arg, string, cp - string);
-         xsignal1 (Qoverflow_error,
-                   CALLN (Fformat_message, fmt, arg, make_number (base)));
-       }
+      /* Skip a leading "+".  */
+      if (signedp && !negative)
+       ++string;
+      return make_bignum_str (string, base);
     }
 
   /* Either the number uses float syntax, or it does not fit into a fixnum.
@@ -3836,11 +3835,11 @@ read_vector (Lisp_Object readcharfun, bool bytecodeflag)
 
   tem = read_list (1, readcharfun);
   len = Flength (tem);
-  if (bytecodeflag && XFASTINT (len) <= COMPILED_STACK_DEPTH)
+  if (bytecodeflag && XFIXNAT (len) <= COMPILED_STACK_DEPTH)
     error ("Invalid byte code");
   vector = Fmake_vector (len, Qnil);
 
-  size = XFASTINT (len);
+  size = XFIXNAT (len);
   ptr = XVECTOR (vector)->contents;
   for (i = 0; i < size; i++)
     {
@@ -3978,8 +3977,8 @@ read_list (bool flag, Lisp_Object readcharfun)
              if (ch == ')')
                {
                  if (doc_reference == 1)
-                   return make_number (0);
-                 if (doc_reference == 2 && INTEGERP (XCDR (val)))
+                   return make_fixnum (0);
+                 if (doc_reference == 2 && FIXNUMP (XCDR (val)))
                    {
                      char *saved = NULL;
                      file_offset saved_position;
@@ -3994,7 +3993,7 @@ read_list (bool flag, Lisp_Object readcharfun)
                         multibyte.  */
 
                      /* Position is negative for user variables.  */
-                     EMACS_INT pos = eabs (XINT (XCDR (val)));
+                     EMACS_INT pos = eabs (XFIXNUM (XCDR (val)));
                      if (pos >= saved_doc_string_position
                          && pos < (saved_doc_string_position
                                    + saved_doc_string_length))
@@ -4099,7 +4098,7 @@ intern_sym (Lisp_Object sym, Lisp_Object obarray, 
Lisp_Object index)
       SET_SYMBOL_VAL (XSYMBOL (sym), sym);
     }
 
-  ptr = aref_addr (obarray, XINT (index));
+  ptr = aref_addr (obarray, XFIXNUM (index));
   set_symbol_next (sym, SYMBOLP (*ptr) ? XSYMBOL (*ptr) : NULL);
   *ptr = sym;
   return sym;
@@ -4157,7 +4156,7 @@ define_symbol (Lisp_Object sym, char const *str)
   if (! EQ (sym, Qunbound))
     {
       Lisp_Object bucket = oblookup (initial_obarray, str, len, len);
-      eassert (INTEGERP (bucket));
+      eassert (FIXNUMP (bucket));
       intern_sym (sym, initial_obarray, bucket);
     }
 }
@@ -4203,7 +4202,7 @@ it defaults to the value of `obarray'.  */)
     string = SYMBOL_NAME (name);
 
   tem = oblookup (obarray, SSDATA (string), SCHARS (string), SBYTES (string));
-  if (INTEGERP (tem) || (SYMBOLP (name) && !EQ (name, tem)))
+  if (FIXNUMP (tem) || (SYMBOLP (name) && !EQ (name, tem)))
     return Qnil;
   else
     return tem;
@@ -4235,7 +4234,7 @@ usage: (unintern NAME OBARRAY)  */)
   tem = oblookup (obarray, SSDATA (string),
                  SCHARS (string),
                  SBYTES (string));
-  if (INTEGERP (tem))
+  if (FIXNUMP (tem))
     return Qnil;
   /* If arg was a symbol, don't delete anything but that symbol itself.  */
   if (SYMBOLP (name) && !EQ (name, tem))
@@ -4261,7 +4260,7 @@ usage: (unintern NAME OBARRAY)  */)
          ASET (obarray, hash, sym);
        }
       else
-       ASET (obarray, hash, make_number (0));
+       ASET (obarray, hash, make_fixnum (0));
     }
   else
     {
@@ -4304,7 +4303,7 @@ oblookup (Lisp_Object obarray, register const char *ptr, 
ptrdiff_t size, ptrdiff
   hash = hash_string (ptr, size_byte) % obsize;
   bucket = AREF (obarray, hash);
   oblookup_last_bucket_number = hash;
-  if (EQ (bucket, make_number (0)))
+  if (EQ (bucket, make_fixnum (0)))
     ;
   else if (!SYMBOLP (bucket))
     error ("Bad data in guts of obarray"); /* Like CADR error message.  */
@@ -4365,7 +4364,7 @@ OBARRAY defaults to the value of `obarray'.  */)
 void
 init_obarray (void)
 {
-  Vobarray = Fmake_vector (make_number (OBARRAY_SIZE), make_number (0));
+  Vobarray = Fmake_vector (make_fixnum (OBARRAY_SIZE), make_fixnum (0));
   initial_obarray = Vobarray;
   staticpro (&initial_obarray);
 
@@ -4854,13 +4853,6 @@ were read in.  */);
               doc: /* Non-nil means read recursive structures using #N= and 
#N# syntax.  */);
   Vread_circle = Qt;
 
-  DEFVAR_BOOL ("read-integer-overflow-as-float",
-              read_integer_overflow_as_float,
-              doc: /* Non-nil means `read' quietly treats an out-of-range 
integer as floating point.
-Nil (the default) means signal an overflow unless the integer ends in `.'.
-This variable is experimental; email address@hidden if you need it.  */);
-  read_integer_overflow_as_float = false;
-
   DEFVAR_LISP ("load-path", Vload_path,
               doc: /* List of directories to search for files to load.
 Each element is a string (directory file name) or nil (meaning
diff --git a/src/macfont.m b/src/macfont.m
index e0c704f..c9a1eda 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -851,7 +851,7 @@ macfont_store_descriptor_attributes (CTFontDescriptorRef 
desc,
                                            * ((point->y - (point - 1)->y)
                                               / (point->x - (point - 1)->x)));
               FONT_SET_STYLE (spec_or_entity, numeric_traits[i].index,
-                              make_number (lround (floatval)));
+                              make_fixnum (lround (floatval)));
             }
         }
 
@@ -864,16 +864,16 @@ macfont_store_descriptor_attributes (CTFontDescriptorRef 
desc,
           cfnumber_get_font_symbolic_traits_value (num, &sym_traits);
           spacing = (sym_traits & kCTFontTraitMonoSpace
                      ? FONT_SPACING_MONO : FONT_SPACING_PROPORTIONAL);
-          ASET (spec_or_entity, FONT_SPACING_INDEX, make_number (spacing));
+          ASET (spec_or_entity, FONT_SPACING_INDEX, make_fixnum (spacing));
         }
 
       CFRelease (dict);
     }
   num = CTFontDescriptorCopyAttribute (desc, kCTFontSizeAttribute);
   if (num && CFNumberGetValue (num, kCFNumberCGFloatType, &floatval))
-    ASET (spec_or_entity, FONT_SIZE_INDEX, make_number (floatval));
+    ASET (spec_or_entity, FONT_SIZE_INDEX, make_fixnum (floatval));
   else
-    ASET (spec_or_entity, FONT_SIZE_INDEX, make_number (0));
+    ASET (spec_or_entity, FONT_SIZE_INDEX, make_fixnum (0));
   if (num)
     CFRelease (num);
 }
@@ -903,22 +903,22 @@ macfont_descriptor_entity (CTFontDescriptorRef desc, 
Lisp_Object extra,
         cfnumber_get_font_symbolic_traits_value (num, &sym_traits);
       CFRelease (dict);
     }
-  if (EQ (AREF (entity, FONT_SIZE_INDEX), make_number (0)))
-    ASET (entity, FONT_AVGWIDTH_INDEX, make_number (0));
+  if (EQ (AREF (entity, FONT_SIZE_INDEX), make_fixnum (0)))
+    ASET (entity, FONT_AVGWIDTH_INDEX, make_fixnum (0));
   ASET (entity, FONT_EXTRA_INDEX, Fcopy_sequence (extra));
   name = CTFontDescriptorCopyAttribute (desc, kCTFontNameAttribute);
   font_put_extra (entity, QCfont_entity,
                  Fcons (make_mint_ptr ((void *) name),
-                        make_number (sym_traits)));
+                        make_fixnum (sym_traits)));
   if (synth_sym_traits & kCTFontTraitItalic)
     FONT_SET_STYLE (entity, FONT_SLANT_INDEX,
-                    make_number (FONT_SLANT_SYNTHETIC_ITALIC));
+                    make_fixnum (FONT_SLANT_SYNTHETIC_ITALIC));
   if (synth_sym_traits & kCTFontTraitBold)
     FONT_SET_STYLE (entity, FONT_WEIGHT_INDEX,
-                    make_number (FONT_WEIGHT_SYNTHETIC_BOLD));
+                    make_fixnum (FONT_WEIGHT_SYNTHETIC_BOLD));
   if (synth_sym_traits & kCTFontTraitMonoSpace)
     ASET (entity, FONT_SPACING_INDEX,
-          make_number (FONT_SPACING_SYNTHETIC_MONO));
+          make_fixnum (FONT_SPACING_SYNTHETIC_MONO));
 
   return entity;
 }
@@ -1798,9 +1798,9 @@ macfont_get_open_type_spec (Lisp_Object otf_spec)
         continue;
       len = Flength (val);
       spec->features[i] =
-        (min (PTRDIFF_MAX, SIZE_MAX) / sizeof (int) < XINT (len)
+        (min (PTRDIFF_MAX, SIZE_MAX) / sizeof (int) < XFIXNUM (len)
          ? 0
-         : malloc (XINT (len) * sizeof *spec->features[i]));
+         : malloc (XFIXNUM (len) * sizeof *spec->features[i]));
       if (! spec->features[i])
         {
           if (i > 0 && spec->features[0])
@@ -1940,9 +1940,9 @@ macfont_create_attributes_with_spec (Lisp_Object spec)
               {
                 UniChar unichars[2];
                 CFIndex count =
-                  macfont_store_utf32char_to_unichars (XFASTINT (XCAR (chars)),
+                  macfont_store_utf32char_to_unichars (XFIXNAT (XCAR (chars)),
                                                        unichars);
-                CFRange range = CFRangeMake (XFASTINT (XCAR (chars)), 1);
+                CFRange range = CFRangeMake (XFIXNAT (XCAR (chars)), 1);
 
                 CFStringAppendCharacters (string, unichars, count);
                 CFCharacterSetAddCharactersInRange (cs, range);
@@ -1981,10 +1981,10 @@ macfont_create_attributes_with_spec (Lisp_Object spec)
   for (i = 0; i < ARRAYELTS (numeric_traits); i++)
     {
       tmp = AREF (spec, numeric_traits[i].index);
-      if (INTEGERP (tmp))
+      if (FIXNUMP (tmp))
         {
           CGPoint *point = numeric_traits[i].points;
-          CGFloat floatval = (XINT (tmp) >> 8); // XXX
+          CGFloat floatval = (XFIXNUM (tmp) >> 8); // XXX
           CFNumberRef num;
 
           while (point->y < floatval)
@@ -2069,9 +2069,9 @@ macfont_supports_charset_and_languages_p 
(CTFontDescriptorRef desc,
               ptrdiff_t j;
 
               for (j = 0; j < ASIZE (chars); j++)
-                if (TYPE_RANGED_INTEGERP (UTF32Char, AREF (chars, j))
+                if (TYPE_RANGED_FIXNUMP (UTF32Char, AREF (chars, j))
                     && CFCharacterSetIsLongCharacterMember (desc_charset,
-                                                            XFASTINT (AREF 
(chars, j))))
+                                                            XFIXNAT (AREF 
(chars, j))))
                   break;
               if (j == ASIZE (chars))
                 result = false;
@@ -2161,8 +2161,8 @@ macfont_list (struct frame *f, Lisp_Object spec)
 
   languages = CFDictionaryGetValue (attributes, kCTFontLanguagesAttribute);
 
-  if (INTEGERP (AREF (spec, FONT_SPACING_INDEX)))
-    spacing = XINT (AREF (spec, FONT_SPACING_INDEX));
+  if (FIXNUMP (AREF (spec, FONT_SPACING_INDEX)))
+    spacing = XFIXNUM (AREF (spec, FONT_SPACING_INDEX));
 
   traits = ((CFMutableDictionaryRef)
             CFDictionaryGetValue (attributes, kCTFontTraitsAttribute));
@@ -2532,9 +2532,9 @@ macfont_open (struct frame * f, Lisp_Object entity, int 
pixel_size)
       || ! CONSP (XCDR (val)))
     return Qnil;
   font_name = xmint_pointer (XCAR (XCDR (val)));
-  sym_traits = XINT (XCDR (XCDR (val)));
+  sym_traits = XFIXNUM (XCDR (XCDR (val)));
 
-  size = XINT (AREF (entity, FONT_SIZE_INDEX));
+  size = XFIXNUM (AREF (entity, FONT_SIZE_INDEX));
   if (size == 0)
     size = pixel_size;
 
@@ -2563,7 +2563,7 @@ macfont_open (struct frame * f, Lisp_Object entity, int 
pixel_size)
   macfont_info->cgfont = CTFontCopyGraphicsFont (macfont, NULL);
 
   val = assq_no_quit (QCdestination, AREF (entity, FONT_EXTRA_INDEX));
-  if (CONSP (val) && EQ (XCDR (val), make_number (1)))
+  if (CONSP (val) && EQ (XCDR (val), make_fixnum (1)))
     macfont_info->screen_font = mac_screen_font_create_with_name (font_name,
                                                                   size);
   else
@@ -2584,8 +2584,8 @@ macfont_open (struct frame * f, Lisp_Object entity, int 
pixel_size)
     macfont_info->synthetic_bold_p = 1;
   if (sym_traits & kCTFontTraitMonoSpace)
     macfont_info->spacing = MACFONT_SPACING_MONO;
-  else if (INTEGERP (AREF (entity, FONT_SPACING_INDEX))
-           && (XINT (AREF (entity, FONT_SPACING_INDEX))
+  else if (FIXNUMP (AREF (entity, FONT_SPACING_INDEX))
+           && (XFIXNUM (AREF (entity, FONT_SPACING_INDEX))
                == FONT_SPACING_SYNTHETIC_MONO))
     macfont_info->spacing = MACFONT_SPACING_SYNTHETIC_MONO;
   if (macfont_info->synthetic_italic_p || macfont_info->synthetic_bold_p)
@@ -2992,7 +2992,7 @@ macfont_shape (Lisp_Object lgstring)
 
       if (NILP (lglyph))
         {
-          lglyph = Fmake_vector (make_number (LGLYPH_SIZE), Qnil);
+          lglyph = Fmake_vector (make_fixnum (LGLYPH_SIZE), Qnil);
           LGSTRING_SET_GLYPH (lgstring, i, lglyph);
         }
 
@@ -3046,17 +3046,17 @@ macfont_shape (Lisp_Object lgstring)
         {
           Lisp_Object vec;
 
-          vec = Fmake_vector (make_number (3), Qnil);
-          ASET (vec, 0, make_number (xoff));
-          ASET (vec, 1, make_number (yoff));
-          ASET (vec, 2, make_number (wadjust));
+          vec = Fmake_vector (make_fixnum (3), Qnil);
+          ASET (vec, 0, make_fixnum (xoff));
+          ASET (vec, 1, make_fixnum (yoff));
+          ASET (vec, 2, make_fixnum (wadjust));
           LGLYPH_SET_ADJUSTMENT (lglyph, vec);
         }
     }
 
   unblock_input ();
 
-  return make_number (used);
+  return make_fixnum (used);
 }
 
 /* Structures for the UVS subtable (format 14) in the cmap table.  */
diff --git a/src/macros.c b/src/macros.c
index b1fc7a0..0677021 100644
--- a/src/macros.c
+++ b/src/macros.c
@@ -97,9 +97,9 @@ macro before appending to it.  */)
       for (i = 0; i < len; i++)
        {
          Lisp_Object c;
-         c = Faref (KVAR (current_kboard, Vlast_kbd_macro), make_number (i));
-         if (cvt && NATNUMP (c) && (XFASTINT (c) & 0x80))
-           XSETFASTINT (c, CHAR_META | (XFASTINT (c) & ~0x80));
+         c = Faref (KVAR (current_kboard, Vlast_kbd_macro), make_fixnum (i));
+         if (cvt && FIXNATP (c) && (XFIXNAT (c) & 0x80))
+           XSETFASTINT (c, CHAR_META | (XFIXNAT (c) & ~0x80));
          current_kboard->kbd_macro_buffer[i] = c;
        }
 
@@ -110,7 +110,7 @@ macro before appending to it.  */)
         for consistency of behavior.  */
       if (NILP (no_exec))
        Fexecute_kbd_macro (KVAR (current_kboard, Vlast_kbd_macro),
-                           make_number (1), Qnil);
+                           make_fixnum (1), Qnil);
 
       message1 ("Appending to kbd macro...");
     }
@@ -154,7 +154,7 @@ each iteration of the macro.  Iteration stops if LOOPFUNC 
returns nil.  */)
   if (NILP (repeat))
     XSETFASTINT (repeat, 1);
   else
-    CHECK_NUMBER (repeat);
+    CHECK_FIXNUM (repeat);
 
   if (!NILP (KVAR (current_kboard, defining_kbd_macro)))
     {
@@ -162,11 +162,11 @@ each iteration of the macro.  Iteration stops if LOOPFUNC 
returns nil.  */)
       message1 ("Keyboard macro defined");
     }
 
-  if (XFASTINT (repeat) == 0)
+  if (XFIXNAT (repeat) == 0)
     Fexecute_kbd_macro (KVAR (current_kboard, Vlast_kbd_macro), repeat, 
loopfunc);
-  else if (XINT (repeat) > 1)
+  else if (XFIXNUM (repeat) > 1)
     {
-      XSETINT (repeat, XINT (repeat) - 1);
+      XSETINT (repeat, XFIXNUM (repeat) - 1);
       Fexecute_kbd_macro (KVAR (current_kboard, Vlast_kbd_macro),
                          repeat, loopfunc);
     }
@@ -267,7 +267,7 @@ pop_kbd_macro (Lisp_Object info)
   Lisp_Object tem;
   Vexecuting_kbd_macro = XCAR (info);
   tem = XCDR (info);
-  executing_kbd_macro_index = XINT (XCAR (tem));
+  executing_kbd_macro_index = XFIXNUM (XCAR (tem));
   Vreal_this_command = XCDR (tem);
   run_hook (Qkbd_macro_termination_hook);
 }
@@ -293,7 +293,7 @@ each iteration of the macro.  Iteration stops if LOOPFUNC 
returns nil.  */)
   if (!NILP (count))
     {
       count = Fprefix_numeric_value (count);
-      repeat = XINT (count);
+      repeat = XFIXNUM (count);
     }
 
   final = indirect_function (macro);
@@ -301,7 +301,7 @@ each iteration of the macro.  Iteration stops if LOOPFUNC 
returns nil.  */)
     error ("Keyboard macros must be strings or vectors");
 
   tem = Fcons (Vexecuting_kbd_macro,
-              Fcons (make_number (executing_kbd_macro_index),
+              Fcons (make_fixnum (executing_kbd_macro_index),
                      Vreal_this_command));
   record_unwind_protect (pop_kbd_macro, tem);
 
diff --git a/src/marker.c b/src/marker.c
index 2d5b05c..b9ea5c5 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -447,7 +447,7 @@ DEFUN ("marker-position", Fmarker_position, 
Smarker_position, 1, 1, 0,
 {
   CHECK_MARKER (marker);
   if (XMARKER (marker)->buffer)
-    return make_number (XMARKER (marker)->charpos);
+    return make_fixnum (XMARKER (marker)->charpos);
 
   return Qnil;
 }
@@ -521,11 +521,11 @@ set_marker_internal (Lisp_Object marker, Lisp_Object 
position,
     {
       register ptrdiff_t charpos, bytepos;
 
-      /* Do not use CHECK_NUMBER_COERCE_MARKER because we
+      /* Do not use CHECK_FIXNUM_COERCE_MARKER because we
         don't want to call buf_charpos_to_bytepos if POSITION
         is a marker and so we know the bytepos already.  */
-      if (INTEGERP (position))
-       charpos = XINT (position), bytepos = -1;
+      if (FIXNUMP (position))
+       charpos = XFIXNUM (position), bytepos = -1;
       else if (MARKERP (position))
        {
          charpos = XMARKER (position)->charpos;
@@ -712,7 +712,7 @@ see `marker-insertion-type'.  */)
   register Lisp_Object new;
 
   if (!NILP (marker))
-  CHECK_TYPE (INTEGERP (marker) || MARKERP (marker), Qinteger_or_marker_p, 
marker);
+  CHECK_TYPE (FIXNUMP (marker) || MARKERP (marker), Qinteger_or_marker_p, 
marker);
 
   new = Fmake_marker ();
   Fset_marker (new, marker,
@@ -752,7 +752,7 @@ DEFUN ("buffer-has-markers-at", Fbuffer_has_markers_at, 
Sbuffer_has_markers_at,
   register struct Lisp_Marker *tail;
   register ptrdiff_t charpos;
 
-  charpos = clip_to_bounds (BEG, XINT (position), Z);
+  charpos = clip_to_bounds (BEG, XFIXNUM (position), Z);
 
   for (tail = BUF_MARKERS (current_buffer); tail; tail = tail->next)
     if (tail->charpos == charpos)
diff --git a/src/menu.c b/src/menu.c
index a088083..d75a842 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -86,7 +86,7 @@ init_menu_items (void)
   if (NILP (menu_items))
     {
       menu_items_allocated = 60;
-      menu_items = Fmake_vector (make_number (menu_items_allocated), Qnil);
+      menu_items = Fmake_vector (make_fixnum (menu_items_allocated), Qnil);
     }
 
   menu_items_inuse = Qt;
@@ -134,11 +134,11 @@ restore_menu_items (Lisp_Object saved)
   menu_items_inuse = (! NILP (menu_items) ? Qt : Qnil);
   menu_items_allocated = (VECTORP (menu_items) ? ASIZE (menu_items) : 0);
   saved = XCDR (saved);
-  menu_items_used = XINT (XCAR (saved));
+  menu_items_used = XFIXNUM (XCAR (saved));
   saved = XCDR (saved);
-  menu_items_n_panes = XINT (XCAR (saved));
+  menu_items_n_panes = XFIXNUM (XCAR (saved));
   saved = XCDR (saved);
-  menu_items_submenu_depth = XINT (XCAR (saved));
+  menu_items_submenu_depth = XFIXNUM (XCAR (saved));
 }
 
 /* Push the whole state of menu_items processing onto the specpdl.
@@ -148,9 +148,9 @@ void
 save_menu_items (void)
 {
   Lisp_Object saved = list4 (!NILP (menu_items_inuse) ? menu_items : Qnil,
-                            make_number (menu_items_used),
-                            make_number (menu_items_n_panes),
-                            make_number (menu_items_submenu_depth));
+                            make_fixnum (menu_items_used),
+                            make_fixnum (menu_items_n_panes),
+                            make_fixnum (menu_items_submenu_depth));
   record_unwind_protect (restore_menu_items, saved);
   menu_items_inuse = Qnil;
   menu_items = Qnil;
@@ -532,7 +532,7 @@ parse_single_submenu (Lisp_Object item_key, Lisp_Object 
item_name,
   USE_SAFE_ALLOCA;
 
   length = Flength (maps);
-  len = XINT (length);
+  len = XFIXNUM (length);
 
   /* Convert the list MAPS into a vector MAPVEC.  */
   SAFE_ALLOCA_LISP (mapvec, len);
@@ -1079,7 +1079,7 @@ into menu items.  */)
   if (!FRAME_LIVE_P (f))
     return Qnil;
 
-  pixel_to_glyph_coords (f, XINT (x), XINT (y), &col, &row, NULL, 1);
+  pixel_to_glyph_coords (f, XFIXNUM (x), XFIXNUM (y), &col, &row, NULL, 1);
   if (0 <= row && row < FRAME_MENU_BAR_LINES (f))
     {
       Lisp_Object items, item;
@@ -1099,10 +1099,10 @@ into menu items.  */)
          pos = AREF (items, i + 3);
          if (NILP (str))
            return item;
-         if (XINT (pos) <= col
+         if (XFIXNUM (pos) <= col
              /* We use <= so the blank between 2 items on a TTY is
                 considered part of the previous item.  */
-             && col <= XINT (pos) + menu_item_width (SDATA (str)))
+             && col <= XFIXNUM (pos) + menu_item_width (SDATA (str)))
            {
              item = AREF (items, i);
              return item;
@@ -1202,9 +1202,9 @@ x_popup_menu_1 (Lisp_Object position, Lisp_Object menu)
                int cur_x, cur_y;
 
                x_relative_mouse_position (new_f, &cur_x, &cur_y);
-               /* cur_x/y may be negative, so use make_number.  */
-               x = make_number (cur_x);
-               y = make_number (cur_y);
+               /* cur_x/y may be negative, so use make_fixnum.  */
+               x = make_fixnum (cur_x);
+               y = make_fixnum (cur_y);
              }
          }
        else
@@ -1268,8 +1268,8 @@ x_popup_menu_1 (Lisp_Object position, Lisp_Object menu)
                           ? (EMACS_INT) INT_MIN - ypos
                           : MOST_NEGATIVE_FIXNUM),
                          INT_MAX - ypos);
-    xpos += XINT (x);
-    ypos += XINT (y);
+    xpos += XFIXNUM (x);
+    ypos += XFIXNUM (y);
 
     XSETFRAME (Vmenu_updating_frame, f);
   }
@@ -1309,7 +1309,7 @@ x_popup_menu_1 (Lisp_Object position, Lisp_Object menu)
   else if (CONSP (menu) && KEYMAPP (XCAR (menu)))
     {
       /* We were given a list of keymaps.  */
-      EMACS_INT nmaps = XFASTINT (Flength (menu));
+      EMACS_INT nmaps = XFIXNAT (Flength (menu));
       Lisp_Object *maps;
       ptrdiff_t i;
       USE_SAFE_ALLOCA;
diff --git a/src/mini-gmp-emacs.c b/src/mini-gmp-emacs.c
new file mode 100644
index 0000000..7a1b7ab
--- /dev/null
+++ b/src/mini-gmp-emacs.c
@@ -0,0 +1,32 @@
+/* Tailor mini-gmp.c for GNU Emacs
+
+Copyright 2018 Free Software Foundation, Inc.
+
+This file is part of GNU Emacs.
+
+GNU Emacs is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
+
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <stddef.h>
+
+/* Pacify GCC -Wsuggest-attribute=malloc.  */
+static void *gmp_default_alloc (size_t) ATTRIBUTE_MALLOC;
+
+/* Pacify GCC -Wunused-variable for variables used only in 'assert' calls.  */
+#if defined NDEBUG && GNUC_PREREQ (4, 6, 0)
+# pragma GCC diagnostic ignored "-Wunused-variable"
+#endif
+
+#include "mini-gmp.c"
diff --git a/src/mini-gmp.c b/src/mini-gmp.c
new file mode 100644
index 0000000..c0d5b87
--- /dev/null
+++ b/src/mini-gmp.c
@@ -0,0 +1,4452 @@
+/* mini-gmp, a minimalistic implementation of a GNU GMP subset.
+
+   Contributed to the GNU project by Niels Möller
+
+Copyright 1991-1997, 1999-2018 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+  * the GNU Lesser General Public License as published by the Free
+    Software Foundation; either version 3 of the License, or (at your
+    option) any later version.
+
+or
+
+  * the GNU General Public License as published by the Free Software
+    Foundation; either version 2 of the License, or (at your option) any
+    later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
+
+/* NOTE: All functions in this file which are not declared in
+   mini-gmp.h are internal, and are not intended to be compatible
+   neither with GMP nor with future versions of mini-gmp. */
+
+/* Much of the material copied from GMP files, including: gmp-impl.h,
+   longlong.h, mpn/generic/add_n.c, mpn/generic/addmul_1.c,
+   mpn/generic/lshift.c, mpn/generic/mul_1.c,
+   mpn/generic/mul_basecase.c, mpn/generic/rshift.c,
+   mpn/generic/sbpi1_div_qr.c, mpn/generic/sub_n.c,
+   mpn/generic/submul_1.c. */
+
+#include <assert.h>
+#include <ctype.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "mini-gmp.h"
+
+#if !defined(MINI_GMP_DONT_USE_FLOAT_H)
+#include <float.h>
+#endif
+
+
+/* Macros */
+#define GMP_LIMB_BITS (sizeof(mp_limb_t) * CHAR_BIT)
+
+#define GMP_LIMB_MAX (~ (mp_limb_t) 0)
+#define GMP_LIMB_HIGHBIT ((mp_limb_t) 1 << (GMP_LIMB_BITS - 1))
+
+#define GMP_HLIMB_BIT ((mp_limb_t) 1 << (GMP_LIMB_BITS / 2))
+#define GMP_LLIMB_MASK (GMP_HLIMB_BIT - 1)
+
+#define GMP_ULONG_BITS (sizeof(unsigned long) * CHAR_BIT)
+#define GMP_ULONG_HIGHBIT ((unsigned long) 1 << (GMP_ULONG_BITS - 1))
+
+#define GMP_ABS(x) ((x) >= 0 ? (x) : -(x))
+#define GMP_NEG_CAST(T,x) (-((T)((x) + 1) - 1))
+
+#define GMP_MIN(a, b) ((a) < (b) ? (a) : (b))
+#define GMP_MAX(a, b) ((a) > (b) ? (a) : (b))
+
+#define GMP_CMP(a,b) (((a) > (b)) - ((a) < (b)))
+
+#if defined(DBL_MANT_DIG) && FLT_RADIX == 2
+#define GMP_DBL_MANT_BITS DBL_MANT_DIG
+#else
+#define GMP_DBL_MANT_BITS (53)
+#endif
+
+/* Return non-zero if xp,xsize and yp,ysize overlap.
+   If xp+xsize<=yp there's no overlap, or if yp+ysize<=xp there's no
+   overlap.  If both these are false, there's an overlap. */
+#define GMP_MPN_OVERLAP_P(xp, xsize, yp, ysize)                                
\
+  ((xp) + (xsize) > (yp) && (yp) + (ysize) > (xp))
+
+#define gmp_assert_nocarry(x) do { \
+    mp_limb_t __cy = (x);         \
+    assert (__cy == 0);                   \
+  } while (0)
+
+#define gmp_clz(count, x) do {                                         \
+    mp_limb_t __clz_x = (x);                                           \
+    unsigned __clz_c;                                                  \
+    for (__clz_c = 0;                                                  \
+        (__clz_x & ((mp_limb_t) 0xff << (GMP_LIMB_BITS - 8))) == 0;    \
+        __clz_c += 8)                                                  \
+      __clz_x <<= 8;                                                   \
+    for (; (__clz_x & GMP_LIMB_HIGHBIT) == 0; __clz_c++)               \
+      __clz_x <<= 1;                                                   \
+    (count) = __clz_c;                                                 \
+  } while (0)
+
+#define gmp_ctz(count, x) do {                                         \
+    mp_limb_t __ctz_x = (x);                                           \
+    unsigned __ctz_c = 0;                                              \
+    gmp_clz (__ctz_c, __ctz_x & - __ctz_x);                            \
+    (count) = GMP_LIMB_BITS - 1 - __ctz_c;                             \
+  } while (0)
+
+#define gmp_add_ssaaaa(sh, sl, ah, al, bh, bl) \
+  do {                                                                 \
+    mp_limb_t __x;                                                     \
+    __x = (al) + (bl);                                                 \
+    (sh) = (ah) + (bh) + (__x < (al));                                 \
+    (sl) = __x;                                                                
\
+  } while (0)
+
+#define gmp_sub_ddmmss(sh, sl, ah, al, bh, bl) \
+  do {                                                                 \
+    mp_limb_t __x;                                                     \
+    __x = (al) - (bl);                                                 \
+    (sh) = (ah) - (bh) - ((al) < (bl));                                        
\
+    (sl) = __x;                                                                
\
+  } while (0)
+
+#define gmp_umul_ppmm(w1, w0, u, v)                                    \
+  do {                                                                 \
+    mp_limb_t __x0, __x1, __x2, __x3;                                  \
+    unsigned __ul, __vl, __uh, __vh;                                   \
+    mp_limb_t __u = (u), __v = (v);                                    \
+                                                                       \
+    __ul = __u & GMP_LLIMB_MASK;                                       \
+    __uh = __u >> (GMP_LIMB_BITS / 2);                                 \
+    __vl = __v & GMP_LLIMB_MASK;                                       \
+    __vh = __v >> (GMP_LIMB_BITS / 2);                                 \
+                                                                       \
+    __x0 = (mp_limb_t) __ul * __vl;                                    \
+    __x1 = (mp_limb_t) __ul * __vh;                                    \
+    __x2 = (mp_limb_t) __uh * __vl;                                    \
+    __x3 = (mp_limb_t) __uh * __vh;                                    \
+                                                                       \
+    __x1 += __x0 >> (GMP_LIMB_BITS / 2);/* this can't give carry */    \
+    __x1 += __x2;              /* but this indeed can */               \
+    if (__x1 < __x2)           /* did we get it? */                    \
+      __x3 += GMP_HLIMB_BIT;   /* yes, add it in the proper pos. */    \
+                                                                       \
+    (w1) = __x3 + (__x1 >> (GMP_LIMB_BITS / 2));                       \
+    (w0) = (__x1 << (GMP_LIMB_BITS / 2)) + (__x0 & GMP_LLIMB_MASK);    \
+  } while (0)
+
+#define gmp_udiv_qrnnd_preinv(q, r, nh, nl, d, di)                     \
+  do {                                                                 \
+    mp_limb_t _qh, _ql, _r, _mask;                                     \
+    gmp_umul_ppmm (_qh, _ql, (nh), (di));                              \
+    gmp_add_ssaaaa (_qh, _ql, _qh, _ql, (nh) + 1, (nl));               \
+    _r = (nl) - _qh * (d);                                             \
+    _mask = -(mp_limb_t) (_r > _ql); /* both > and >= are OK */                
\
+    _qh += _mask;                                                      \
+    _r += _mask & (d);                                                 \
+    if (_r >= (d))                                                     \
+      {                                                                        
\
+       _r -= (d);                                                      \
+       _qh++;                                                          \
+      }                                                                        
\
+                                                                       \
+    (r) = _r;                                                          \
+    (q) = _qh;                                                         \
+  } while (0)
+
+#define gmp_udiv_qr_3by2(q, r1, r0, n2, n1, n0, d1, d0, dinv)          \
+  do {                                                                 \
+    mp_limb_t _q0, _t1, _t0, _mask;                                    \
+    gmp_umul_ppmm ((q), _q0, (n2), (dinv));                            \
+    gmp_add_ssaaaa ((q), _q0, (q), _q0, (n2), (n1));                   \
+                                                                       \
+    /* Compute the two most significant limbs of n - q'd */            \
+    (r1) = (n1) - (d1) * (q);                                          \
+    gmp_sub_ddmmss ((r1), (r0), (r1), (n0), (d1), (d0));               \
+    gmp_umul_ppmm (_t1, _t0, (d0), (q));                               \
+    gmp_sub_ddmmss ((r1), (r0), (r1), (r0), _t1, _t0);                 \
+    (q)++;                                                             \
+                                                                       \
+    /* Conditionally adjust q and the remainders */                    \
+    _mask = - (mp_limb_t) ((r1) >= _q0);                               \
+    (q) += _mask;                                                      \
+    gmp_add_ssaaaa ((r1), (r0), (r1), (r0), _mask & (d1), _mask & (d0)); \
+    if ((r1) >= (d1))                                                  \
+      {                                                                        
\
+       if ((r1) > (d1) || (r0) >= (d0))                                \
+         {                                                             \
+           (q)++;                                                      \
+           gmp_sub_ddmmss ((r1), (r0), (r1), (r0), (d1), (d0));        \
+         }                                                             \
+      }                                                                        
\
+  } while (0)
+
+/* Swap macros. */
+#define MP_LIMB_T_SWAP(x, y)                                           \
+  do {                                                                 \
+    mp_limb_t __mp_limb_t_swap__tmp = (x);                             \
+    (x) = (y);                                                         \
+    (y) = __mp_limb_t_swap__tmp;                                       \
+  } while (0)
+#define MP_SIZE_T_SWAP(x, y)                                           \
+  do {                                                                 \
+    mp_size_t __mp_size_t_swap__tmp = (x);                             \
+    (x) = (y);                                                         \
+    (y) = __mp_size_t_swap__tmp;                                       \
+  } while (0)
+#define MP_BITCNT_T_SWAP(x,y)                  \
+  do {                                         \
+    mp_bitcnt_t __mp_bitcnt_t_swap__tmp = (x); \
+    (x) = (y);                                 \
+    (y) = __mp_bitcnt_t_swap__tmp;             \
+  } while (0)
+#define MP_PTR_SWAP(x, y)                                              \
+  do {                                                                 \
+    mp_ptr __mp_ptr_swap__tmp = (x);                                   \
+    (x) = (y);                                                         \
+    (y) = __mp_ptr_swap__tmp;                                          \
+  } while (0)
+#define MP_SRCPTR_SWAP(x, y)                                           \
+  do {                                                                 \
+    mp_srcptr __mp_srcptr_swap__tmp = (x);                             \
+    (x) = (y);                                                         \
+    (y) = __mp_srcptr_swap__tmp;                                       \
+  } while (0)
+
+#define MPN_PTR_SWAP(xp,xs, yp,ys)                                     \
+  do {                                                                 \
+    MP_PTR_SWAP (xp, yp);                                              \
+    MP_SIZE_T_SWAP (xs, ys);                                           \
+  } while(0)
+#define MPN_SRCPTR_SWAP(xp,xs, yp,ys)                                  \
+  do {                                                                 \
+    MP_SRCPTR_SWAP (xp, yp);                                           \
+    MP_SIZE_T_SWAP (xs, ys);                                           \
+  } while(0)
+
+#define MPZ_PTR_SWAP(x, y)                                             \
+  do {                                                                 \
+    mpz_ptr __mpz_ptr_swap__tmp = (x);                                 \
+    (x) = (y);                                                         \
+    (y) = __mpz_ptr_swap__tmp;                                         \
+  } while (0)
+#define MPZ_SRCPTR_SWAP(x, y)                                          \
+  do {                                                                 \
+    mpz_srcptr __mpz_srcptr_swap__tmp = (x);                           \
+    (x) = (y);                                                         \
+    (y) = __mpz_srcptr_swap__tmp;                                      \
+  } while (0)
+
+const int mp_bits_per_limb = GMP_LIMB_BITS;
+
+
+/* Memory allocation and other helper functions. */
+static void
+gmp_die (const char *msg)
+{
+  fprintf (stderr, "%s\n", msg);
+  abort();
+}
+
+static void *
+gmp_default_alloc (size_t size)
+{
+  void *p;
+
+  assert (size > 0);
+
+  p = malloc (size);
+  if (!p)
+    gmp_die("gmp_default_alloc: Virtual memory exhausted.");
+
+  return p;
+}
+
+static void *
+gmp_default_realloc (void *old, size_t old_size, size_t new_size)
+{
+  void * p;
+
+  p = realloc (old, new_size);
+
+  if (!p)
+    gmp_die("gmp_default_realloc: Virtual memory exhausted.");
+
+  return p;
+}
+
+static void
+gmp_default_free (void *p, size_t size)
+{
+  free (p);
+}
+
+static void * (*gmp_allocate_func) (size_t) = gmp_default_alloc;
+static void * (*gmp_reallocate_func) (void *, size_t, size_t) = 
gmp_default_realloc;
+static void (*gmp_free_func) (void *, size_t) = gmp_default_free;
+
+void
+mp_get_memory_functions (void *(**alloc_func) (size_t),
+                        void *(**realloc_func) (void *, size_t, size_t),
+                        void (**free_func) (void *, size_t))
+{
+  if (alloc_func)
+    *alloc_func = gmp_allocate_func;
+
+  if (realloc_func)
+    *realloc_func = gmp_reallocate_func;
+
+  if (free_func)
+    *free_func = gmp_free_func;
+}
+
+void
+mp_set_memory_functions (void *(*alloc_func) (size_t),
+                        void *(*realloc_func) (void *, size_t, size_t),
+                        void (*free_func) (void *, size_t))
+{
+  if (!alloc_func)
+    alloc_func = gmp_default_alloc;
+  if (!realloc_func)
+    realloc_func = gmp_default_realloc;
+  if (!free_func)
+    free_func = gmp_default_free;
+
+  gmp_allocate_func = alloc_func;
+  gmp_reallocate_func = realloc_func;
+  gmp_free_func = free_func;
+}
+
+#define gmp_xalloc(size) ((*gmp_allocate_func)((size)))
+#define gmp_free(p) ((*gmp_free_func) ((p), 0))
+
+static mp_ptr
+gmp_xalloc_limbs (mp_size_t size)
+{
+  return (mp_ptr) gmp_xalloc (size * sizeof (mp_limb_t));
+}
+
+static mp_ptr
+gmp_xrealloc_limbs (mp_ptr old, mp_size_t size)
+{
+  assert (size > 0);
+  return (mp_ptr) (*gmp_reallocate_func) (old, 0, size * sizeof (mp_limb_t));
+}
+
+
+/* MPN interface */
+
+void
+mpn_copyi (mp_ptr d, mp_srcptr s, mp_size_t n)
+{
+  mp_size_t i;
+  for (i = 0; i < n; i++)
+    d[i] = s[i];
+}
+
+void
+mpn_copyd (mp_ptr d, mp_srcptr s, mp_size_t n)
+{
+  while (--n >= 0)
+    d[n] = s[n];
+}
+
+int
+mpn_cmp (mp_srcptr ap, mp_srcptr bp, mp_size_t n)
+{
+  while (--n >= 0)
+    {
+      if (ap[n] != bp[n])
+       return ap[n] > bp[n] ? 1 : -1;
+    }
+  return 0;
+}
+
+static int
+mpn_cmp4 (mp_srcptr ap, mp_size_t an, mp_srcptr bp, mp_size_t bn)
+{
+  if (an != bn)
+    return an < bn ? -1 : 1;
+  else
+    return mpn_cmp (ap, bp, an);
+}
+
+static mp_size_t
+mpn_normalized_size (mp_srcptr xp, mp_size_t n)
+{
+  while (n > 0 && xp[n-1] == 0)
+    --n;
+  return n;
+}
+
+int
+mpn_zero_p(mp_srcptr rp, mp_size_t n)
+{
+  return mpn_normalized_size (rp, n) == 0;
+}
+
+void
+mpn_zero (mp_ptr rp, mp_size_t n)
+{
+  while (--n >= 0)
+    rp[n] = 0;
+}
+
+mp_limb_t
+mpn_add_1 (mp_ptr rp, mp_srcptr ap, mp_size_t n, mp_limb_t b)
+{
+  mp_size_t i;
+
+  assert (n > 0);
+  i = 0;
+  do
+    {
+      mp_limb_t r = ap[i] + b;
+      /* Carry out */
+      b = (r < b);
+      rp[i] = r;
+    }
+  while (++i < n);
+
+  return b;
+}
+
+mp_limb_t
+mpn_add_n (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n)
+{
+  mp_size_t i;
+  mp_limb_t cy;
+
+  for (i = 0, cy = 0; i < n; i++)
+    {
+      mp_limb_t a, b, r;
+      a = ap[i]; b = bp[i];
+      r = a + cy;
+      cy = (r < cy);
+      r += b;
+      cy += (r < b);
+      rp[i] = r;
+    }
+  return cy;
+}
+
+mp_limb_t
+mpn_add (mp_ptr rp, mp_srcptr ap, mp_size_t an, mp_srcptr bp, mp_size_t bn)
+{
+  mp_limb_t cy;
+
+  assert (an >= bn);
+
+  cy = mpn_add_n (rp, ap, bp, bn);
+  if (an > bn)
+    cy = mpn_add_1 (rp + bn, ap + bn, an - bn, cy);
+  return cy;
+}
+
+mp_limb_t
+mpn_sub_1 (mp_ptr rp, mp_srcptr ap, mp_size_t n, mp_limb_t b)
+{
+  mp_size_t i;
+
+  assert (n > 0);
+
+  i = 0;
+  do
+    {
+      mp_limb_t a = ap[i];
+      /* Carry out */
+      mp_limb_t cy = a < b;
+      rp[i] = a - b;
+      b = cy;
+    }
+  while (++i < n);
+
+  return b;
+}
+
+mp_limb_t
+mpn_sub_n (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n)
+{
+  mp_size_t i;
+  mp_limb_t cy;
+
+  for (i = 0, cy = 0; i < n; i++)
+    {
+      mp_limb_t a, b;
+      a = ap[i]; b = bp[i];
+      b += cy;
+      cy = (b < cy);
+      cy += (a < b);
+      rp[i] = a - b;
+    }
+  return cy;
+}
+
+mp_limb_t
+mpn_sub (mp_ptr rp, mp_srcptr ap, mp_size_t an, mp_srcptr bp, mp_size_t bn)
+{
+  mp_limb_t cy;
+
+  assert (an >= bn);
+
+  cy = mpn_sub_n (rp, ap, bp, bn);
+  if (an > bn)
+    cy = mpn_sub_1 (rp + bn, ap + bn, an - bn, cy);
+  return cy;
+}
+
+mp_limb_t
+mpn_mul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
+{
+  mp_limb_t ul, cl, hpl, lpl;
+
+  assert (n >= 1);
+
+  cl = 0;
+  do
+    {
+      ul = *up++;
+      gmp_umul_ppmm (hpl, lpl, ul, vl);
+
+      lpl += cl;
+      cl = (lpl < cl) + hpl;
+
+      *rp++ = lpl;
+    }
+  while (--n != 0);
+
+  return cl;
+}
+
+mp_limb_t
+mpn_addmul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
+{
+  mp_limb_t ul, cl, hpl, lpl, rl;
+
+  assert (n >= 1);
+
+  cl = 0;
+  do
+    {
+      ul = *up++;
+      gmp_umul_ppmm (hpl, lpl, ul, vl);
+
+      lpl += cl;
+      cl = (lpl < cl) + hpl;
+
+      rl = *rp;
+      lpl = rl + lpl;
+      cl += lpl < rl;
+      *rp++ = lpl;
+    }
+  while (--n != 0);
+
+  return cl;
+}
+
+mp_limb_t
+mpn_submul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
+{
+  mp_limb_t ul, cl, hpl, lpl, rl;
+
+  assert (n >= 1);
+
+  cl = 0;
+  do
+    {
+      ul = *up++;
+      gmp_umul_ppmm (hpl, lpl, ul, vl);
+
+      lpl += cl;
+      cl = (lpl < cl) + hpl;
+
+      rl = *rp;
+      lpl = rl - lpl;
+      cl += lpl > rl;
+      *rp++ = lpl;
+    }
+  while (--n != 0);
+
+  return cl;
+}
+
+mp_limb_t
+mpn_mul (mp_ptr rp, mp_srcptr up, mp_size_t un, mp_srcptr vp, mp_size_t vn)
+{
+  assert (un >= vn);
+  assert (vn >= 1);
+  assert (!GMP_MPN_OVERLAP_P(rp, un + vn, up, un));
+  assert (!GMP_MPN_OVERLAP_P(rp, un + vn, vp, vn));
+
+  /* We first multiply by the low order limb. This result can be
+     stored, not added, to rp. We also avoid a loop for zeroing this
+     way. */
+
+  rp[un] = mpn_mul_1 (rp, up, un, vp[0]);
+
+  /* Now accumulate the product of up[] and the next higher limb from
+     vp[]. */
+
+  while (--vn >= 1)
+    {
+      rp += 1, vp += 1;
+      rp[un] = mpn_addmul_1 (rp, up, un, vp[0]);
+    }
+  return rp[un];
+}
+
+void
+mpn_mul_n (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n)
+{
+  mpn_mul (rp, ap, n, bp, n);
+}
+
+void
+mpn_sqr (mp_ptr rp, mp_srcptr ap, mp_size_t n)
+{
+  mpn_mul (rp, ap, n, ap, n);
+}
+
+mp_limb_t
+mpn_lshift (mp_ptr rp, mp_srcptr up, mp_size_t n, unsigned int cnt)
+{
+  mp_limb_t high_limb, low_limb;
+  unsigned int tnc;
+  mp_limb_t retval;
+
+  assert (n >= 1);
+  assert (cnt >= 1);
+  assert (cnt < GMP_LIMB_BITS);
+
+  up += n;
+  rp += n;
+
+  tnc = GMP_LIMB_BITS - cnt;
+  low_limb = *--up;
+  retval = low_limb >> tnc;
+  high_limb = (low_limb << cnt);
+
+  while (--n != 0)
+    {
+      low_limb = *--up;
+      *--rp = high_limb | (low_limb >> tnc);
+      high_limb = (low_limb << cnt);
+    }
+  *--rp = high_limb;
+
+  return retval;
+}
+
+mp_limb_t
+mpn_rshift (mp_ptr rp, mp_srcptr up, mp_size_t n, unsigned int cnt)
+{
+  mp_limb_t high_limb, low_limb;
+  unsigned int tnc;
+  mp_limb_t retval;
+
+  assert (n >= 1);
+  assert (cnt >= 1);
+  assert (cnt < GMP_LIMB_BITS);
+
+  tnc = GMP_LIMB_BITS - cnt;
+  high_limb = *up++;
+  retval = (high_limb << tnc);
+  low_limb = high_limb >> cnt;
+
+  while (--n != 0)
+    {
+      high_limb = *up++;
+      *rp++ = low_limb | (high_limb << tnc);
+      low_limb = high_limb >> cnt;
+    }
+  *rp = low_limb;
+
+  return retval;
+}
+
+static mp_bitcnt_t
+mpn_common_scan (mp_limb_t limb, mp_size_t i, mp_srcptr up, mp_size_t un,
+                mp_limb_t ux)
+{
+  unsigned cnt;
+
+  assert (ux == 0 || ux == GMP_LIMB_MAX);
+  assert (0 <= i && i <= un );
+
+  while (limb == 0)
+    {
+      i++;
+      if (i == un)
+       return (ux == 0 ? ~(mp_bitcnt_t) 0 : un * GMP_LIMB_BITS);
+      limb = ux ^ up[i];
+    }
+  gmp_ctz (cnt, limb);
+  return (mp_bitcnt_t) i * GMP_LIMB_BITS + cnt;
+}
+
+mp_bitcnt_t
+mpn_scan1 (mp_srcptr ptr, mp_bitcnt_t bit)
+{
+  mp_size_t i;
+  i = bit / GMP_LIMB_BITS;
+
+  return mpn_common_scan ( ptr[i] & (GMP_LIMB_MAX << (bit % GMP_LIMB_BITS)),
+                         i, ptr, i, 0);
+}
+
+mp_bitcnt_t
+mpn_scan0 (mp_srcptr ptr, mp_bitcnt_t bit)
+{
+  mp_size_t i;
+  i = bit / GMP_LIMB_BITS;
+
+  return mpn_common_scan (~ptr[i] & (GMP_LIMB_MAX << (bit % GMP_LIMB_BITS)),
+                         i, ptr, i, GMP_LIMB_MAX);
+}
+
+void
+mpn_com (mp_ptr rp, mp_srcptr up, mp_size_t n)
+{
+  while (--n >= 0)
+    *rp++ = ~ *up++;
+}
+
+mp_limb_t
+mpn_neg (mp_ptr rp, mp_srcptr up, mp_size_t n)
+{
+  while (*up == 0)
+    {
+      *rp = 0;
+      if (!--n)
+       return 0;
+      ++up; ++rp;
+    }
+  *rp = - *up;
+  mpn_com (++rp, ++up, --n);
+  return 1;
+}
+
+
+/* MPN division interface. */
+
+/* The 3/2 inverse is defined as
+
+     m = floor( (B^3-1) / (B u1 + u0)) - B
+*/
+mp_limb_t
+mpn_invert_3by2 (mp_limb_t u1, mp_limb_t u0)
+{
+  mp_limb_t r, p, m, ql;
+  unsigned ul, uh, qh;
+
+  assert (u1 >= GMP_LIMB_HIGHBIT);
+
+  /* For notation, let b denote the half-limb base, so that B = b^2.
+     Split u1 = b uh + ul. */
+  ul = u1 & GMP_LLIMB_MASK;
+  uh = u1 >> (GMP_LIMB_BITS / 2);
+
+  /* Approximation of the high half of quotient. Differs from the 2/1
+     inverse of the half limb uh, since we have already subtracted
+     u0. */
+  qh = ~u1 / uh;
+
+  /* Adjust to get a half-limb 3/2 inverse, i.e., we want
+
+     qh' = floor( (b^3 - 1) / u) - b = floor ((b^3 - b u - 1) / u
+         = floor( (b (~u) + b-1) / u),
+
+     and the remainder
+
+     r = b (~u) + b-1 - qh (b uh + ul)
+       = b (~u - qh uh) + b-1 - qh ul
+
+     Subtraction of qh ul may underflow, which implies adjustments.
+     But by normalization, 2 u >= B > qh ul, so we need to adjust by
+     at most 2.
+  */
+
+  r = ((~u1 - (mp_limb_t) qh * uh) << (GMP_LIMB_BITS / 2)) | GMP_LLIMB_MASK;
+
+  p = (mp_limb_t) qh * ul;
+  /* Adjustment steps taken from udiv_qrnnd_c */
+  if (r < p)
+    {
+      qh--;
+      r += u1;
+      if (r >= u1) /* i.e. we didn't get carry when adding to r */
+       if (r < p)
+         {
+           qh--;
+           r += u1;
+         }
+    }
+  r -= p;
+
+  /* Low half of the quotient is
+
+       ql = floor ( (b r + b-1) / u1).
+
+     This is a 3/2 division (on half-limbs), for which qh is a
+     suitable inverse. */
+
+  p = (r >> (GMP_LIMB_BITS / 2)) * qh + r;
+  /* Unlike full-limb 3/2, we can add 1 without overflow. For this to
+     work, it is essential that ql is a full mp_limb_t. */
+  ql = (p >> (GMP_LIMB_BITS / 2)) + 1;
+
+  /* By the 3/2 trick, we don't need the high half limb. */
+  r = (r << (GMP_LIMB_BITS / 2)) + GMP_LLIMB_MASK - ql * u1;
+
+  if (r >= (p << (GMP_LIMB_BITS / 2)))
+    {
+      ql--;
+      r += u1;
+    }
+  m = ((mp_limb_t) qh << (GMP_LIMB_BITS / 2)) + ql;
+  if (r >= u1)
+    {
+      m++;
+      r -= u1;
+    }
+
+  /* Now m is the 2/1 invers of u1. If u0 > 0, adjust it to become a
+     3/2 inverse. */
+  if (u0 > 0)
+    {
+      mp_limb_t th, tl;
+      r = ~r;
+      r += u0;
+      if (r < u0)
+       {
+         m--;
+         if (r >= u1)
+           {
+             m--;
+             r -= u1;
+           }
+         r -= u1;
+       }
+      gmp_umul_ppmm (th, tl, u0, m);
+      r += th;
+      if (r < th)
+       {
+         m--;
+         m -= ((r > u1) | ((r == u1) & (tl > u0)));
+       }
+    }
+
+  return m;
+}
+
+struct gmp_div_inverse
+{
+  /* Normalization shift count. */
+  unsigned shift;
+  /* Normalized divisor (d0 unused for mpn_div_qr_1) */
+  mp_limb_t d1, d0;
+  /* Inverse, for 2/1 or 3/2. */
+  mp_limb_t di;
+};
+
+static void
+mpn_div_qr_1_invert (struct gmp_div_inverse *inv, mp_limb_t d)
+{
+  unsigned shift;
+
+  assert (d > 0);
+  gmp_clz (shift, d);
+  inv->shift = shift;
+  inv->d1 = d << shift;
+  inv->di = mpn_invert_limb (inv->d1);
+}
+
+static void
+mpn_div_qr_2_invert (struct gmp_div_inverse *inv,
+                    mp_limb_t d1, mp_limb_t d0)
+{
+  unsigned shift;
+
+  assert (d1 > 0);
+  gmp_clz (shift, d1);
+  inv->shift = shift;
+  if (shift > 0)
+    {
+      d1 = (d1 << shift) | (d0 >> (GMP_LIMB_BITS - shift));
+      d0 <<= shift;
+    }
+  inv->d1 = d1;
+  inv->d0 = d0;
+  inv->di = mpn_invert_3by2 (d1, d0);
+}
+
+static void
+mpn_div_qr_invert (struct gmp_div_inverse *inv,
+                  mp_srcptr dp, mp_size_t dn)
+{
+  assert (dn > 0);
+
+  if (dn == 1)
+    mpn_div_qr_1_invert (inv, dp[0]);
+  else if (dn == 2)
+    mpn_div_qr_2_invert (inv, dp[1], dp[0]);
+  else
+    {
+      unsigned shift;
+      mp_limb_t d1, d0;
+
+      d1 = dp[dn-1];
+      d0 = dp[dn-2];
+      assert (d1 > 0);
+      gmp_clz (shift, d1);
+      inv->shift = shift;
+      if (shift > 0)
+       {
+         d1 = (d1 << shift) | (d0 >> (GMP_LIMB_BITS - shift));
+         d0 = (d0 << shift) | (dp[dn-3] >> (GMP_LIMB_BITS - shift));
+       }
+      inv->d1 = d1;
+      inv->d0 = d0;
+      inv->di = mpn_invert_3by2 (d1, d0);
+    }
+}
+
+/* Not matching current public gmp interface, rather corresponding to
+   the sbpi1_div_* functions. */
+static mp_limb_t
+mpn_div_qr_1_preinv (mp_ptr qp, mp_srcptr np, mp_size_t nn,
+                    const struct gmp_div_inverse *inv)
+{
+  mp_limb_t d, di;
+  mp_limb_t r;
+  mp_ptr tp = NULL;
+
+  if (inv->shift > 0)
+    {
+      /* Shift, reusing qp area if possible. In-place shift if qp == np. */
+      tp = qp ? qp : gmp_xalloc_limbs (nn);
+      r = mpn_lshift (tp, np, nn, inv->shift);
+      np = tp;
+    }
+  else
+    r = 0;
+
+  d = inv->d1;
+  di = inv->di;
+  while (--nn >= 0)
+    {
+      mp_limb_t q;
+
+      gmp_udiv_qrnnd_preinv (q, r, r, np[nn], d, di);
+      if (qp)
+       qp[nn] = q;
+    }
+  if ((inv->shift > 0) && (tp != qp))
+    gmp_free (tp);
+
+  return r >> inv->shift;
+}
+
+static mp_limb_t
+mpn_div_qr_1 (mp_ptr qp, mp_srcptr np, mp_size_t nn, mp_limb_t d)
+{
+  assert (d > 0);
+
+  /* Special case for powers of two. */
+  if ((d & (d-1)) == 0)
+    {
+      mp_limb_t r = np[0] & (d-1);
+      if (qp)
+       {
+         if (d <= 1)
+           mpn_copyi (qp, np, nn);
+         else
+           {
+             unsigned shift;
+             gmp_ctz (shift, d);
+             mpn_rshift (qp, np, nn, shift);
+           }
+       }
+      return r;
+    }
+  else
+    {
+      struct gmp_div_inverse inv;
+      mpn_div_qr_1_invert (&inv, d);
+      return mpn_div_qr_1_preinv (qp, np, nn, &inv);
+    }
+}
+
+static void
+mpn_div_qr_2_preinv (mp_ptr qp, mp_ptr np, mp_size_t nn,
+                    const struct gmp_div_inverse *inv)
+{
+  unsigned shift;
+  mp_size_t i;
+  mp_limb_t d1, d0, di, r1, r0;
+
+  assert (nn >= 2);
+  shift = inv->shift;
+  d1 = inv->d1;
+  d0 = inv->d0;
+  di = inv->di;
+
+  if (shift > 0)
+    r1 = mpn_lshift (np, np, nn, shift);
+  else
+    r1 = 0;
+
+  r0 = np[nn - 1];
+
+  i = nn - 2;
+  do
+    {
+      mp_limb_t n0, q;
+      n0 = np[i];
+      gmp_udiv_qr_3by2 (q, r1, r0, r1, r0, n0, d1, d0, di);
+
+      if (qp)
+       qp[i] = q;
+    }
+  while (--i >= 0);
+
+  if (shift > 0)
+    {
+      assert ((r0 << (GMP_LIMB_BITS - shift)) == 0);
+      r0 = (r0 >> shift) | (r1 << (GMP_LIMB_BITS - shift));
+      r1 >>= shift;
+    }
+
+  np[1] = r1;
+  np[0] = r0;
+}
+
+static void
+mpn_div_qr_pi1 (mp_ptr qp,
+               mp_ptr np, mp_size_t nn, mp_limb_t n1,
+               mp_srcptr dp, mp_size_t dn,
+               mp_limb_t dinv)
+{
+  mp_size_t i;
+
+  mp_limb_t d1, d0;
+  mp_limb_t cy, cy1;
+  mp_limb_t q;
+
+  assert (dn > 2);
+  assert (nn >= dn);
+
+  d1 = dp[dn - 1];
+  d0 = dp[dn - 2];
+
+  assert ((d1 & GMP_LIMB_HIGHBIT) != 0);
+  /* Iteration variable is the index of the q limb.
+   *
+   * We divide <n1, np[dn-1+i], np[dn-2+i], np[dn-3+i],..., np[i]>
+   * by            <d1,          d0,        dp[dn-3],  ..., dp[0] >
+   */
+
+  i = nn - dn;
+  do
+    {
+      mp_limb_t n0 = np[dn-1+i];
+
+      if (n1 == d1 && n0 == d0)
+       {
+         q = GMP_LIMB_MAX;
+         mpn_submul_1 (np+i, dp, dn, q);
+         n1 = np[dn-1+i];      /* update n1, last loop's value will now be 
invalid */
+       }
+      else
+       {
+         gmp_udiv_qr_3by2 (q, n1, n0, n1, n0, np[dn-2+i], d1, d0, dinv);
+
+         cy = mpn_submul_1 (np + i, dp, dn-2, q);
+
+         cy1 = n0 < cy;
+         n0 = n0 - cy;
+         cy = n1 < cy1;
+         n1 = n1 - cy1;
+         np[dn-2+i] = n0;
+
+         if (cy != 0)
+           {
+             n1 += d1 + mpn_add_n (np + i, np + i, dp, dn - 1);
+             q--;
+           }
+       }
+
+      if (qp)
+       qp[i] = q;
+    }
+  while (--i >= 0);
+
+  np[dn - 1] = n1;
+}
+
+static void
+mpn_div_qr_preinv (mp_ptr qp, mp_ptr np, mp_size_t nn,
+                  mp_srcptr dp, mp_size_t dn,
+                  const struct gmp_div_inverse *inv)
+{
+  assert (dn > 0);
+  assert (nn >= dn);
+
+  if (dn == 1)
+    np[0] = mpn_div_qr_1_preinv (qp, np, nn, inv);
+  else if (dn == 2)
+    mpn_div_qr_2_preinv (qp, np, nn, inv);
+  else
+    {
+      mp_limb_t nh;
+      unsigned shift;
+
+      assert (inv->d1 == dp[dn-1]);
+      assert (inv->d0 == dp[dn-2]);
+      assert ((inv->d1 & GMP_LIMB_HIGHBIT) != 0);
+
+      shift = inv->shift;
+      if (shift > 0)
+       nh = mpn_lshift (np, np, nn, shift);
+      else
+       nh = 0;
+
+      mpn_div_qr_pi1 (qp, np, nn, nh, dp, dn, inv->di);
+
+      if (shift > 0)
+       gmp_assert_nocarry (mpn_rshift (np, np, dn, shift));
+    }
+}
+
+static void
+mpn_div_qr (mp_ptr qp, mp_ptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn)
+{
+  struct gmp_div_inverse inv;
+  mp_ptr tp = NULL;
+
+  assert (dn > 0);
+  assert (nn >= dn);
+
+  mpn_div_qr_invert (&inv, dp, dn);
+  if (dn > 2 && inv.shift > 0)
+    {
+      tp = gmp_xalloc_limbs (dn);
+      gmp_assert_nocarry (mpn_lshift (tp, dp, dn, inv.shift));
+      dp = tp;
+    }
+  mpn_div_qr_preinv (qp, np, nn, dp, dn, &inv);
+  if (tp)
+    gmp_free (tp);
+}
+
+
+/* MPN base conversion. */
+static unsigned
+mpn_base_power_of_two_p (unsigned b)
+{
+  switch (b)
+    {
+    case 2: return 1;
+    case 4: return 2;
+    case 8: return 3;
+    case 16: return 4;
+    case 32: return 5;
+    case 64: return 6;
+    case 128: return 7;
+    case 256: return 8;
+    default: return 0;
+    }
+}
+
+struct mpn_base_info
+{
+  /* bb is the largest power of the base which fits in one limb, and
+     exp is the corresponding exponent. */
+  unsigned exp;
+  mp_limb_t bb;
+};
+
+static void
+mpn_get_base_info (struct mpn_base_info *info, mp_limb_t b)
+{
+  mp_limb_t m;
+  mp_limb_t p;
+  unsigned exp;
+
+  m = GMP_LIMB_MAX / b;
+  for (exp = 1, p = b; p <= m; exp++)
+    p *= b;
+
+  info->exp = exp;
+  info->bb = p;
+}
+
+static mp_bitcnt_t
+mpn_limb_size_in_base_2 (mp_limb_t u)
+{
+  unsigned shift;
+
+  assert (u > 0);
+  gmp_clz (shift, u);
+  return GMP_LIMB_BITS - shift;
+}
+
+static size_t
+mpn_get_str_bits (unsigned char *sp, unsigned bits, mp_srcptr up, mp_size_t un)
+{
+  unsigned char mask;
+  size_t sn, j;
+  mp_size_t i;
+  unsigned shift;
+
+  sn = ((un - 1) * GMP_LIMB_BITS + mpn_limb_size_in_base_2 (up[un-1])
+       + bits - 1) / bits;
+
+  mask = (1U << bits) - 1;
+
+  for (i = 0, j = sn, shift = 0; j-- > 0;)
+    {
+      unsigned char digit = up[i] >> shift;
+
+      shift += bits;
+
+      if (shift >= GMP_LIMB_BITS && ++i < un)
+       {
+         shift -= GMP_LIMB_BITS;
+         digit |= up[i] << (bits - shift);
+       }
+      sp[j] = digit & mask;
+    }
+  return sn;
+}
+
+/* We generate digits from the least significant end, and reverse at
+   the end. */
+static size_t
+mpn_limb_get_str (unsigned char *sp, mp_limb_t w,
+                 const struct gmp_div_inverse *binv)
+{
+  mp_size_t i;
+  for (i = 0; w > 0; i++)
+    {
+      mp_limb_t h, l, r;
+
+      h = w >> (GMP_LIMB_BITS - binv->shift);
+      l = w << binv->shift;
+
+      gmp_udiv_qrnnd_preinv (w, r, h, l, binv->d1, binv->di);
+      assert ( (r << (GMP_LIMB_BITS - binv->shift)) == 0);
+      r >>= binv->shift;
+
+      sp[i] = r;
+    }
+  return i;
+}
+
+static size_t
+mpn_get_str_other (unsigned char *sp,
+                  int base, const struct mpn_base_info *info,
+                  mp_ptr up, mp_size_t un)
+{
+  struct gmp_div_inverse binv;
+  size_t sn;
+  size_t i;
+
+  mpn_div_qr_1_invert (&binv, base);
+
+  sn = 0;
+
+  if (un > 1)
+    {
+      struct gmp_div_inverse bbinv;
+      mpn_div_qr_1_invert (&bbinv, info->bb);
+
+      do
+       {
+         mp_limb_t w;
+         size_t done;
+         w = mpn_div_qr_1_preinv (up, up, un, &bbinv);
+         un -= (up[un-1] == 0);
+         done = mpn_limb_get_str (sp + sn, w, &binv);
+
+         for (sn += done; done < info->exp; done++)
+           sp[sn++] = 0;
+       }
+      while (un > 1);
+    }
+  sn += mpn_limb_get_str (sp + sn, up[0], &binv);
+
+  /* Reverse order */
+  for (i = 0; 2*i + 1 < sn; i++)
+    {
+      unsigned char t = sp[i];
+      sp[i] = sp[sn - i - 1];
+      sp[sn - i - 1] = t;
+    }
+
+  return sn;
+}
+
+size_t
+mpn_get_str (unsigned char *sp, int base, mp_ptr up, mp_size_t un)
+{
+  unsigned bits;
+
+  assert (un > 0);
+  assert (up[un-1] > 0);
+
+  bits = mpn_base_power_of_two_p (base);
+  if (bits)
+    return mpn_get_str_bits (sp, bits, up, un);
+  else
+    {
+      struct mpn_base_info info;
+
+      mpn_get_base_info (&info, base);
+      return mpn_get_str_other (sp, base, &info, up, un);
+    }
+}
+
+static mp_size_t
+mpn_set_str_bits (mp_ptr rp, const unsigned char *sp, size_t sn,
+                 unsigned bits)
+{
+  mp_size_t rn;
+  size_t j;
+  unsigned shift;
+
+  for (j = sn, rn = 0, shift = 0; j-- > 0; )
+    {
+      if (shift == 0)
+       {
+         rp[rn++] = sp[j];
+         shift += bits;
+       }
+      else
+       {
+         rp[rn-1] |= (mp_limb_t) sp[j] << shift;
+         shift += bits;
+         if (shift >= GMP_LIMB_BITS)
+           {
+             shift -= GMP_LIMB_BITS;
+             if (shift > 0)
+               rp[rn++] = (mp_limb_t) sp[j] >> (bits - shift);
+           }
+       }
+    }
+  rn = mpn_normalized_size (rp, rn);
+  return rn;
+}
+
+/* Result is usually normalized, except for all-zero input, in which
+   case a single zero limb is written at *RP, and 1 is returned. */
+static mp_size_t
+mpn_set_str_other (mp_ptr rp, const unsigned char *sp, size_t sn,
+                  mp_limb_t b, const struct mpn_base_info *info)
+{
+  mp_size_t rn;
+  mp_limb_t w;
+  unsigned k;
+  size_t j;
+
+  assert (sn > 0);
+
+  k = 1 + (sn - 1) % info->exp;
+
+  j = 0;
+  w = sp[j++];
+  while (--k != 0)
+    w = w * b + sp[j++];
+
+  rp[0] = w;
+
+  for (rn = 1; j < sn;)
+    {
+      mp_limb_t cy;
+
+      w = sp[j++];
+      for (k = 1; k < info->exp; k++)
+       w = w * b + sp[j++];
+
+      cy = mpn_mul_1 (rp, rp, rn, info->bb);
+      cy += mpn_add_1 (rp, rp, rn, w);
+      if (cy > 0)
+       rp[rn++] = cy;
+    }
+  assert (j == sn);
+
+  return rn;
+}
+
+mp_size_t
+mpn_set_str (mp_ptr rp, const unsigned char *sp, size_t sn, int base)
+{
+  unsigned bits;
+
+  if (sn == 0)
+    return 0;
+
+  bits = mpn_base_power_of_two_p (base);
+  if (bits)
+    return mpn_set_str_bits (rp, sp, sn, bits);
+  else
+    {
+      struct mpn_base_info info;
+
+      mpn_get_base_info (&info, base);
+      return mpn_set_str_other (rp, sp, sn, base, &info);
+    }
+}
+
+
+/* MPZ interface */
+void
+mpz_init (mpz_t r)
+{
+  static const mp_limb_t dummy_limb = 0xc1a0;
+
+  r->_mp_alloc = 0;
+  r->_mp_size = 0;
+  r->_mp_d = (mp_ptr) &dummy_limb;
+}
+
+/* The utility of this function is a bit limited, since many functions
+   assigns the result variable using mpz_swap. */
+void
+mpz_init2 (mpz_t r, mp_bitcnt_t bits)
+{
+  mp_size_t rn;
+
+  bits -= (bits != 0);         /* Round down, except if 0 */
+  rn = 1 + bits / GMP_LIMB_BITS;
+
+  r->_mp_alloc = rn;
+  r->_mp_size = 0;
+  r->_mp_d = gmp_xalloc_limbs (rn);
+}
+
+void
+mpz_clear (mpz_t r)
+{
+  if (r->_mp_alloc)
+    gmp_free (r->_mp_d);
+}
+
+static mp_ptr
+mpz_realloc (mpz_t r, mp_size_t size)
+{
+  size = GMP_MAX (size, 1);
+
+  if (r->_mp_alloc)
+    r->_mp_d = gmp_xrealloc_limbs (r->_mp_d, size);
+  else
+    r->_mp_d = gmp_xalloc_limbs (size);
+  r->_mp_alloc = size;
+
+  if (GMP_ABS (r->_mp_size) > size)
+    r->_mp_size = 0;
+
+  return r->_mp_d;
+}
+
+/* Realloc for an mpz_t WHAT if it has less than NEEDED limbs.  */
+#define MPZ_REALLOC(z,n) ((n) > (z)->_mp_alloc                 \
+                         ? mpz_realloc(z,n)                    \
+                         : (z)->_mp_d)
+
+/* MPZ assignment and basic conversions. */
+void
+mpz_set_si (mpz_t r, signed long int x)
+{
+  if (x >= 0)
+    mpz_set_ui (r, x);
+  else /* (x < 0) */
+    {
+      r->_mp_size = -1;
+      MPZ_REALLOC (r, 1)[0] = GMP_NEG_CAST (unsigned long int, x);
+    }
+}
+
+void
+mpz_set_ui (mpz_t r, unsigned long int x)
+{
+  if (x > 0)
+    {
+      r->_mp_size = 1;
+      MPZ_REALLOC (r, 1)[0] = x;
+    }
+  else
+    r->_mp_size = 0;
+}
+
+void
+mpz_set (mpz_t r, const mpz_t x)
+{
+  /* Allow the NOP r == x */
+  if (r != x)
+    {
+      mp_size_t n;
+      mp_ptr rp;
+
+      n = GMP_ABS (x->_mp_size);
+      rp = MPZ_REALLOC (r, n);
+
+      mpn_copyi (rp, x->_mp_d, n);
+      r->_mp_size = x->_mp_size;
+    }
+}
+
+void
+mpz_init_set_si (mpz_t r, signed long int x)
+{
+  mpz_init (r);
+  mpz_set_si (r, x);
+}
+
+void
+mpz_init_set_ui (mpz_t r, unsigned long int x)
+{
+  mpz_init (r);
+  mpz_set_ui (r, x);
+}
+
+void
+mpz_init_set (mpz_t r, const mpz_t x)
+{
+  mpz_init (r);
+  mpz_set (r, x);
+}
+
+int
+mpz_fits_slong_p (const mpz_t u)
+{
+  mp_size_t us = u->_mp_size;
+
+  if (us == 1)
+    return u->_mp_d[0] < GMP_LIMB_HIGHBIT;
+  else if (us == -1)
+    return u->_mp_d[0] <= GMP_LIMB_HIGHBIT;
+  else
+    return (us == 0);
+}
+
+int
+mpz_fits_ulong_p (const mpz_t u)
+{
+  mp_size_t us = u->_mp_size;
+
+  return (us == (us > 0));
+}
+
+long int
+mpz_get_si (const mpz_t u)
+{
+  if (u->_mp_size < 0)
+    /* This expression is necessary to properly handle 0x80000000 */
+    return -1 - (long) ((u->_mp_d[0] - 1) & ~GMP_LIMB_HIGHBIT);
+  else
+    return (long) (mpz_get_ui (u) & ~GMP_LIMB_HIGHBIT);
+}
+
+unsigned long int
+mpz_get_ui (const mpz_t u)
+{
+  return u->_mp_size == 0 ? 0 : u->_mp_d[0];
+}
+
+size_t
+mpz_size (const mpz_t u)
+{
+  return GMP_ABS (u->_mp_size);
+}
+
+mp_limb_t
+mpz_getlimbn (const mpz_t u, mp_size_t n)
+{
+  if (n >= 0 && n < GMP_ABS (u->_mp_size))
+    return u->_mp_d[n];
+  else
+    return 0;
+}
+
+void
+mpz_realloc2 (mpz_t x, mp_bitcnt_t n)
+{
+  mpz_realloc (x, 1 + (n - (n != 0)) / GMP_LIMB_BITS);
+}
+
+mp_srcptr
+mpz_limbs_read (mpz_srcptr x)
+{
+  return x->_mp_d;
+}
+
+mp_ptr
+mpz_limbs_modify (mpz_t x, mp_size_t n)
+{
+  assert (n > 0);
+  return MPZ_REALLOC (x, n);
+}
+
+mp_ptr
+mpz_limbs_write (mpz_t x, mp_size_t n)
+{
+  return mpz_limbs_modify (x, n);
+}
+
+void
+mpz_limbs_finish (mpz_t x, mp_size_t xs)
+{
+  mp_size_t xn;
+  xn = mpn_normalized_size (x->_mp_d, GMP_ABS (xs));
+  x->_mp_size = xs < 0 ? -xn : xn;
+}
+
+static mpz_srcptr
+mpz_roinit_normal_n (mpz_t x, mp_srcptr xp, mp_size_t xs)
+{
+  x->_mp_alloc = 0;
+  x->_mp_d = (mp_ptr) xp;
+  x->_mp_size = xs;
+  return x;
+}
+
+mpz_srcptr
+mpz_roinit_n (mpz_t x, mp_srcptr xp, mp_size_t xs)
+{
+  mpz_roinit_normal_n (x, xp, xs);
+  mpz_limbs_finish (x, xs);
+  return x;
+}
+
+
+/* Conversions and comparison to double. */
+void
+mpz_set_d (mpz_t r, double x)
+{
+  int sign;
+  mp_ptr rp;
+  mp_size_t rn, i;
+  double B;
+  double Bi;
+  mp_limb_t f;
+
+  /* x != x is true when x is a NaN, and x == x * 0.5 is true when x is
+     zero or infinity. */
+  if (x != x || x == x * 0.5)
+    {
+      r->_mp_size = 0;
+      return;
+    }
+
+  sign = x < 0.0 ;
+  if (sign)
+    x = - x;
+
+  if (x < 1.0)
+    {
+      r->_mp_size = 0;
+      return;
+    }
+  B = 2.0 * (double) GMP_LIMB_HIGHBIT;
+  Bi = 1.0 / B;
+  for (rn = 1; x >= B; rn++)
+    x *= Bi;
+
+  rp = MPZ_REALLOC (r, rn);
+
+  f = (mp_limb_t) x;
+  x -= f;
+  assert (x < 1.0);
+  i = rn-1;
+  rp[i] = f;
+  while (--i >= 0)
+    {
+      x = B * x;
+      f = (mp_limb_t) x;
+      x -= f;
+      assert (x < 1.0);
+      rp[i] = f;
+    }
+
+  r->_mp_size = sign ? - rn : rn;
+}
+
+void
+mpz_init_set_d (mpz_t r, double x)
+{
+  mpz_init (r);
+  mpz_set_d (r, x);
+}
+
+double
+mpz_get_d (const mpz_t u)
+{
+  int m;
+  mp_limb_t l;
+  mp_size_t un;
+  double x;
+  double B = 2.0 * (double) GMP_LIMB_HIGHBIT;
+
+  un = GMP_ABS (u->_mp_size);
+
+  if (un == 0)
+    return 0.0;
+
+  l = u->_mp_d[--un];
+  gmp_clz (m, l);
+  m = m + GMP_DBL_MANT_BITS - GMP_LIMB_BITS;
+  if (m < 0)
+    l &= GMP_LIMB_MAX << -m;
+
+  for (x = l; --un >= 0;)
+    {
+      x = B*x;
+      if (m > 0) {
+       l = u->_mp_d[un];
+       m -= GMP_LIMB_BITS;
+       if (m < 0)
+         l &= GMP_LIMB_MAX << -m;
+       x += l;
+      }
+    }
+
+  if (u->_mp_size < 0)
+    x = -x;
+
+  return x;
+}
+
+int
+mpz_cmpabs_d (const mpz_t x, double d)
+{
+  mp_size_t xn;
+  double B, Bi;
+  mp_size_t i;
+
+  xn = x->_mp_size;
+  d = GMP_ABS (d);
+
+  if (xn != 0)
+    {
+      xn = GMP_ABS (xn);
+
+      B = 2.0 * (double) GMP_LIMB_HIGHBIT;
+      Bi = 1.0 / B;
+
+      /* Scale d so it can be compared with the top limb. */
+      for (i = 1; i < xn; i++)
+       d *= Bi;
+
+      if (d >= B)
+       return -1;
+
+      /* Compare floor(d) to top limb, subtract and cancel when equal. */
+      for (i = xn; i-- > 0;)
+       {
+         mp_limb_t f, xl;
+
+         f = (mp_limb_t) d;
+         xl = x->_mp_d[i];
+         if (xl > f)
+           return 1;
+         else if (xl < f)
+           return -1;
+         d = B * (d - f);
+       }
+    }
+  return - (d > 0.0);
+}
+
+int
+mpz_cmp_d (const mpz_t x, double d)
+{
+  if (x->_mp_size < 0)
+    {
+      if (d >= 0.0)
+       return -1;
+      else
+       return -mpz_cmpabs_d (x, d);
+    }
+  else
+    {
+      if (d < 0.0)
+       return 1;
+      else
+       return mpz_cmpabs_d (x, d);
+    }
+}
+
+
+/* MPZ comparisons and the like. */
+int
+mpz_sgn (const mpz_t u)
+{
+  return GMP_CMP (u->_mp_size, 0);
+}
+
+int
+mpz_cmp_si (const mpz_t u, long v)
+{
+  mp_size_t usize = u->_mp_size;
+
+  if (usize < -1)
+    return -1;
+  else if (v >= 0)
+    return mpz_cmp_ui (u, v);
+  else if (usize >= 0)
+    return 1;
+  else /* usize == -1 */
+    return GMP_CMP (GMP_NEG_CAST (mp_limb_t, v), u->_mp_d[0]);
+}
+
+int
+mpz_cmp_ui (const mpz_t u, unsigned long v)
+{
+  mp_size_t usize = u->_mp_size;
+
+  if (usize > 1)
+    return 1;
+  else if (usize < 0)
+    return -1;
+  else
+    return GMP_CMP (mpz_get_ui (u), v);
+}
+
+int
+mpz_cmp (const mpz_t a, const mpz_t b)
+{
+  mp_size_t asize = a->_mp_size;
+  mp_size_t bsize = b->_mp_size;
+
+  if (asize != bsize)
+    return (asize < bsize) ? -1 : 1;
+  else if (asize >= 0)
+    return mpn_cmp (a->_mp_d, b->_mp_d, asize);
+  else
+    return mpn_cmp (b->_mp_d, a->_mp_d, -asize);
+}
+
+int
+mpz_cmpabs_ui (const mpz_t u, unsigned long v)
+{
+  if (GMP_ABS (u->_mp_size) > 1)
+    return 1;
+  else
+    return GMP_CMP (mpz_get_ui (u), v);
+}
+
+int
+mpz_cmpabs (const mpz_t u, const mpz_t v)
+{
+  return mpn_cmp4 (u->_mp_d, GMP_ABS (u->_mp_size),
+                  v->_mp_d, GMP_ABS (v->_mp_size));
+}
+
+void
+mpz_abs (mpz_t r, const mpz_t u)
+{
+  mpz_set (r, u);
+  r->_mp_size = GMP_ABS (r->_mp_size);
+}
+
+void
+mpz_neg (mpz_t r, const mpz_t u)
+{
+  mpz_set (r, u);
+  r->_mp_size = -r->_mp_size;
+}
+
+void
+mpz_swap (mpz_t u, mpz_t v)
+{
+  MP_SIZE_T_SWAP (u->_mp_size, v->_mp_size);
+  MP_SIZE_T_SWAP (u->_mp_alloc, v->_mp_alloc);
+  MP_PTR_SWAP (u->_mp_d, v->_mp_d);
+}
+
+
+/* MPZ addition and subtraction */
+
+/* Adds to the absolute value. Returns new size, but doesn't store it. */
+static mp_size_t
+mpz_abs_add_ui (mpz_t r, const mpz_t a, unsigned long b)
+{
+  mp_size_t an;
+  mp_ptr rp;
+  mp_limb_t cy;
+
+  an = GMP_ABS (a->_mp_size);
+  if (an == 0)
+    {
+      MPZ_REALLOC (r, 1)[0] = b;
+      return b > 0;
+    }
+
+  rp = MPZ_REALLOC (r, an + 1);
+
+  cy = mpn_add_1 (rp, a->_mp_d, an, b);
+  rp[an] = cy;
+  an += cy;
+
+  return an;
+}
+
+/* Subtract from the absolute value. Returns new size, (or -1 on underflow),
+   but doesn't store it. */
+static mp_size_t
+mpz_abs_sub_ui (mpz_t r, const mpz_t a, unsigned long b)
+{
+  mp_size_t an = GMP_ABS (a->_mp_size);
+  mp_ptr rp;
+
+  if (an == 0)
+    {
+      MPZ_REALLOC (r, 1)[0] = b;
+      return -(b > 0);
+    }
+  rp = MPZ_REALLOC (r, an);
+  if (an == 1 && a->_mp_d[0] < b)
+    {
+      rp[0] = b - a->_mp_d[0];
+      return -1;
+    }
+  else
+    {
+      gmp_assert_nocarry (mpn_sub_1 (rp, a->_mp_d, an, b));
+      return mpn_normalized_size (rp, an);
+    }
+}
+
+void
+mpz_add_ui (mpz_t r, const mpz_t a, unsigned long b)
+{
+  if (a->_mp_size >= 0)
+    r->_mp_size = mpz_abs_add_ui (r, a, b);
+  else
+    r->_mp_size = -mpz_abs_sub_ui (r, a, b);
+}
+
+void
+mpz_sub_ui (mpz_t r, const mpz_t a, unsigned long b)
+{
+  if (a->_mp_size < 0)
+    r->_mp_size = -mpz_abs_add_ui (r, a, b);
+  else
+    r->_mp_size = mpz_abs_sub_ui (r, a, b);
+}
+
+void
+mpz_ui_sub (mpz_t r, unsigned long a, const mpz_t b)
+{
+  if (b->_mp_size < 0)
+    r->_mp_size = mpz_abs_add_ui (r, b, a);
+  else
+    r->_mp_size = -mpz_abs_sub_ui (r, b, a);
+}
+
+static mp_size_t
+mpz_abs_add (mpz_t r, const mpz_t a, const mpz_t b)
+{
+  mp_size_t an = GMP_ABS (a->_mp_size);
+  mp_size_t bn = GMP_ABS (b->_mp_size);
+  mp_ptr rp;
+  mp_limb_t cy;
+
+  if (an < bn)
+    {
+      MPZ_SRCPTR_SWAP (a, b);
+      MP_SIZE_T_SWAP (an, bn);
+    }
+
+  rp = MPZ_REALLOC (r, an + 1);
+  cy = mpn_add (rp, a->_mp_d, an, b->_mp_d, bn);
+
+  rp[an] = cy;
+
+  return an + cy;
+}
+
+static mp_size_t
+mpz_abs_sub (mpz_t r, const mpz_t a, const mpz_t b)
+{
+  mp_size_t an = GMP_ABS (a->_mp_size);
+  mp_size_t bn = GMP_ABS (b->_mp_size);
+  int cmp;
+  mp_ptr rp;
+
+  cmp = mpn_cmp4 (a->_mp_d, an, b->_mp_d, bn);
+  if (cmp > 0)
+    {
+      rp = MPZ_REALLOC (r, an);
+      gmp_assert_nocarry (mpn_sub (rp, a->_mp_d, an, b->_mp_d, bn));
+      return mpn_normalized_size (rp, an);
+    }
+  else if (cmp < 0)
+    {
+      rp = MPZ_REALLOC (r, bn);
+      gmp_assert_nocarry (mpn_sub (rp, b->_mp_d, bn, a->_mp_d, an));
+      return -mpn_normalized_size (rp, bn);
+    }
+  else
+    return 0;
+}
+
+void
+mpz_add (mpz_t r, const mpz_t a, const mpz_t b)
+{
+  mp_size_t rn;
+
+  if ( (a->_mp_size ^ b->_mp_size) >= 0)
+    rn = mpz_abs_add (r, a, b);
+  else
+    rn = mpz_abs_sub (r, a, b);
+
+  r->_mp_size = a->_mp_size >= 0 ? rn : - rn;
+}
+
+void
+mpz_sub (mpz_t r, const mpz_t a, const mpz_t b)
+{
+  mp_size_t rn;
+
+  if ( (a->_mp_size ^ b->_mp_size) >= 0)
+    rn = mpz_abs_sub (r, a, b);
+  else
+    rn = mpz_abs_add (r, a, b);
+
+  r->_mp_size = a->_mp_size >= 0 ? rn : - rn;
+}
+
+
+/* MPZ multiplication */
+void
+mpz_mul_si (mpz_t r, const mpz_t u, long int v)
+{
+  if (v < 0)
+    {
+      mpz_mul_ui (r, u, GMP_NEG_CAST (unsigned long int, v));
+      mpz_neg (r, r);
+    }
+  else
+    mpz_mul_ui (r, u, (unsigned long int) v);
+}
+
+void
+mpz_mul_ui (mpz_t r, const mpz_t u, unsigned long int v)
+{
+  mp_size_t un, us;
+  mp_ptr tp;
+  mp_limb_t cy;
+
+  us = u->_mp_size;
+
+  if (us == 0 || v == 0)
+    {
+      r->_mp_size = 0;
+      return;
+    }
+
+  un = GMP_ABS (us);
+
+  tp = MPZ_REALLOC (r, un + 1);
+  cy = mpn_mul_1 (tp, u->_mp_d, un, v);
+  tp[un] = cy;
+
+  un += (cy > 0);
+  r->_mp_size = (us < 0) ? - un : un;
+}
+
+void
+mpz_mul (mpz_t r, const mpz_t u, const mpz_t v)
+{
+  int sign;
+  mp_size_t un, vn, rn;
+  mpz_t t;
+  mp_ptr tp;
+
+  un = u->_mp_size;
+  vn = v->_mp_size;
+
+  if (un == 0 || vn == 0)
+    {
+      r->_mp_size = 0;
+      return;
+    }
+
+  sign = (un ^ vn) < 0;
+
+  un = GMP_ABS (un);
+  vn = GMP_ABS (vn);
+
+  mpz_init2 (t, (un + vn) * GMP_LIMB_BITS);
+
+  tp = t->_mp_d;
+  if (un >= vn)
+    mpn_mul (tp, u->_mp_d, un, v->_mp_d, vn);
+  else
+    mpn_mul (tp, v->_mp_d, vn, u->_mp_d, un);
+
+  rn = un + vn;
+  rn -= tp[rn-1] == 0;
+
+  t->_mp_size = sign ? - rn : rn;
+  mpz_swap (r, t);
+  mpz_clear (t);
+}
+
+void
+mpz_mul_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t bits)
+{
+  mp_size_t un, rn;
+  mp_size_t limbs;
+  unsigned shift;
+  mp_ptr rp;
+
+  un = GMP_ABS (u->_mp_size);
+  if (un == 0)
+    {
+      r->_mp_size = 0;
+      return;
+    }
+
+  limbs = bits / GMP_LIMB_BITS;
+  shift = bits % GMP_LIMB_BITS;
+
+  rn = un + limbs + (shift > 0);
+  rp = MPZ_REALLOC (r, rn);
+  if (shift > 0)
+    {
+      mp_limb_t cy = mpn_lshift (rp + limbs, u->_mp_d, un, shift);
+      rp[rn-1] = cy;
+      rn -= (cy == 0);
+    }
+  else
+    mpn_copyd (rp + limbs, u->_mp_d, un);
+
+  mpn_zero (rp, limbs);
+
+  r->_mp_size = (u->_mp_size < 0) ? - rn : rn;
+}
+
+void
+mpz_addmul_ui (mpz_t r, const mpz_t u, unsigned long int v)
+{
+  mpz_t t;
+  mpz_init (t);
+  mpz_mul_ui (t, u, v);
+  mpz_add (r, r, t);
+  mpz_clear (t);
+}
+
+void
+mpz_submul_ui (mpz_t r, const mpz_t u, unsigned long int v)
+{
+  mpz_t t;
+  mpz_init (t);
+  mpz_mul_ui (t, u, v);
+  mpz_sub (r, r, t);
+  mpz_clear (t);
+}
+
+void
+mpz_addmul (mpz_t r, const mpz_t u, const mpz_t v)
+{
+  mpz_t t;
+  mpz_init (t);
+  mpz_mul (t, u, v);
+  mpz_add (r, r, t);
+  mpz_clear (t);
+}
+
+void
+mpz_submul (mpz_t r, const mpz_t u, const mpz_t v)
+{
+  mpz_t t;
+  mpz_init (t);
+  mpz_mul (t, u, v);
+  mpz_sub (r, r, t);
+  mpz_clear (t);
+}
+
+
+/* MPZ division */
+enum mpz_div_round_mode { GMP_DIV_FLOOR, GMP_DIV_CEIL, GMP_DIV_TRUNC };
+
+/* Allows q or r to be zero. Returns 1 iff remainder is non-zero. */
+static int
+mpz_div_qr (mpz_t q, mpz_t r,
+           const mpz_t n, const mpz_t d, enum mpz_div_round_mode mode)
+{
+  mp_size_t ns, ds, nn, dn, qs;
+  ns = n->_mp_size;
+  ds = d->_mp_size;
+
+  if (ds == 0)
+    gmp_die("mpz_div_qr: Divide by zero.");
+
+  if (ns == 0)
+    {
+      if (q)
+       q->_mp_size = 0;
+      if (r)
+       r->_mp_size = 0;
+      return 0;
+    }
+
+  nn = GMP_ABS (ns);
+  dn = GMP_ABS (ds);
+
+  qs = ds ^ ns;
+
+  if (nn < dn)
+    {
+      if (mode == GMP_DIV_CEIL && qs >= 0)
+       {
+         /* q = 1, r = n - d */
+         if (r)
+           mpz_sub (r, n, d);
+         if (q)
+           mpz_set_ui (q, 1);
+       }
+      else if (mode == GMP_DIV_FLOOR && qs < 0)
+       {
+         /* q = -1, r = n + d */
+         if (r)
+           mpz_add (r, n, d);
+         if (q)
+           mpz_set_si (q, -1);
+       }
+      else
+       {
+         /* q = 0, r = d */
+         if (r)
+           mpz_set (r, n);
+         if (q)
+           q->_mp_size = 0;
+       }
+      return 1;
+    }
+  else
+    {
+      mp_ptr np, qp;
+      mp_size_t qn, rn;
+      mpz_t tq, tr;
+
+      mpz_init_set (tr, n);
+      np = tr->_mp_d;
+
+      qn = nn - dn + 1;
+
+      if (q)
+       {
+         mpz_init2 (tq, qn * GMP_LIMB_BITS);
+         qp = tq->_mp_d;
+       }
+      else
+       qp = NULL;
+
+      mpn_div_qr (qp, np, nn, d->_mp_d, dn);
+
+      if (qp)
+       {
+         qn -= (qp[qn-1] == 0);
+
+         tq->_mp_size = qs < 0 ? -qn : qn;
+       }
+      rn = mpn_normalized_size (np, dn);
+      tr->_mp_size = ns < 0 ? - rn : rn;
+
+      if (mode == GMP_DIV_FLOOR && qs < 0 && rn != 0)
+       {
+         if (q)
+           mpz_sub_ui (tq, tq, 1);
+         if (r)
+           mpz_add (tr, tr, d);
+       }
+      else if (mode == GMP_DIV_CEIL && qs >= 0 && rn != 0)
+       {
+         if (q)
+           mpz_add_ui (tq, tq, 1);
+         if (r)
+           mpz_sub (tr, tr, d);
+       }
+
+      if (q)
+       {
+         mpz_swap (tq, q);
+         mpz_clear (tq);
+       }
+      if (r)
+       mpz_swap (tr, r);
+
+      mpz_clear (tr);
+
+      return rn != 0;
+    }
+}
+
+void
+mpz_cdiv_qr (mpz_t q, mpz_t r, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (q, r, n, d, GMP_DIV_CEIL);
+}
+
+void
+mpz_fdiv_qr (mpz_t q, mpz_t r, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (q, r, n, d, GMP_DIV_FLOOR);
+}
+
+void
+mpz_tdiv_qr (mpz_t q, mpz_t r, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (q, r, n, d, GMP_DIV_TRUNC);
+}
+
+void
+mpz_cdiv_q (mpz_t q, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (q, NULL, n, d, GMP_DIV_CEIL);
+}
+
+void
+mpz_fdiv_q (mpz_t q, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (q, NULL, n, d, GMP_DIV_FLOOR);
+}
+
+void
+mpz_tdiv_q (mpz_t q, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (q, NULL, n, d, GMP_DIV_TRUNC);
+}
+
+void
+mpz_cdiv_r (mpz_t r, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (NULL, r, n, d, GMP_DIV_CEIL);
+}
+
+void
+mpz_fdiv_r (mpz_t r, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (NULL, r, n, d, GMP_DIV_FLOOR);
+}
+
+void
+mpz_tdiv_r (mpz_t r, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (NULL, r, n, d, GMP_DIV_TRUNC);
+}
+
+void
+mpz_mod (mpz_t r, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (NULL, r, n, d, d->_mp_size >= 0 ? GMP_DIV_FLOOR : GMP_DIV_CEIL);
+}
+
+static void
+mpz_div_q_2exp (mpz_t q, const mpz_t u, mp_bitcnt_t bit_index,
+               enum mpz_div_round_mode mode)
+{
+  mp_size_t un, qn;
+  mp_size_t limb_cnt;
+  mp_ptr qp;
+  int adjust;
+
+  un = u->_mp_size;
+  if (un == 0)
+    {
+      q->_mp_size = 0;
+      return;
+    }
+  limb_cnt = bit_index / GMP_LIMB_BITS;
+  qn = GMP_ABS (un) - limb_cnt;
+  bit_index %= GMP_LIMB_BITS;
+
+  if (mode == ((un > 0) ? GMP_DIV_CEIL : GMP_DIV_FLOOR)) /* un != 0 here. */
+    /* Note: Below, the final indexing at limb_cnt is valid because at
+       that point we have qn > 0. */
+    adjust = (qn <= 0
+             || !mpn_zero_p (u->_mp_d, limb_cnt)
+             || (u->_mp_d[limb_cnt]
+                 & (((mp_limb_t) 1 << bit_index) - 1)));
+  else
+    adjust = 0;
+
+  if (qn <= 0)
+    qn = 0;
+  else
+    {
+      qp = MPZ_REALLOC (q, qn);
+
+      if (bit_index != 0)
+       {
+         mpn_rshift (qp, u->_mp_d + limb_cnt, qn, bit_index);
+         qn -= qp[qn - 1] == 0;
+       }
+      else
+       {
+         mpn_copyi (qp, u->_mp_d + limb_cnt, qn);
+       }
+    }
+
+  q->_mp_size = qn;
+
+  if (adjust)
+    mpz_add_ui (q, q, 1);
+  if (un < 0)
+    mpz_neg (q, q);
+}
+
+static void
+mpz_div_r_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t bit_index,
+               enum mpz_div_round_mode mode)
+{
+  mp_size_t us, un, rn;
+  mp_ptr rp;
+  mp_limb_t mask;
+
+  us = u->_mp_size;
+  if (us == 0 || bit_index == 0)
+    {
+      r->_mp_size = 0;
+      return;
+    }
+  rn = (bit_index + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS;
+  assert (rn > 0);
+
+  rp = MPZ_REALLOC (r, rn);
+  un = GMP_ABS (us);
+
+  mask = GMP_LIMB_MAX >> (rn * GMP_LIMB_BITS - bit_index);
+
+  if (rn > un)
+    {
+      /* Quotient (with truncation) is zero, and remainder is
+        non-zero */
+      if (mode == ((us > 0) ? GMP_DIV_CEIL : GMP_DIV_FLOOR)) /* us != 0 here. 
*/
+       {
+         /* Have to negate and sign extend. */
+         mp_size_t i;
+
+         gmp_assert_nocarry (! mpn_neg (rp, u->_mp_d, un));
+         for (i = un; i < rn - 1; i++)
+           rp[i] = GMP_LIMB_MAX;
+
+         rp[rn-1] = mask;
+         us = -us;
+       }
+      else
+       {
+         /* Just copy */
+         if (r != u)
+           mpn_copyi (rp, u->_mp_d, un);
+
+         rn = un;
+       }
+    }
+  else
+    {
+      if (r != u)
+       mpn_copyi (rp, u->_mp_d, rn - 1);
+
+      rp[rn-1] = u->_mp_d[rn-1] & mask;
+
+      if (mode == ((us > 0) ? GMP_DIV_CEIL : GMP_DIV_FLOOR)) /* us != 0 here. 
*/
+       {
+         /* If r != 0, compute 2^{bit_count} - r. */
+         mpn_neg (rp, rp, rn);
+
+         rp[rn-1] &= mask;
+
+         /* us is not used for anything else, so we can modify it
+            here to indicate flipped sign. */
+         us = -us;
+       }
+    }
+  rn = mpn_normalized_size (rp, rn);
+  r->_mp_size = us < 0 ? -rn : rn;
+}
+
+void
+mpz_cdiv_q_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
+{
+  mpz_div_q_2exp (r, u, cnt, GMP_DIV_CEIL);
+}
+
+void
+mpz_fdiv_q_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
+{
+  mpz_div_q_2exp (r, u, cnt, GMP_DIV_FLOOR);
+}
+
+void
+mpz_tdiv_q_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
+{
+  mpz_div_q_2exp (r, u, cnt, GMP_DIV_TRUNC);
+}
+
+void
+mpz_cdiv_r_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
+{
+  mpz_div_r_2exp (r, u, cnt, GMP_DIV_CEIL);
+}
+
+void
+mpz_fdiv_r_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
+{
+  mpz_div_r_2exp (r, u, cnt, GMP_DIV_FLOOR);
+}
+
+void
+mpz_tdiv_r_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
+{
+  mpz_div_r_2exp (r, u, cnt, GMP_DIV_TRUNC);
+}
+
+void
+mpz_divexact (mpz_t q, const mpz_t n, const mpz_t d)
+{
+  gmp_assert_nocarry (mpz_div_qr (q, NULL, n, d, GMP_DIV_TRUNC));
+}
+
+int
+mpz_divisible_p (const mpz_t n, const mpz_t d)
+{
+  return mpz_div_qr (NULL, NULL, n, d, GMP_DIV_TRUNC) == 0;
+}
+
+int
+mpz_congruent_p (const mpz_t a, const mpz_t b, const mpz_t m)
+{
+  mpz_t t;
+  int res;
+
+  /* a == b (mod 0) iff a == b */
+  if (mpz_sgn (m) == 0)
+    return (mpz_cmp (a, b) == 0);
+
+  mpz_init (t);
+  mpz_sub (t, a, b);
+  res = mpz_divisible_p (t, m);
+  mpz_clear (t);
+
+  return res;
+}
+
+static unsigned long
+mpz_div_qr_ui (mpz_t q, mpz_t r,
+              const mpz_t n, unsigned long d, enum mpz_div_round_mode mode)
+{
+  mp_size_t ns, qn;
+  mp_ptr qp;
+  mp_limb_t rl;
+  mp_size_t rs;
+
+  ns = n->_mp_size;
+  if (ns == 0)
+    {
+      if (q)
+       q->_mp_size = 0;
+      if (r)
+       r->_mp_size = 0;
+      return 0;
+    }
+
+  qn = GMP_ABS (ns);
+  if (q)
+    qp = MPZ_REALLOC (q, qn);
+  else
+    qp = NULL;
+
+  rl = mpn_div_qr_1 (qp, n->_mp_d, qn, d);
+  assert (rl < d);
+
+  rs = rl > 0;
+  rs = (ns < 0) ? -rs : rs;
+
+  if (rl > 0 && ( (mode == GMP_DIV_FLOOR && ns < 0)
+                 || (mode == GMP_DIV_CEIL && ns >= 0)))
+    {
+      if (q)
+       gmp_assert_nocarry (mpn_add_1 (qp, qp, qn, 1));
+      rl = d - rl;
+      rs = -rs;
+    }
+
+  if (r)
+    {
+      MPZ_REALLOC (r, 1)[0] = rl;
+      r->_mp_size = rs;
+    }
+  if (q)
+    {
+      qn -= (qp[qn-1] == 0);
+      assert (qn == 0 || qp[qn-1] > 0);
+
+      q->_mp_size = (ns < 0) ? - qn : qn;
+    }
+
+  return rl;
+}
+
+unsigned long
+mpz_cdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (q, r, n, d, GMP_DIV_CEIL);
+}
+
+unsigned long
+mpz_fdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (q, r, n, d, GMP_DIV_FLOOR);
+}
+
+unsigned long
+mpz_tdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (q, r, n, d, GMP_DIV_TRUNC);
+}
+
+unsigned long
+mpz_cdiv_q_ui (mpz_t q, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (q, NULL, n, d, GMP_DIV_CEIL);
+}
+
+unsigned long
+mpz_fdiv_q_ui (mpz_t q, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (q, NULL, n, d, GMP_DIV_FLOOR);
+}
+
+unsigned long
+mpz_tdiv_q_ui (mpz_t q, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (q, NULL, n, d, GMP_DIV_TRUNC);
+}
+
+unsigned long
+mpz_cdiv_r_ui (mpz_t r, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (NULL, r, n, d, GMP_DIV_CEIL);
+}
+unsigned long
+mpz_fdiv_r_ui (mpz_t r, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (NULL, r, n, d, GMP_DIV_FLOOR);
+}
+unsigned long
+mpz_tdiv_r_ui (mpz_t r, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (NULL, r, n, d, GMP_DIV_TRUNC);
+}
+
+unsigned long
+mpz_cdiv_ui (const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (NULL, NULL, n, d, GMP_DIV_CEIL);
+}
+
+unsigned long
+mpz_fdiv_ui (const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (NULL, NULL, n, d, GMP_DIV_FLOOR);
+}
+
+unsigned long
+mpz_tdiv_ui (const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (NULL, NULL, n, d, GMP_DIV_TRUNC);
+}
+
+unsigned long
+mpz_mod_ui (mpz_t r, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (NULL, r, n, d, GMP_DIV_FLOOR);
+}
+
+void
+mpz_divexact_ui (mpz_t q, const mpz_t n, unsigned long d)
+{
+  gmp_assert_nocarry (mpz_div_qr_ui (q, NULL, n, d, GMP_DIV_TRUNC));
+}
+
+int
+mpz_divisible_ui_p (const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (NULL, NULL, n, d, GMP_DIV_TRUNC) == 0;
+}
+
+
+/* GCD */
+static mp_limb_t
+mpn_gcd_11 (mp_limb_t u, mp_limb_t v)
+{
+  unsigned shift;
+
+  assert ( (u | v) > 0);
+
+  if (u == 0)
+    return v;
+  else if (v == 0)
+    return u;
+
+  gmp_ctz (shift, u | v);
+
+  u >>= shift;
+  v >>= shift;
+
+  if ( (u & 1) == 0)
+    MP_LIMB_T_SWAP (u, v);
+
+  while ( (v & 1) == 0)
+    v >>= 1;
+
+  while (u != v)
+    {
+      if (u > v)
+       {
+         u -= v;
+         do
+           u >>= 1;
+         while ( (u & 1) == 0);
+       }
+      else
+       {
+         v -= u;
+         do
+           v >>= 1;
+         while ( (v & 1) == 0);
+       }
+    }
+  return u << shift;
+}
+
+unsigned long
+mpz_gcd_ui (mpz_t g, const mpz_t u, unsigned long v)
+{
+  mp_size_t un;
+
+  if (v == 0)
+    {
+      if (g)
+       mpz_abs (g, u);
+    }
+  else
+    {
+      un = GMP_ABS (u->_mp_size);
+      if (un != 0)
+       v = mpn_gcd_11 (mpn_div_qr_1 (NULL, u->_mp_d, un, v), v);
+
+      if (g)
+       mpz_set_ui (g, v);
+    }
+
+  return v;
+}
+
+static mp_bitcnt_t
+mpz_make_odd (mpz_t r)
+{
+  mp_bitcnt_t shift;
+
+  assert (r->_mp_size > 0);
+  /* Count trailing zeros, equivalent to mpn_scan1, because we know that there 
is a 1 */
+  shift = mpn_common_scan (r->_mp_d[0], 0, r->_mp_d, 0, 0);
+  mpz_tdiv_q_2exp (r, r, shift);
+
+  return shift;
+}
+
+void
+mpz_gcd (mpz_t g, const mpz_t u, const mpz_t v)
+{
+  mpz_t tu, tv;
+  mp_bitcnt_t uz, vz, gz;
+
+  if (u->_mp_size == 0)
+    {
+      mpz_abs (g, v);
+      return;
+    }
+  if (v->_mp_size == 0)
+    {
+      mpz_abs (g, u);
+      return;
+    }
+
+  mpz_init (tu);
+  mpz_init (tv);
+
+  mpz_abs (tu, u);
+  uz = mpz_make_odd (tu);
+  mpz_abs (tv, v);
+  vz = mpz_make_odd (tv);
+  gz = GMP_MIN (uz, vz);
+
+  if (tu->_mp_size < tv->_mp_size)
+    mpz_swap (tu, tv);
+
+  mpz_tdiv_r (tu, tu, tv);
+  if (tu->_mp_size == 0)
+    {
+      mpz_swap (g, tv);
+    }
+  else
+    for (;;)
+      {
+       int c;
+
+       mpz_make_odd (tu);
+       c = mpz_cmp (tu, tv);
+       if (c == 0)
+         {
+           mpz_swap (g, tu);
+           break;
+         }
+       if (c < 0)
+         mpz_swap (tu, tv);
+
+       if (tv->_mp_size == 1)
+         {
+           mp_limb_t vl = tv->_mp_d[0];
+           mp_limb_t ul = mpz_tdiv_ui (tu, vl);
+           mpz_set_ui (g, mpn_gcd_11 (ul, vl));
+           break;
+         }
+       mpz_sub (tu, tu, tv);
+      }
+  mpz_clear (tu);
+  mpz_clear (tv);
+  mpz_mul_2exp (g, g, gz);
+}
+
+void
+mpz_gcdext (mpz_t g, mpz_t s, mpz_t t, const mpz_t u, const mpz_t v)
+{
+  mpz_t tu, tv, s0, s1, t0, t1;
+  mp_bitcnt_t uz, vz, gz;
+  mp_bitcnt_t power;
+
+  if (u->_mp_size == 0)
+    {
+      /* g = 0 u + sgn(v) v */
+      signed long sign = mpz_sgn (v);
+      mpz_abs (g, v);
+      if (s)
+       mpz_set_ui (s, 0);
+      if (t)
+       mpz_set_si (t, sign);
+      return;
+    }
+
+  if (v->_mp_size == 0)
+    {
+      /* g = sgn(u) u + 0 v */
+      signed long sign = mpz_sgn (u);
+      mpz_abs (g, u);
+      if (s)
+       mpz_set_si (s, sign);
+      if (t)
+       mpz_set_ui (t, 0);
+      return;
+    }
+
+  mpz_init (tu);
+  mpz_init (tv);
+  mpz_init (s0);
+  mpz_init (s1);
+  mpz_init (t0);
+  mpz_init (t1);
+
+  mpz_abs (tu, u);
+  uz = mpz_make_odd (tu);
+  mpz_abs (tv, v);
+  vz = mpz_make_odd (tv);
+  gz = GMP_MIN (uz, vz);
+
+  uz -= gz;
+  vz -= gz;
+
+  /* Cofactors corresponding to odd gcd. gz handled later. */
+  if (tu->_mp_size < tv->_mp_size)
+    {
+      mpz_swap (tu, tv);
+      MPZ_SRCPTR_SWAP (u, v);
+      MPZ_PTR_SWAP (s, t);
+      MP_BITCNT_T_SWAP (uz, vz);
+    }
+
+  /* Maintain
+   *
+   * u = t0 tu + t1 tv
+   * v = s0 tu + s1 tv
+   *
+   * where u and v denote the inputs with common factors of two
+   * eliminated, and det (s0, t0; s1, t1) = 2^p. Then
+   *
+   * 2^p tu =  s1 u - t1 v
+   * 2^p tv = -s0 u + t0 v
+   */
+
+  /* After initial division, tu = q tv + tu', we have
+   *
+   * u = 2^uz (tu' + q tv)
+   * v = 2^vz tv
+   *
+   * or
+   *
+   * t0 = 2^uz, t1 = 2^uz q
+   * s0 = 0,    s1 = 2^vz
+   */
+
+  mpz_setbit (t0, uz);
+  mpz_tdiv_qr (t1, tu, tu, tv);
+  mpz_mul_2exp (t1, t1, uz);
+
+  mpz_setbit (s1, vz);
+  power = uz + vz;
+
+  if (tu->_mp_size > 0)
+    {
+      mp_bitcnt_t shift;
+      shift = mpz_make_odd (tu);
+      mpz_mul_2exp (t0, t0, shift);
+      mpz_mul_2exp (s0, s0, shift);
+      power += shift;
+
+      for (;;)
+       {
+         int c;
+         c = mpz_cmp (tu, tv);
+         if (c == 0)
+           break;
+
+         if (c < 0)
+           {
+             /* tv = tv' + tu
+              *
+              * u = t0 tu + t1 (tv' + tu) = (t0 + t1) tu + t1 tv'
+              * v = s0 tu + s1 (tv' + tu) = (s0 + s1) tu + s1 tv' */
+
+             mpz_sub (tv, tv, tu);
+             mpz_add (t0, t0, t1);
+             mpz_add (s0, s0, s1);
+
+             shift = mpz_make_odd (tv);
+             mpz_mul_2exp (t1, t1, shift);
+             mpz_mul_2exp (s1, s1, shift);
+           }
+         else
+           {
+             mpz_sub (tu, tu, tv);
+             mpz_add (t1, t0, t1);
+             mpz_add (s1, s0, s1);
+
+             shift = mpz_make_odd (tu);
+             mpz_mul_2exp (t0, t0, shift);
+             mpz_mul_2exp (s0, s0, shift);
+           }
+         power += shift;
+       }
+    }
+
+  /* Now tv = odd part of gcd, and -s0 and t0 are corresponding
+     cofactors. */
+
+  mpz_mul_2exp (tv, tv, gz);
+  mpz_neg (s0, s0);
+
+  /* 2^p g = s0 u + t0 v. Eliminate one factor of two at a time. To
+     adjust cofactors, we need u / g and v / g */
+
+  mpz_divexact (s1, v, tv);
+  mpz_abs (s1, s1);
+  mpz_divexact (t1, u, tv);
+  mpz_abs (t1, t1);
+
+  while (power-- > 0)
+    {
+      /* s0 u + t0 v = (s0 - v/g) u - (t0 + u/g) v */
+      if (mpz_odd_p (s0) || mpz_odd_p (t0))
+       {
+         mpz_sub (s0, s0, s1);
+         mpz_add (t0, t0, t1);
+       }
+      mpz_divexact_ui (s0, s0, 2);
+      mpz_divexact_ui (t0, t0, 2);
+    }
+
+  /* Arrange so that |s| < |u| / 2g */
+  mpz_add (s1, s0, s1);
+  if (mpz_cmpabs (s0, s1) > 0)
+    {
+      mpz_swap (s0, s1);
+      mpz_sub (t0, t0, t1);
+    }
+  if (u->_mp_size < 0)
+    mpz_neg (s0, s0);
+  if (v->_mp_size < 0)
+    mpz_neg (t0, t0);
+
+  mpz_swap (g, tv);
+  if (s)
+    mpz_swap (s, s0);
+  if (t)
+    mpz_swap (t, t0);
+
+  mpz_clear (tu);
+  mpz_clear (tv);
+  mpz_clear (s0);
+  mpz_clear (s1);
+  mpz_clear (t0);
+  mpz_clear (t1);
+}
+
+void
+mpz_lcm (mpz_t r, const mpz_t u, const mpz_t v)
+{
+  mpz_t g;
+
+  if (u->_mp_size == 0 || v->_mp_size == 0)
+    {
+      r->_mp_size = 0;
+      return;
+    }
+
+  mpz_init (g);
+
+  mpz_gcd (g, u, v);
+  mpz_divexact (g, u, g);
+  mpz_mul (r, g, v);
+
+  mpz_clear (g);
+  mpz_abs (r, r);
+}
+
+void
+mpz_lcm_ui (mpz_t r, const mpz_t u, unsigned long v)
+{
+  if (v == 0 || u->_mp_size == 0)
+    {
+      r->_mp_size = 0;
+      return;
+    }
+
+  v /= mpz_gcd_ui (NULL, u, v);
+  mpz_mul_ui (r, u, v);
+
+  mpz_abs (r, r);
+}
+
+int
+mpz_invert (mpz_t r, const mpz_t u, const mpz_t m)
+{
+  mpz_t g, tr;
+  int invertible;
+
+  if (u->_mp_size == 0 || mpz_cmpabs_ui (m, 1) <= 0)
+    return 0;
+
+  mpz_init (g);
+  mpz_init (tr);
+
+  mpz_gcdext (g, tr, NULL, u, m);
+  invertible = (mpz_cmp_ui (g, 1) == 0);
+
+  if (invertible)
+    {
+      if (tr->_mp_size < 0)
+       {
+         if (m->_mp_size >= 0)
+           mpz_add (tr, tr, m);
+         else
+           mpz_sub (tr, tr, m);
+       }
+      mpz_swap (r, tr);
+    }
+
+  mpz_clear (g);
+  mpz_clear (tr);
+  return invertible;
+}
+
+
+/* Higher level operations (sqrt, pow and root) */
+
+void
+mpz_pow_ui (mpz_t r, const mpz_t b, unsigned long e)
+{
+  unsigned long bit;
+  mpz_t tr;
+  mpz_init_set_ui (tr, 1);
+
+  bit = GMP_ULONG_HIGHBIT;
+  do
+    {
+      mpz_mul (tr, tr, tr);
+      if (e & bit)
+       mpz_mul (tr, tr, b);
+      bit >>= 1;
+    }
+  while (bit > 0);
+
+  mpz_swap (r, tr);
+  mpz_clear (tr);
+}
+
+void
+mpz_ui_pow_ui (mpz_t r, unsigned long blimb, unsigned long e)
+{
+  mpz_t b;
+  mpz_pow_ui (r, mpz_roinit_normal_n (b, &blimb, blimb != 0), e);
+}
+
+void
+mpz_powm (mpz_t r, const mpz_t b, const mpz_t e, const mpz_t m)
+{
+  mpz_t tr;
+  mpz_t base;
+  mp_size_t en, mn;
+  mp_srcptr mp;
+  struct gmp_div_inverse minv;
+  unsigned shift;
+  mp_ptr tp = NULL;
+
+  en = GMP_ABS (e->_mp_size);
+  mn = GMP_ABS (m->_mp_size);
+  if (mn == 0)
+    gmp_die ("mpz_powm: Zero modulo.");
+
+  if (en == 0)
+    {
+      mpz_set_ui (r, 1);
+      return;
+    }
+
+  mp = m->_mp_d;
+  mpn_div_qr_invert (&minv, mp, mn);
+  shift = minv.shift;
+
+  if (shift > 0)
+    {
+      /* To avoid shifts, we do all our reductions, except the final
+        one, using a *normalized* m. */
+      minv.shift = 0;
+
+      tp = gmp_xalloc_limbs (mn);
+      gmp_assert_nocarry (mpn_lshift (tp, mp, mn, shift));
+      mp = tp;
+    }
+
+  mpz_init (base);
+
+  if (e->_mp_size < 0)
+    {
+      if (!mpz_invert (base, b, m))
+       gmp_die ("mpz_powm: Negative exponent and non-invertible base.");
+    }
+  else
+    {
+      mp_size_t bn;
+      mpz_abs (base, b);
+
+      bn = base->_mp_size;
+      if (bn >= mn)
+       {
+         mpn_div_qr_preinv (NULL, base->_mp_d, base->_mp_size, mp, mn, &minv);
+         bn = mn;
+       }
+
+      /* We have reduced the absolute value. Now take care of the
+        sign. Note that we get zero represented non-canonically as
+        m. */
+      if (b->_mp_size < 0)
+       {
+         mp_ptr bp = MPZ_REALLOC (base, mn);
+         gmp_assert_nocarry (mpn_sub (bp, mp, mn, bp, bn));
+         bn = mn;
+       }
+      base->_mp_size = mpn_normalized_size (base->_mp_d, bn);
+    }
+  mpz_init_set_ui (tr, 1);
+
+  while (--en >= 0)
+    {
+      mp_limb_t w = e->_mp_d[en];
+      mp_limb_t bit;
+
+      bit = GMP_LIMB_HIGHBIT;
+      do
+       {
+         mpz_mul (tr, tr, tr);
+         if (w & bit)
+           mpz_mul (tr, tr, base);
+         if (tr->_mp_size > mn)
+           {
+             mpn_div_qr_preinv (NULL, tr->_mp_d, tr->_mp_size, mp, mn, &minv);
+             tr->_mp_size = mpn_normalized_size (tr->_mp_d, mn);
+           }
+         bit >>= 1;
+       }
+      while (bit > 0);
+    }
+
+  /* Final reduction */
+  if (tr->_mp_size >= mn)
+    {
+      minv.shift = shift;
+      mpn_div_qr_preinv (NULL, tr->_mp_d, tr->_mp_size, mp, mn, &minv);
+      tr->_mp_size = mpn_normalized_size (tr->_mp_d, mn);
+    }
+  if (tp)
+    gmp_free (tp);
+
+  mpz_swap (r, tr);
+  mpz_clear (tr);
+  mpz_clear (base);
+}
+
+void
+mpz_powm_ui (mpz_t r, const mpz_t b, unsigned long elimb, const mpz_t m)
+{
+  mpz_t e;
+  mpz_powm (r, b, mpz_roinit_normal_n (e, &elimb, elimb != 0), m);
+}
+
+/* x=trunc(y^(1/z)), r=y-x^z */
+void
+mpz_rootrem (mpz_t x, mpz_t r, const mpz_t y, unsigned long z)
+{
+  int sgn;
+  mpz_t t, u;
+
+  sgn = y->_mp_size < 0;
+  if ((~z & sgn) != 0)
+    gmp_die ("mpz_rootrem: Negative argument, with even root.");
+  if (z == 0)
+    gmp_die ("mpz_rootrem: Zeroth root.");
+
+  if (mpz_cmpabs_ui (y, 1) <= 0) {
+    if (x)
+      mpz_set (x, y);
+    if (r)
+      r->_mp_size = 0;
+    return;
+  }
+
+  mpz_init (u);
+  mpz_init (t);
+  mpz_setbit (t, mpz_sizeinbase (y, 2) / z + 1);
+
+  if (z == 2) /* simplify sqrt loop: z-1 == 1 */
+    do {
+      mpz_swap (u, t);                 /* u = x */
+      mpz_tdiv_q (t, y, u);            /* t = y/x */
+      mpz_add (t, t, u);               /* t = y/x + x */
+      mpz_tdiv_q_2exp (t, t, 1);       /* x'= (y/x + x)/2 */
+    } while (mpz_cmpabs (t, u) < 0);   /* |x'| < |x| */
+  else /* z != 2 */ {
+    mpz_t v;
+
+    mpz_init (v);
+    if (sgn)
+      mpz_neg (t, t);
+
+    do {
+      mpz_swap (u, t);                 /* u = x */
+      mpz_pow_ui (t, u, z - 1);                /* t = x^(z-1) */
+      mpz_tdiv_q (t, y, t);            /* t = y/x^(z-1) */
+      mpz_mul_ui (v, u, z - 1);                /* v = x*(z-1) */
+      mpz_add (t, t, v);               /* t = y/x^(z-1) + x*(z-1) */
+      mpz_tdiv_q_ui (t, t, z);         /* x'=(y/x^(z-1) + x*(z-1))/z */
+    } while (mpz_cmpabs (t, u) < 0);   /* |x'| < |x| */
+
+    mpz_clear (v);
+  }
+
+  if (r) {
+    mpz_pow_ui (t, u, z);
+    mpz_sub (r, y, t);
+  }
+  if (x)
+    mpz_swap (x, u);
+  mpz_clear (u);
+  mpz_clear (t);
+}
+
+int
+mpz_root (mpz_t x, const mpz_t y, unsigned long z)
+{
+  int res;
+  mpz_t r;
+
+  mpz_init (r);
+  mpz_rootrem (x, r, y, z);
+  res = r->_mp_size == 0;
+  mpz_clear (r);
+
+  return res;
+}
+
+/* Compute s = floor(sqrt(u)) and r = u - s^2. Allows r == NULL */
+void
+mpz_sqrtrem (mpz_t s, mpz_t r, const mpz_t u)
+{
+  mpz_rootrem (s, r, u, 2);
+}
+
+void
+mpz_sqrt (mpz_t s, const mpz_t u)
+{
+  mpz_rootrem (s, NULL, u, 2);
+}
+
+int
+mpz_perfect_square_p (const mpz_t u)
+{
+  if (u->_mp_size <= 0)
+    return (u->_mp_size == 0);
+  else
+    return mpz_root (NULL, u, 2);
+}
+
+int
+mpn_perfect_square_p (mp_srcptr p, mp_size_t n)
+{
+  mpz_t t;
+
+  assert (n > 0);
+  assert (p [n-1] != 0);
+  return mpz_root (NULL, mpz_roinit_normal_n (t, p, n), 2);
+}
+
+mp_size_t
+mpn_sqrtrem (mp_ptr sp, mp_ptr rp, mp_srcptr p, mp_size_t n)
+{
+  mpz_t s, r, u;
+  mp_size_t res;
+
+  assert (n > 0);
+  assert (p [n-1] != 0);
+
+  mpz_init (r);
+  mpz_init (s);
+  mpz_rootrem (s, r, mpz_roinit_normal_n (u, p, n), 2);
+
+  assert (s->_mp_size == (n+1)/2);
+  mpn_copyd (sp, s->_mp_d, s->_mp_size);
+  mpz_clear (s);
+  res = r->_mp_size;
+  if (rp)
+    mpn_copyd (rp, r->_mp_d, res);
+  mpz_clear (r);
+  return res;
+}
+
+/* Combinatorics */
+
+void
+mpz_mfac_uiui (mpz_t x, unsigned long n, unsigned long m)
+{
+  mpz_set_ui (x, n + (n == 0));
+  if (m + 1 < 2) return;
+  while (n > m + 1)
+    mpz_mul_ui (x, x, n -= m);
+}
+
+void
+mpz_2fac_ui (mpz_t x, unsigned long n)
+{
+  mpz_mfac_uiui (x, n, 2);
+}
+
+void
+mpz_fac_ui (mpz_t x, unsigned long n)
+{
+  mpz_mfac_uiui (x, n, 1);
+}
+
+void
+mpz_bin_uiui (mpz_t r, unsigned long n, unsigned long k)
+{
+  mpz_t t;
+
+  mpz_set_ui (r, k <= n);
+
+  if (k > (n >> 1))
+    k = (k <= n) ? n - k : 0;
+
+  mpz_init (t);
+  mpz_fac_ui (t, k);
+
+  for (; k > 0; --k)
+      mpz_mul_ui (r, r, n--);
+
+  mpz_divexact (r, r, t);
+  mpz_clear (t);
+}
+
+
+/* Primality testing */
+static int
+gmp_millerrabin (const mpz_t n, const mpz_t nm1, mpz_t y,
+                const mpz_t q, mp_bitcnt_t k)
+{
+  assert (k > 0);
+
+  /* Caller must initialize y to the base. */
+  mpz_powm (y, y, q, n);
+
+  if (mpz_cmp_ui (y, 1) == 0 || mpz_cmp (y, nm1) == 0)
+    return 1;
+
+  while (--k > 0)
+    {
+      mpz_powm_ui (y, y, 2, n);
+      if (mpz_cmp (y, nm1) == 0)
+       return 1;
+      /* y == 1 means that the previous y was a non-trivial square root
+        of 1 (mod n). y == 0 means that n is a power of the base.
+        In either case, n is not prime. */
+      if (mpz_cmp_ui (y, 1) <= 0)
+       return 0;
+    }
+  return 0;
+}
+
+/* This product is 0xc0cfd797, and fits in 32 bits. */
+#define GMP_PRIME_PRODUCT \
+  (3UL*5UL*7UL*11UL*13UL*17UL*19UL*23UL*29UL)
+
+/* Bit (p+1)/2 is set, for each odd prime <= 61 */
+#define GMP_PRIME_MASK 0xc96996dcUL
+
+int
+mpz_probab_prime_p (const mpz_t n, int reps)
+{
+  mpz_t nm1;
+  mpz_t q;
+  mpz_t y;
+  mp_bitcnt_t k;
+  int is_prime;
+  int j;
+
+  /* Note that we use the absolute value of n only, for compatibility
+     with the real GMP. */
+  if (mpz_even_p (n))
+    return (mpz_cmpabs_ui (n, 2) == 0) ? 2 : 0;
+
+  /* Above test excludes n == 0 */
+  assert (n->_mp_size != 0);
+
+  if (mpz_cmpabs_ui (n, 64) < 0)
+    return (GMP_PRIME_MASK >> (n->_mp_d[0] >> 1)) & 2;
+
+  if (mpz_gcd_ui (NULL, n, GMP_PRIME_PRODUCT) != 1)
+    return 0;
+
+  /* All prime factors are >= 31. */
+  if (mpz_cmpabs_ui (n, 31*31) < 0)
+    return 2;
+
+  /* Use Miller-Rabin, with a deterministic sequence of bases, a[j] =
+     j^2 + j + 41 using Euler's polynomial. We potentially stop early,
+     if a[j] >= n - 1. Since n >= 31*31, this can happen only if reps >
+     30 (a[30] == 971 > 31*31 == 961). */
+
+  mpz_init (nm1);
+  mpz_init (q);
+  mpz_init (y);
+
+  /* Find q and k, where q is odd and n = 1 + 2**k * q.  */
+  nm1->_mp_size = mpz_abs_sub_ui (nm1, n, 1);
+  k = mpz_scan1 (nm1, 0);
+  mpz_tdiv_q_2exp (q, nm1, k);
+
+  for (j = 0, is_prime = 1; is_prime & (j < reps); j++)
+    {
+      mpz_set_ui (y, (unsigned long) j*j+j+41);
+      if (mpz_cmp (y, nm1) >= 0)
+       {
+         /* Don't try any further bases. This "early" break does not affect
+            the result for any reasonable reps value (<=5000 was tested) */
+         assert (j >= 30);
+         break;
+       }
+      is_prime = gmp_millerrabin (n, nm1, y, q, k);
+    }
+  mpz_clear (nm1);
+  mpz_clear (q);
+  mpz_clear (y);
+
+  return is_prime;
+}
+
+
+/* Logical operations and bit manipulation. */
+
+/* Numbers are treated as if represented in two's complement (and
+   infinitely sign extended). For a negative values we get the two's
+   complement from -x = ~x + 1, where ~ is bitwise complement.
+   Negation transforms
+
+     xxxx10...0
+
+   into
+
+     yyyy10...0
+
+   where yyyy is the bitwise complement of xxxx. So least significant
+   bits, up to and including the first one bit, are unchanged, and
+   the more significant bits are all complemented.
+
+   To change a bit from zero to one in a negative number, subtract the
+   corresponding power of two from the absolute value. This can never
+   underflow. To change a bit from one to zero, add the corresponding
+   power of two, and this might overflow. E.g., if x = -001111, the
+   two's complement is 110001. Clearing the least significant bit, we
+   get two's complement 110000, and -010000. */
+
+int
+mpz_tstbit (const mpz_t d, mp_bitcnt_t bit_index)
+{
+  mp_size_t limb_index;
+  unsigned shift;
+  mp_size_t ds;
+  mp_size_t dn;
+  mp_limb_t w;
+  int bit;
+
+  ds = d->_mp_size;
+  dn = GMP_ABS (ds);
+  limb_index = bit_index / GMP_LIMB_BITS;
+  if (limb_index >= dn)
+    return ds < 0;
+
+  shift = bit_index % GMP_LIMB_BITS;
+  w = d->_mp_d[limb_index];
+  bit = (w >> shift) & 1;
+
+  if (ds < 0)
+    {
+      /* d < 0. Check if any of the bits below is set: If so, our bit
+        must be complemented. */
+      if (shift > 0 && (w << (GMP_LIMB_BITS - shift)) > 0)
+       return bit ^ 1;
+      while (--limb_index >= 0)
+       if (d->_mp_d[limb_index] > 0)
+         return bit ^ 1;
+    }
+  return bit;
+}
+
+static void
+mpz_abs_add_bit (mpz_t d, mp_bitcnt_t bit_index)
+{
+  mp_size_t dn, limb_index;
+  mp_limb_t bit;
+  mp_ptr dp;
+
+  dn = GMP_ABS (d->_mp_size);
+
+  limb_index = bit_index / GMP_LIMB_BITS;
+  bit = (mp_limb_t) 1 << (bit_index % GMP_LIMB_BITS);
+
+  if (limb_index >= dn)
+    {
+      mp_size_t i;
+      /* The bit should be set outside of the end of the number.
+        We have to increase the size of the number. */
+      dp = MPZ_REALLOC (d, limb_index + 1);
+
+      dp[limb_index] = bit;
+      for (i = dn; i < limb_index; i++)
+       dp[i] = 0;
+      dn = limb_index + 1;
+    }
+  else
+    {
+      mp_limb_t cy;
+
+      dp = d->_mp_d;
+
+      cy = mpn_add_1 (dp + limb_index, dp + limb_index, dn - limb_index, bit);
+      if (cy > 0)
+       {
+         dp = MPZ_REALLOC (d, dn + 1);
+         dp[dn++] = cy;
+       }
+    }
+
+  d->_mp_size = (d->_mp_size < 0) ? - dn : dn;
+}
+
+static void
+mpz_abs_sub_bit (mpz_t d, mp_bitcnt_t bit_index)
+{
+  mp_size_t dn, limb_index;
+  mp_ptr dp;
+  mp_limb_t bit;
+
+  dn = GMP_ABS (d->_mp_size);
+  dp = d->_mp_d;
+
+  limb_index = bit_index / GMP_LIMB_BITS;
+  bit = (mp_limb_t) 1 << (bit_index % GMP_LIMB_BITS);
+
+  assert (limb_index < dn);
+
+  gmp_assert_nocarry (mpn_sub_1 (dp + limb_index, dp + limb_index,
+                                dn - limb_index, bit));
+  dn = mpn_normalized_size (dp, dn);
+  d->_mp_size = (d->_mp_size < 0) ? - dn : dn;
+}
+
+void
+mpz_setbit (mpz_t d, mp_bitcnt_t bit_index)
+{
+  if (!mpz_tstbit (d, bit_index))
+    {
+      if (d->_mp_size >= 0)
+       mpz_abs_add_bit (d, bit_index);
+      else
+       mpz_abs_sub_bit (d, bit_index);
+    }
+}
+
+void
+mpz_clrbit (mpz_t d, mp_bitcnt_t bit_index)
+{
+  if (mpz_tstbit (d, bit_index))
+    {
+      if (d->_mp_size >= 0)
+       mpz_abs_sub_bit (d, bit_index);
+      else
+       mpz_abs_add_bit (d, bit_index);
+    }
+}
+
+void
+mpz_combit (mpz_t d, mp_bitcnt_t bit_index)
+{
+  if (mpz_tstbit (d, bit_index) ^ (d->_mp_size < 0))
+    mpz_abs_sub_bit (d, bit_index);
+  else
+    mpz_abs_add_bit (d, bit_index);
+}
+
+void
+mpz_com (mpz_t r, const mpz_t u)
+{
+  mpz_neg (r, u);
+  mpz_sub_ui (r, r, 1);
+}
+
+void
+mpz_and (mpz_t r, const mpz_t u, const mpz_t v)
+{
+  mp_size_t un, vn, rn, i;
+  mp_ptr up, vp, rp;
+
+  mp_limb_t ux, vx, rx;
+  mp_limb_t uc, vc, rc;
+  mp_limb_t ul, vl, rl;
+
+  un = GMP_ABS (u->_mp_size);
+  vn = GMP_ABS (v->_mp_size);
+  if (un < vn)
+    {
+      MPZ_SRCPTR_SWAP (u, v);
+      MP_SIZE_T_SWAP (un, vn);
+    }
+  if (vn == 0)
+    {
+      r->_mp_size = 0;
+      return;
+    }
+
+  uc = u->_mp_size < 0;
+  vc = v->_mp_size < 0;
+  rc = uc & vc;
+
+  ux = -uc;
+  vx = -vc;
+  rx = -rc;
+
+  /* If the smaller input is positive, higher limbs don't matter. */
+  rn = vx ? un : vn;
+
+  rp = MPZ_REALLOC (r, rn + (mp_size_t) rc);
+
+  up = u->_mp_d;
+  vp = v->_mp_d;
+
+  i = 0;
+  do
+    {
+      ul = (up[i] ^ ux) + uc;
+      uc = ul < uc;
+
+      vl = (vp[i] ^ vx) + vc;
+      vc = vl < vc;
+
+      rl = ( (ul & vl) ^ rx) + rc;
+      rc = rl < rc;
+      rp[i] = rl;
+    }
+  while (++i < vn);
+  assert (vc == 0);
+
+  for (; i < rn; i++)
+    {
+      ul = (up[i] ^ ux) + uc;
+      uc = ul < uc;
+
+      rl = ( (ul & vx) ^ rx) + rc;
+      rc = rl < rc;
+      rp[i] = rl;
+    }
+  if (rc)
+    rp[rn++] = rc;
+  else
+    rn = mpn_normalized_size (rp, rn);
+
+  r->_mp_size = rx ? -rn : rn;
+}
+
+void
+mpz_ior (mpz_t r, const mpz_t u, const mpz_t v)
+{
+  mp_size_t un, vn, rn, i;
+  mp_ptr up, vp, rp;
+
+  mp_limb_t ux, vx, rx;
+  mp_limb_t uc, vc, rc;
+  mp_limb_t ul, vl, rl;
+
+  un = GMP_ABS (u->_mp_size);
+  vn = GMP_ABS (v->_mp_size);
+  if (un < vn)
+    {
+      MPZ_SRCPTR_SWAP (u, v);
+      MP_SIZE_T_SWAP (un, vn);
+    }
+  if (vn == 0)
+    {
+      mpz_set (r, u);
+      return;
+    }
+
+  uc = u->_mp_size < 0;
+  vc = v->_mp_size < 0;
+  rc = uc | vc;
+
+  ux = -uc;
+  vx = -vc;
+  rx = -rc;
+
+  /* If the smaller input is negative, by sign extension higher limbs
+     don't matter. */
+  rn = vx ? vn : un;
+
+  rp = MPZ_REALLOC (r, rn + (mp_size_t) rc);
+
+  up = u->_mp_d;
+  vp = v->_mp_d;
+
+  i = 0;
+  do
+    {
+      ul = (up[i] ^ ux) + uc;
+      uc = ul < uc;
+
+      vl = (vp[i] ^ vx) + vc;
+      vc = vl < vc;
+
+      rl = ( (ul | vl) ^ rx) + rc;
+      rc = rl < rc;
+      rp[i] = rl;
+    }
+  while (++i < vn);
+  assert (vc == 0);
+
+  for (; i < rn; i++)
+    {
+      ul = (up[i] ^ ux) + uc;
+      uc = ul < uc;
+
+      rl = ( (ul | vx) ^ rx) + rc;
+      rc = rl < rc;
+      rp[i] = rl;
+    }
+  if (rc)
+    rp[rn++] = rc;
+  else
+    rn = mpn_normalized_size (rp, rn);
+
+  r->_mp_size = rx ? -rn : rn;
+}
+
+void
+mpz_xor (mpz_t r, const mpz_t u, const mpz_t v)
+{
+  mp_size_t un, vn, i;
+  mp_ptr up, vp, rp;
+
+  mp_limb_t ux, vx, rx;
+  mp_limb_t uc, vc, rc;
+  mp_limb_t ul, vl, rl;
+
+  un = GMP_ABS (u->_mp_size);
+  vn = GMP_ABS (v->_mp_size);
+  if (un < vn)
+    {
+      MPZ_SRCPTR_SWAP (u, v);
+      MP_SIZE_T_SWAP (un, vn);
+    }
+  if (vn == 0)
+    {
+      mpz_set (r, u);
+      return;
+    }
+
+  uc = u->_mp_size < 0;
+  vc = v->_mp_size < 0;
+  rc = uc ^ vc;
+
+  ux = -uc;
+  vx = -vc;
+  rx = -rc;
+
+  rp = MPZ_REALLOC (r, un + (mp_size_t) rc);
+
+  up = u->_mp_d;
+  vp = v->_mp_d;
+
+  i = 0;
+  do
+    {
+      ul = (up[i] ^ ux) + uc;
+      uc = ul < uc;
+
+      vl = (vp[i] ^ vx) + vc;
+      vc = vl < vc;
+
+      rl = (ul ^ vl ^ rx) + rc;
+      rc = rl < rc;
+      rp[i] = rl;
+    }
+  while (++i < vn);
+  assert (vc == 0);
+
+  for (; i < un; i++)
+    {
+      ul = (up[i] ^ ux) + uc;
+      uc = ul < uc;
+
+      rl = (ul ^ ux) + rc;
+      rc = rl < rc;
+      rp[i] = rl;
+    }
+  if (rc)
+    rp[un++] = rc;
+  else
+    un = mpn_normalized_size (rp, un);
+
+  r->_mp_size = rx ? -un : un;
+}
+
+static unsigned
+gmp_popcount_limb (mp_limb_t x)
+{
+  unsigned c;
+
+  /* Do 16 bits at a time, to avoid limb-sized constants. */
+  for (c = 0; x > 0; x >>= 16)
+    {
+      unsigned w = x - ((x >> 1) & 0x5555);
+      w = ((w >> 2) & 0x3333) + (w & 0x3333);
+      w =  (w >> 4) + w;
+      w = ((w >> 8) & 0x000f) + (w & 0x000f);
+      c += w;
+    }
+  return c;
+}
+
+mp_bitcnt_t
+mpn_popcount (mp_srcptr p, mp_size_t n)
+{
+  mp_size_t i;
+  mp_bitcnt_t c;
+
+  for (c = 0, i = 0; i < n; i++)
+    c += gmp_popcount_limb (p[i]);
+
+  return c;
+}
+
+mp_bitcnt_t
+mpz_popcount (const mpz_t u)
+{
+  mp_size_t un;
+
+  un = u->_mp_size;
+
+  if (un < 0)
+    return ~(mp_bitcnt_t) 0;
+
+  return mpn_popcount (u->_mp_d, un);
+}
+
+mp_bitcnt_t
+mpz_hamdist (const mpz_t u, const mpz_t v)
+{
+  mp_size_t un, vn, i;
+  mp_limb_t uc, vc, ul, vl, comp;
+  mp_srcptr up, vp;
+  mp_bitcnt_t c;
+
+  un = u->_mp_size;
+  vn = v->_mp_size;
+
+  if ( (un ^ vn) < 0)
+    return ~(mp_bitcnt_t) 0;
+
+  comp = - (uc = vc = (un < 0));
+  if (uc)
+    {
+      assert (vn < 0);
+      un = -un;
+      vn = -vn;
+    }
+
+  up = u->_mp_d;
+  vp = v->_mp_d;
+
+  if (un < vn)
+    MPN_SRCPTR_SWAP (up, un, vp, vn);
+
+  for (i = 0, c = 0; i < vn; i++)
+    {
+      ul = (up[i] ^ comp) + uc;
+      uc = ul < uc;
+
+      vl = (vp[i] ^ comp) + vc;
+      vc = vl < vc;
+
+      c += gmp_popcount_limb (ul ^ vl);
+    }
+  assert (vc == 0);
+
+  for (; i < un; i++)
+    {
+      ul = (up[i] ^ comp) + uc;
+      uc = ul < uc;
+
+      c += gmp_popcount_limb (ul ^ comp);
+    }
+
+  return c;
+}
+
+mp_bitcnt_t
+mpz_scan1 (const mpz_t u, mp_bitcnt_t starting_bit)
+{
+  mp_ptr up;
+  mp_size_t us, un, i;
+  mp_limb_t limb, ux;
+
+  us = u->_mp_size;
+  un = GMP_ABS (us);
+  i = starting_bit / GMP_LIMB_BITS;
+
+  /* Past the end there's no 1 bits for u>=0, or an immediate 1 bit
+     for u<0. Notice this test picks up any u==0 too. */
+  if (i >= un)
+    return (us >= 0 ? ~(mp_bitcnt_t) 0 : starting_bit);
+
+  up = u->_mp_d;
+  ux = 0;
+  limb = up[i];
+
+  if (starting_bit != 0)
+    {
+      if (us < 0)
+       {
+         ux = mpn_zero_p (up, i);
+         limb = ~ limb + ux;
+         ux = - (mp_limb_t) (limb >= ux);
+       }
+
+      /* Mask to 0 all bits before starting_bit, thus ignoring them. */
+      limb &= (GMP_LIMB_MAX << (starting_bit % GMP_LIMB_BITS));
+    }
+
+  return mpn_common_scan (limb, i, up, un, ux);
+}
+
+mp_bitcnt_t
+mpz_scan0 (const mpz_t u, mp_bitcnt_t starting_bit)
+{
+  mp_ptr up;
+  mp_size_t us, un, i;
+  mp_limb_t limb, ux;
+
+  us = u->_mp_size;
+  ux = - (mp_limb_t) (us >= 0);
+  un = GMP_ABS (us);
+  i = starting_bit / GMP_LIMB_BITS;
+
+  /* When past end, there's an immediate 0 bit for u>=0, or no 0 bits for
+     u<0.  Notice this test picks up all cases of u==0 too. */
+  if (i >= un)
+    return (ux ? starting_bit : ~(mp_bitcnt_t) 0);
+
+  up = u->_mp_d;
+  limb = up[i] ^ ux;
+
+  if (ux == 0)
+    limb -= mpn_zero_p (up, i); /* limb = ~(~limb + zero_p) */
+
+  /* Mask all bits before starting_bit, thus ignoring them. */
+  limb &= (GMP_LIMB_MAX << (starting_bit % GMP_LIMB_BITS));
+
+  return mpn_common_scan (limb, i, up, un, ux);
+}
+
+
+/* MPZ base conversion. */
+
+size_t
+mpz_sizeinbase (const mpz_t u, int base)
+{
+  mp_size_t un;
+  mp_srcptr up;
+  mp_ptr tp;
+  mp_bitcnt_t bits;
+  struct gmp_div_inverse bi;
+  size_t ndigits;
+
+  assert (base >= 2);
+  assert (base <= 62);
+
+  un = GMP_ABS (u->_mp_size);
+  if (un == 0)
+    return 1;
+
+  up = u->_mp_d;
+
+  bits = (un - 1) * GMP_LIMB_BITS + mpn_limb_size_in_base_2 (up[un-1]);
+  switch (base)
+    {
+    case 2:
+      return bits;
+    case 4:
+      return (bits + 1) / 2;
+    case 8:
+      return (bits + 2) / 3;
+    case 16:
+      return (bits + 3) / 4;
+    case 32:
+      return (bits + 4) / 5;
+      /* FIXME: Do something more clever for the common case of base
+        10. */
+    }
+
+  tp = gmp_xalloc_limbs (un);
+  mpn_copyi (tp, up, un);
+  mpn_div_qr_1_invert (&bi, base);
+
+  ndigits = 0;
+  do
+    {
+      ndigits++;
+      mpn_div_qr_1_preinv (tp, tp, un, &bi);
+      un -= (tp[un-1] == 0);
+    }
+  while (un > 0);
+
+  gmp_free (tp);
+  return ndigits;
+}
+
+char *
+mpz_get_str (char *sp, int base, const mpz_t u)
+{
+  unsigned bits;
+  const char *digits;
+  mp_size_t un;
+  size_t i, sn;
+
+  digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+  if (base > 1)
+    {
+      if (base <= 36)
+       digits = "0123456789abcdefghijklmnopqrstuvwxyz";
+      else if (base > 62)
+       return NULL;
+    }
+  else if (base >= -1)
+    base = 10;
+  else
+    {
+      base = -base;
+      if (base > 36)
+       return NULL;
+    }
+
+  sn = 1 + mpz_sizeinbase (u, base);
+  if (!sp)
+    sp = (char *) gmp_xalloc (1 + sn);
+
+  un = GMP_ABS (u->_mp_size);
+
+  if (un == 0)
+    {
+      sp[0] = '0';
+      sp[1] = '\0';
+      return sp;
+    }
+
+  i = 0;
+
+  if (u->_mp_size < 0)
+    sp[i++] = '-';
+
+  bits = mpn_base_power_of_two_p (base);
+
+  if (bits)
+    /* Not modified in this case. */
+    sn = i + mpn_get_str_bits ((unsigned char *) sp + i, bits, u->_mp_d, un);
+  else
+    {
+      struct mpn_base_info info;
+      mp_ptr tp;
+
+      mpn_get_base_info (&info, base);
+      tp = gmp_xalloc_limbs (un);
+      mpn_copyi (tp, u->_mp_d, un);
+
+      sn = i + mpn_get_str_other ((unsigned char *) sp + i, base, &info, tp, 
un);
+      gmp_free (tp);
+    }
+
+  for (; i < sn; i++)
+    sp[i] = digits[(unsigned char) sp[i]];
+
+  sp[sn] = '\0';
+  return sp;
+}
+
+int
+mpz_set_str (mpz_t r, const char *sp, int base)
+{
+  unsigned bits, value_of_a;
+  mp_size_t rn, alloc;
+  mp_ptr rp;
+  size_t dn;
+  int sign;
+  unsigned char *dp;
+
+  assert (base == 0 || (base >= 2 && base <= 62));
+
+  while (isspace( (unsigned char) *sp))
+    sp++;
+
+  sign = (*sp == '-');
+  sp += sign;
+
+  if (base == 0)
+    {
+      if (sp[0] == '0')
+       {
+         if (sp[1] == 'x' || sp[1] == 'X')
+           {
+             base = 16;
+             sp += 2;
+           }
+         else if (sp[1] == 'b' || sp[1] == 'B')
+           {
+             base = 2;
+             sp += 2;
+           }
+         else
+           base = 8;
+       }
+      else
+       base = 10;
+    }
+
+  if (!*sp)
+    {
+      r->_mp_size = 0;
+      return -1;
+    }
+  dp = (unsigned char *) gmp_xalloc (strlen (sp));
+
+  value_of_a = (base > 36) ? 36 : 10;
+  for (dn = 0; *sp; sp++)
+    {
+      unsigned digit;
+
+      if (isspace ((unsigned char) *sp))
+       continue;
+      else if (*sp >= '0' && *sp <= '9')
+       digit = *sp - '0';
+      else if (*sp >= 'a' && *sp <= 'z')
+       digit = *sp - 'a' + value_of_a;
+      else if (*sp >= 'A' && *sp <= 'Z')
+       digit = *sp - 'A' + 10;
+      else
+       digit = base; /* fail */
+
+      if (digit >= (unsigned) base)
+       {
+         gmp_free (dp);
+         r->_mp_size = 0;
+         return -1;
+       }
+
+      dp[dn++] = digit;
+    }
+
+  if (!dn)
+    {
+      gmp_free (dp);
+      r->_mp_size = 0;
+      return -1;
+    }
+  bits = mpn_base_power_of_two_p (base);
+
+  if (bits > 0)
+    {
+      alloc = (dn * bits + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS;
+      rp = MPZ_REALLOC (r, alloc);
+      rn = mpn_set_str_bits (rp, dp, dn, bits);
+    }
+  else
+    {
+      struct mpn_base_info info;
+      mpn_get_base_info (&info, base);
+      alloc = (dn + info.exp - 1) / info.exp;
+      rp = MPZ_REALLOC (r, alloc);
+      rn = mpn_set_str_other (rp, dp, dn, base, &info);
+      /* Normalization, needed for all-zero input. */
+      assert (rn > 0);
+      rn -= rp[rn-1] == 0;
+    }
+  assert (rn <= alloc);
+  gmp_free (dp);
+
+  r->_mp_size = sign ? - rn : rn;
+
+  return 0;
+}
+
+int
+mpz_init_set_str (mpz_t r, const char *sp, int base)
+{
+  mpz_init (r);
+  return mpz_set_str (r, sp, base);
+}
+
+size_t
+mpz_out_str (FILE *stream, int base, const mpz_t x)
+{
+  char *str;
+  size_t len;
+
+  str = mpz_get_str (NULL, base, x);
+  len = strlen (str);
+  len = fwrite (str, 1, len, stream);
+  gmp_free (str);
+  return len;
+}
+
+
+static int
+gmp_detect_endian (void)
+{
+  static const int i = 2;
+  const unsigned char *p = (const unsigned char *) &i;
+  return 1 - *p;
+}
+
+/* Import and export. Does not support nails. */
+void
+mpz_import (mpz_t r, size_t count, int order, size_t size, int endian,
+           size_t nails, const void *src)
+{
+  const unsigned char *p;
+  ptrdiff_t word_step;
+  mp_ptr rp;
+  mp_size_t rn;
+
+  /* The current (partial) limb. */
+  mp_limb_t limb;
+  /* The number of bytes already copied to this limb (starting from
+     the low end). */
+  size_t bytes;
+  /* The index where the limb should be stored, when completed. */
+  mp_size_t i;
+
+  if (nails != 0)
+    gmp_die ("mpz_import: Nails not supported.");
+
+  assert (order == 1 || order == -1);
+  assert (endian >= -1 && endian <= 1);
+
+  if (endian == 0)
+    endian = gmp_detect_endian ();
+
+  p = (unsigned char *) src;
+
+  word_step = (order != endian) ? 2 * size : 0;
+
+  /* Process bytes from the least significant end, so point p at the
+     least significant word. */
+  if (order == 1)
+    {
+      p += size * (count - 1);
+      word_step = - word_step;
+    }
+
+  /* And at least significant byte of that word. */
+  if (endian == 1)
+    p += (size - 1);
+
+  rn = (size * count + sizeof(mp_limb_t) - 1) / sizeof(mp_limb_t);
+  rp = MPZ_REALLOC (r, rn);
+
+  for (limb = 0, bytes = 0, i = 0; count > 0; count--, p += word_step)
+    {
+      size_t j;
+      for (j = 0; j < size; j++, p -= (ptrdiff_t) endian)
+       {
+         limb |= (mp_limb_t) *p << (bytes++ * CHAR_BIT);
+         if (bytes == sizeof(mp_limb_t))
+           {
+             rp[i++] = limb;
+             bytes = 0;
+             limb = 0;
+           }
+       }
+    }
+  assert (i + (bytes > 0) == rn);
+  if (limb != 0)
+    rp[i++] = limb;
+  else
+    i = mpn_normalized_size (rp, i);
+
+  r->_mp_size = i;
+}
+
+void *
+mpz_export (void *r, size_t *countp, int order, size_t size, int endian,
+           size_t nails, const mpz_t u)
+{
+  size_t count;
+  mp_size_t un;
+
+  if (nails != 0)
+    gmp_die ("mpz_import: Nails not supported.");
+
+  assert (order == 1 || order == -1);
+  assert (endian >= -1 && endian <= 1);
+  assert (size > 0 || u->_mp_size == 0);
+
+  un = u->_mp_size;
+  count = 0;
+  if (un != 0)
+    {
+      size_t k;
+      unsigned char *p;
+      ptrdiff_t word_step;
+      /* The current (partial) limb. */
+      mp_limb_t limb;
+      /* The number of bytes left to to in this limb. */
+      size_t bytes;
+      /* The index where the limb was read. */
+      mp_size_t i;
+
+      un = GMP_ABS (un);
+
+      /* Count bytes in top limb. */
+      limb = u->_mp_d[un-1];
+      assert (limb != 0);
+
+      k = 0;
+      do {
+       k++; limb >>= CHAR_BIT;
+      } while (limb != 0);
+
+      count = (k + (un-1) * sizeof (mp_limb_t) + size - 1) / size;
+
+      if (!r)
+       r = gmp_xalloc (count * size);
+
+      if (endian == 0)
+       endian = gmp_detect_endian ();
+
+      p = (unsigned char *) r;
+
+      word_step = (order != endian) ? 2 * size : 0;
+
+      /* Process bytes from the least significant end, so point p at the
+        least significant word. */
+      if (order == 1)
+       {
+         p += size * (count - 1);
+         word_step = - word_step;
+       }
+
+      /* And at least significant byte of that word. */
+      if (endian == 1)
+       p += (size - 1);
+
+      for (bytes = 0, i = 0, k = 0; k < count; k++, p += word_step)
+       {
+         size_t j;
+         for (j = 0; j < size; j++, p -= (ptrdiff_t) endian)
+           {
+             if (bytes == 0)
+               {
+                 if (i < un)
+                   limb = u->_mp_d[i++];
+                 bytes = sizeof (mp_limb_t);
+               }
+             *p = limb;
+             limb >>= CHAR_BIT;
+             bytes--;
+           }
+       }
+      assert (i == un);
+      assert (k == count);
+    }
+
+  if (countp)
+    *countp = count;
+
+  return r;
+}
diff --git a/src/mini-gmp.h b/src/mini-gmp.h
new file mode 100644
index 0000000..27e0c06
--- /dev/null
+++ b/src/mini-gmp.h
@@ -0,0 +1,300 @@
+/* mini-gmp, a minimalistic implementation of a GNU GMP subset.
+
+Copyright 2011-2015, 2017 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+  * the GNU Lesser General Public License as published by the Free
+    Software Foundation; either version 3 of the License, or (at your
+    option) any later version.
+
+or
+
+  * the GNU General Public License as published by the Free Software
+    Foundation; either version 2 of the License, or (at your option) any
+    later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
+
+/* About mini-gmp: This is a minimal implementation of a subset of the
+   GMP interface. It is intended for inclusion into applications which
+   have modest bignums needs, as a fallback when the real GMP library
+   is not installed.
+
+   This file defines the public interface. */
+
+#ifndef __MINI_GMP_H__
+#define __MINI_GMP_H__
+
+/* For size_t */
+#include <stddef.h>
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+void mp_set_memory_functions (void *(*) (size_t),
+                             void *(*) (void *, size_t, size_t),
+                             void (*) (void *, size_t));
+
+void mp_get_memory_functions (void *(**) (size_t),
+                             void *(**) (void *, size_t, size_t),
+                             void (**) (void *, size_t));
+
+typedef unsigned long mp_limb_t;
+typedef long mp_size_t;
+typedef unsigned long mp_bitcnt_t;
+
+typedef mp_limb_t *mp_ptr;
+typedef const mp_limb_t *mp_srcptr;
+
+typedef struct
+{
+  int _mp_alloc;               /* Number of *limbs* allocated and pointed
+                                  to by the _mp_d field.  */
+  int _mp_size;                        /* abs(_mp_size) is the number of limbs 
the
+                                  last field points to.  If _mp_size is
+                                  negative this is a negative number.  */
+  mp_limb_t *_mp_d;            /* Pointer to the limbs.  */
+} __mpz_struct;
+
+typedef __mpz_struct mpz_t[1];
+
+typedef __mpz_struct *mpz_ptr;
+typedef const __mpz_struct *mpz_srcptr;
+
+extern const int mp_bits_per_limb;
+
+void mpn_copyi (mp_ptr, mp_srcptr, mp_size_t);
+void mpn_copyd (mp_ptr, mp_srcptr, mp_size_t);
+void mpn_zero (mp_ptr, mp_size_t);
+
+int mpn_cmp (mp_srcptr, mp_srcptr, mp_size_t);
+int mpn_zero_p (mp_srcptr, mp_size_t);
+
+mp_limb_t mpn_add_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t mpn_add_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+mp_limb_t mpn_add (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
+
+mp_limb_t mpn_sub_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t mpn_sub_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+mp_limb_t mpn_sub (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
+
+mp_limb_t mpn_mul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t mpn_addmul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t mpn_submul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+
+mp_limb_t mpn_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
+void mpn_mul_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+void mpn_sqr (mp_ptr, mp_srcptr, mp_size_t);
+int mpn_perfect_square_p (mp_srcptr, mp_size_t);
+mp_size_t mpn_sqrtrem (mp_ptr, mp_ptr, mp_srcptr, mp_size_t);
+
+mp_limb_t mpn_lshift (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
+mp_limb_t mpn_rshift (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
+
+mp_bitcnt_t mpn_scan0 (mp_srcptr, mp_bitcnt_t);
+mp_bitcnt_t mpn_scan1 (mp_srcptr, mp_bitcnt_t);
+
+void mpn_com (mp_ptr, mp_srcptr, mp_size_t);
+mp_limb_t mpn_neg (mp_ptr, mp_srcptr, mp_size_t);
+
+mp_bitcnt_t mpn_popcount (mp_srcptr, mp_size_t);
+
+mp_limb_t mpn_invert_3by2 (mp_limb_t, mp_limb_t);
+#define mpn_invert_limb(x) mpn_invert_3by2 ((x), 0)
+
+size_t mpn_get_str (unsigned char *, int, mp_ptr, mp_size_t);
+mp_size_t mpn_set_str (mp_ptr, const unsigned char *, size_t, int);
+
+void mpz_init (mpz_t);
+void mpz_init2 (mpz_t, mp_bitcnt_t);
+void mpz_clear (mpz_t);
+
+#define mpz_odd_p(z)   (((z)->_mp_size != 0) & (int) (z)->_mp_d[0])
+#define mpz_even_p(z)  (! mpz_odd_p (z))
+
+int mpz_sgn (const mpz_t);
+int mpz_cmp_si (const mpz_t, long);
+int mpz_cmp_ui (const mpz_t, unsigned long);
+int mpz_cmp (const mpz_t, const mpz_t);
+int mpz_cmpabs_ui (const mpz_t, unsigned long);
+int mpz_cmpabs (const mpz_t, const mpz_t);
+int mpz_cmp_d (const mpz_t, double);
+int mpz_cmpabs_d (const mpz_t, double);
+
+void mpz_abs (mpz_t, const mpz_t);
+void mpz_neg (mpz_t, const mpz_t);
+void mpz_swap (mpz_t, mpz_t);
+
+void mpz_add_ui (mpz_t, const mpz_t, unsigned long);
+void mpz_add (mpz_t, const mpz_t, const mpz_t);
+void mpz_sub_ui (mpz_t, const mpz_t, unsigned long);
+void mpz_ui_sub (mpz_t, unsigned long, const mpz_t);
+void mpz_sub (mpz_t, const mpz_t, const mpz_t);
+
+void mpz_mul_si (mpz_t, const mpz_t, long int);
+void mpz_mul_ui (mpz_t, const mpz_t, unsigned long int);
+void mpz_mul (mpz_t, const mpz_t, const mpz_t);
+void mpz_mul_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
+void mpz_addmul_ui (mpz_t, const mpz_t, unsigned long int);
+void mpz_addmul (mpz_t, const mpz_t, const mpz_t);
+void mpz_submul_ui (mpz_t, const mpz_t, unsigned long int);
+void mpz_submul (mpz_t, const mpz_t, const mpz_t);
+
+void mpz_cdiv_qr (mpz_t, mpz_t, const mpz_t, const mpz_t);
+void mpz_fdiv_qr (mpz_t, mpz_t, const mpz_t, const mpz_t);
+void mpz_tdiv_qr (mpz_t, mpz_t, const mpz_t, const mpz_t);
+void mpz_cdiv_q (mpz_t, const mpz_t, const mpz_t);
+void mpz_fdiv_q (mpz_t, const mpz_t, const mpz_t);
+void mpz_tdiv_q (mpz_t, const mpz_t, const mpz_t);
+void mpz_cdiv_r (mpz_t, const mpz_t, const mpz_t);
+void mpz_fdiv_r (mpz_t, const mpz_t, const mpz_t);
+void mpz_tdiv_r (mpz_t, const mpz_t, const mpz_t);
+
+void mpz_cdiv_q_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
+void mpz_fdiv_q_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
+void mpz_tdiv_q_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
+void mpz_cdiv_r_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
+void mpz_fdiv_r_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
+void mpz_tdiv_r_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
+
+void mpz_mod (mpz_t, const mpz_t, const mpz_t);
+
+void mpz_divexact (mpz_t, const mpz_t, const mpz_t);
+
+int mpz_divisible_p (const mpz_t, const mpz_t);
+int mpz_congruent_p (const mpz_t, const mpz_t, const mpz_t);
+
+unsigned long mpz_cdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long);
+unsigned long mpz_fdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long);
+unsigned long mpz_tdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long);
+unsigned long mpz_cdiv_q_ui (mpz_t, const mpz_t, unsigned long);
+unsigned long mpz_fdiv_q_ui (mpz_t, const mpz_t, unsigned long);
+unsigned long mpz_tdiv_q_ui (mpz_t, const mpz_t, unsigned long);
+unsigned long mpz_cdiv_r_ui (mpz_t, const mpz_t, unsigned long);
+unsigned long mpz_fdiv_r_ui (mpz_t, const mpz_t, unsigned long);
+unsigned long mpz_tdiv_r_ui (mpz_t, const mpz_t, unsigned long);
+unsigned long mpz_cdiv_ui (const mpz_t, unsigned long);
+unsigned long mpz_fdiv_ui (const mpz_t, unsigned long);
+unsigned long mpz_tdiv_ui (const mpz_t, unsigned long);
+
+unsigned long mpz_mod_ui (mpz_t, const mpz_t, unsigned long);
+
+void mpz_divexact_ui (mpz_t, const mpz_t, unsigned long);
+
+int mpz_divisible_ui_p (const mpz_t, unsigned long);
+
+unsigned long mpz_gcd_ui (mpz_t, const mpz_t, unsigned long);
+void mpz_gcd (mpz_t, const mpz_t, const mpz_t);
+void mpz_gcdext (mpz_t, mpz_t, mpz_t, const mpz_t, const mpz_t);
+void mpz_lcm_ui (mpz_t, const mpz_t, unsigned long);
+void mpz_lcm (mpz_t, const mpz_t, const mpz_t);
+int mpz_invert (mpz_t, const mpz_t, const mpz_t);
+
+void mpz_sqrtrem (mpz_t, mpz_t, const mpz_t);
+void mpz_sqrt (mpz_t, const mpz_t);
+int mpz_perfect_square_p (const mpz_t);
+
+void mpz_pow_ui (mpz_t, const mpz_t, unsigned long);
+void mpz_ui_pow_ui (mpz_t, unsigned long, unsigned long);
+void mpz_powm (mpz_t, const mpz_t, const mpz_t, const mpz_t);
+void mpz_powm_ui (mpz_t, const mpz_t, unsigned long, const mpz_t);
+
+void mpz_rootrem (mpz_t, mpz_t, const mpz_t, unsigned long);
+int mpz_root (mpz_t, const mpz_t, unsigned long);
+
+void mpz_fac_ui (mpz_t, unsigned long);
+void mpz_2fac_ui (mpz_t, unsigned long);
+void mpz_mfac_uiui (mpz_t, unsigned long, unsigned long);
+void mpz_bin_uiui (mpz_t, unsigned long, unsigned long);
+
+int mpz_probab_prime_p (const mpz_t, int);
+
+int mpz_tstbit (const mpz_t, mp_bitcnt_t);
+void mpz_setbit (mpz_t, mp_bitcnt_t);
+void mpz_clrbit (mpz_t, mp_bitcnt_t);
+void mpz_combit (mpz_t, mp_bitcnt_t);
+
+void mpz_com (mpz_t, const mpz_t);
+void mpz_and (mpz_t, const mpz_t, const mpz_t);
+void mpz_ior (mpz_t, const mpz_t, const mpz_t);
+void mpz_xor (mpz_t, const mpz_t, const mpz_t);
+
+mp_bitcnt_t mpz_popcount (const mpz_t);
+mp_bitcnt_t mpz_hamdist (const mpz_t, const mpz_t);
+mp_bitcnt_t mpz_scan0 (const mpz_t, mp_bitcnt_t);
+mp_bitcnt_t mpz_scan1 (const mpz_t, mp_bitcnt_t);
+
+int mpz_fits_slong_p (const mpz_t);
+int mpz_fits_ulong_p (const mpz_t);
+long int mpz_get_si (const mpz_t);
+unsigned long int mpz_get_ui (const mpz_t);
+double mpz_get_d (const mpz_t);
+size_t mpz_size (const mpz_t);
+mp_limb_t mpz_getlimbn (const mpz_t, mp_size_t);
+
+void mpz_realloc2 (mpz_t, mp_bitcnt_t);
+mp_srcptr mpz_limbs_read (mpz_srcptr);
+mp_ptr mpz_limbs_modify (mpz_t, mp_size_t);
+mp_ptr mpz_limbs_write (mpz_t, mp_size_t);
+void mpz_limbs_finish (mpz_t, mp_size_t);
+mpz_srcptr mpz_roinit_n (mpz_t, mp_srcptr, mp_size_t);
+
+#define MPZ_ROINIT_N(xp, xs) {{0, (xs),(xp) }}
+
+void mpz_set_si (mpz_t, signed long int);
+void mpz_set_ui (mpz_t, unsigned long int);
+void mpz_set (mpz_t, const mpz_t);
+void mpz_set_d (mpz_t, double);
+
+void mpz_init_set_si (mpz_t, signed long int);
+void mpz_init_set_ui (mpz_t, unsigned long int);
+void mpz_init_set (mpz_t, const mpz_t);
+void mpz_init_set_d (mpz_t, double);
+
+size_t mpz_sizeinbase (const mpz_t, int);
+char *mpz_get_str (char *, int, const mpz_t);
+int mpz_set_str (mpz_t, const char *, int);
+int mpz_init_set_str (mpz_t, const char *, int);
+
+/* This long list taken from gmp.h. */
+/* For reference, "defined(EOF)" cannot be used here.  In g++ 2.95.4,
+   <iostream> defines EOF but not FILE.  */
+#if defined (FILE)                                              \
+  || defined (H_STDIO)                                          \
+  || defined (_H_STDIO)               /* AIX */                 \
+  || defined (_STDIO_H)               /* glibc, Sun, SCO */     \
+  || defined (_STDIO_H_)              /* BSD, OSF */            \
+  || defined (__STDIO_H)              /* Borland */             \
+  || defined (__STDIO_H__)            /* IRIX */                \
+  || defined (_STDIO_INCLUDED)        /* HPUX */                \
+  || defined (__dj_include_stdio_h_)  /* DJGPP */               \
+  || defined (_FILE_DEFINED)          /* Microsoft */           \
+  || defined (__STDIO__)              /* Apple MPW MrC */       \
+  || defined (_MSL_STDIO_H)           /* Metrowerks */          \
+  || defined (_STDIO_H_INCLUDED)      /* QNX4 */               \
+  || defined (_ISO_STDIO_ISO_H)       /* Sun C++ */            \
+  || defined (__STDIO_LOADED)         /* VMS */
+size_t mpz_out_str (FILE *, int, const mpz_t);
+#endif
+
+void mpz_import (mpz_t, size_t, int, size_t, int, size_t, const void *);
+void *mpz_export (void *, size_t *, int, size_t, int, size_t, const mpz_t);
+
+#if defined (__cplusplus)
+}
+#endif
+#endif /* __MINI_GMP_H__ */
diff --git a/src/minibuf.c b/src/minibuf.c
index abc4866..751d6bd 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -157,7 +157,7 @@ string_to_object (Lisp_Object val, Lisp_Object defalt)
     }
 
   expr_and_pos = Fread_from_string (val, Qnil, Qnil);
-  pos = XINT (Fcdr (expr_and_pos));
+  pos = XFIXNUM (Fcdr (expr_and_pos));
   if (pos != SCHARS (val))
     {
       /* Ignore trailing whitespace; any other trailing junk
@@ -198,7 +198,7 @@ read_minibuf_noninteractive (Lisp_Object map, Lisp_Object 
initial,
 
   /* Check, whether we need to suppress echoing.  */
   if (CHARACTERP (Vread_hide_char))
-    hide_char = XFASTINT (Vread_hide_char);
+    hide_char = XFIXNAT (Vread_hide_char);
 
   /* Manipulate tty.  */
   if (hide_char)
@@ -291,7 +291,7 @@ Return (point-min) if current buffer is not a minibuffer.  
*/)
 {
   /* This function is written to be most efficient when there's a prompt.  */
   Lisp_Object beg, end, tem;
-  beg = make_number (BEGV);
+  beg = make_fixnum (BEGV);
 
   tem = Fmemq (Fcurrent_buffer (), Vminibuffer_list);
   if (NILP (tem))
@@ -299,7 +299,7 @@ Return (point-min) if current buffer is not a minibuffer.  
*/)
 
   end = Ffield_end (beg, Qnil, Qnil);
 
-  if (XINT (end) == ZV && NILP (Fget_char_property (beg, Qfield, Qnil)))
+  if (XFIXNUM (end) == ZV && NILP (Fget_char_property (beg, Qfield, Qnil)))
     return beg;
   else
     return end;
@@ -311,7 +311,7 @@ DEFUN ("minibuffer-contents", Fminibuffer_contents,
 If the current buffer is not a minibuffer, return its entire contents.  */)
   (void)
 {
-  ptrdiff_t prompt_end = XINT (Fminibuffer_prompt_end ());
+  ptrdiff_t prompt_end = XFIXNUM (Fminibuffer_prompt_end ());
   return make_buffer_string (prompt_end, ZV, 1);
 }
 
@@ -321,7 +321,7 @@ DEFUN ("minibuffer-contents-no-properties", 
Fminibuffer_contents_no_properties,
 If the current buffer is not a minibuffer, return its entire contents.  */)
   (void)
 {
-  ptrdiff_t prompt_end = XINT (Fminibuffer_prompt_end ());
+  ptrdiff_t prompt_end = XFIXNUM (Fminibuffer_prompt_end ());
   return make_buffer_string (prompt_end, ZV, 0);
 }
 
@@ -393,13 +393,13 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, 
Lisp_Object prompt,
          CHECK_STRING (initial);
          if (!NILP (backup_n))
            {
-             CHECK_NUMBER (backup_n);
+             CHECK_FIXNUM (backup_n);
              /* Convert to distance from end of input.  */
-             if (XINT (backup_n) < 1)
+             if (XFIXNUM (backup_n) < 1)
                /* A number too small means the beginning of the string.  */
                pos =  - SCHARS (initial);
              else
-               pos = XINT (backup_n) - 1 - SCHARS (initial);
+               pos = XFIXNUM (backup_n) - 1 - SCHARS (initial);
            }
        }
       else
@@ -431,7 +431,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, 
Lisp_Object prompt,
       && NILP (Vexecuting_kbd_macro))
     {
       val = read_minibuf_noninteractive (map, initial, prompt,
-                                        make_number (pos),
+                                        make_fixnum (pos),
                                         expflag, histvar, histpos, defalt,
                                         allow_props, inherit_input_method);
       return unbind_to (count, val);
@@ -478,7 +478,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, 
Lisp_Object prompt,
                    minibuf_save_list));
   minibuf_save_list
     = Fcons (minibuf_prompt,
-            Fcons (make_number (minibuf_prompt_width),
+            Fcons (make_fixnum (minibuf_prompt_width),
                    Fcons (Vhelp_form,
                           Fcons (Vcurrent_prefix_arg,
                                  Fcons (Vminibuffer_history_position,
@@ -610,11 +610,11 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, 
Lisp_Object prompt,
     Finsert (1, &minibuf_prompt);
     if (PT > BEG)
       {
-       Fput_text_property (make_number (BEG), make_number (PT),
+       Fput_text_property (make_fixnum (BEG), make_fixnum (PT),
                            Qfront_sticky, Qt, Qnil);
-       Fput_text_property (make_number (BEG), make_number (PT),
+       Fput_text_property (make_fixnum (BEG), make_fixnum (PT),
                            Qrear_nonsticky, Qt, Qnil);
-       Fput_text_property (make_number (BEG), make_number (PT),
+       Fput_text_property (make_fixnum (BEG), make_fixnum (PT),
                            Qfield, Qt, Qnil);
        if (CONSP (Vminibuffer_prompt_properties))
          {
@@ -633,10 +633,10 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, 
Lisp_Object prompt,
                    Lisp_Object val = XCAR (list);
                    list = XCDR (list);
                    if (EQ (key, Qface))
-                     Fadd_face_text_property (make_number (BEG),
-                                              make_number (PT), val, Qt, Qnil);
+                     Fadd_face_text_property (make_fixnum (BEG),
+                                              make_fixnum (PT), val, Qt, Qnil);
                    else
-                     Fput_text_property (make_number (BEG), make_number (PT),
+                     Fput_text_property (make_fixnum (BEG), make_fixnum (PT),
                                          key, val, Qnil);
                  }
              }
@@ -651,7 +651,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, 
Lisp_Object prompt,
   if (!NILP (initial))
     {
       Finsert (1, &initial);
-      Fforward_char (make_number (pos));
+      Fforward_char (make_fixnum (pos));
     }
 
   clear_message (1, 1);
@@ -721,7 +721,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, 
Lisp_Object prompt,
 Lisp_Object
 get_minibuffer (EMACS_INT depth)
 {
-  Lisp_Object tail = Fnthcdr (make_number (depth), Vminibuffer_list);
+  Lisp_Object tail = Fnthcdr (make_fixnum (depth), Vminibuffer_list);
   if (NILP (tail))
     {
       tail = list1 (Qnil);
@@ -788,12 +788,12 @@ read_minibuf_unwind (void)
   /* Restore prompt, etc, from outer minibuffer level.  */
   Lisp_Object key_vec = Fcar (minibuf_save_list);
   eassert (VECTORP (key_vec));
-  this_command_key_count = XFASTINT (Flength (key_vec));
+  this_command_key_count = XFIXNAT (Flength (key_vec));
   this_command_keys = key_vec;
   minibuf_save_list = Fcdr (minibuf_save_list);
   minibuf_prompt = Fcar (minibuf_save_list);
   minibuf_save_list = Fcdr (minibuf_save_list);
-  minibuf_prompt_width = XFASTINT (Fcar (minibuf_save_list));
+  minibuf_prompt_width = XFIXNAT (Fcar (minibuf_save_list));
   minibuf_save_list = Fcdr (minibuf_save_list);
   Vhelp_form = Fcar (minibuf_save_list);
   minibuf_save_list = Fcdr (minibuf_save_list);
@@ -995,7 +995,7 @@ the current input method and the setting 
of`enable-multibyte-characters'.  */)
 {
   CHECK_STRING (prompt);
   return read_minibuf (Vminibuffer_local_ns_map, initial, prompt,
-                      0, Qminibuffer_history, make_number (0), Qnil, 0,
+                      0, Qminibuffer_history, make_fixnum (0), Qnil, 0,
                       !NILP (inherit_input_method));
 }
 
@@ -1195,7 +1195,7 @@ is used to further constrain the set of candidates.  */)
     return call3 (collection, string, predicate, Qnil);
 
   bestmatch = bucket = Qnil;
-  zero = make_number (0);
+  zero = make_fixnum (0);
 
   /* If COLLECTION is not a list, set TAIL just for gc pro.  */
   tail = collection;
@@ -1261,7 +1261,7 @@ is used to further constrain the set of candidates.  */)
       if (STRINGP (eltstring)
          && SCHARS (string) <= SCHARS (eltstring)
          && (tem = Fcompare_strings (eltstring, zero,
-                                     make_number (SCHARS (string)),
+                                     make_fixnum (SCHARS (string)),
                                      string, zero, Qnil,
                                      completion_ignore_case ? Qt : Qnil),
              EQ (Qt, tem)))
@@ -1323,11 +1323,11 @@ is used to further constrain the set of candidates.  */)
            {
              compare = min (bestmatchsize, SCHARS (eltstring));
              tem = Fcompare_strings (bestmatch, zero,
-                                     make_number (compare),
+                                     make_fixnum (compare),
                                      eltstring, zero,
-                                     make_number (compare),
+                                     make_fixnum (compare),
                                      completion_ignore_case ? Qt : Qnil);
-             matchsize = EQ (tem, Qt) ? compare : eabs (XINT (tem)) - 1;
+             matchsize = EQ (tem, Qt) ? compare : eabs (XFIXNUM (tem)) - 1;
 
              if (completion_ignore_case)
                {
@@ -1348,13 +1348,13 @@ is used to further constrain the set of candidates.  */)
                       ==
                       (matchsize == SCHARS (bestmatch))
                       && (tem = Fcompare_strings (eltstring, zero,
-                                                  make_number (SCHARS 
(string)),
+                                                  make_fixnum (SCHARS 
(string)),
                                                   string, zero,
                                                   Qnil,
                                                   Qnil),
                           EQ (Qt, tem))
                       && (tem = Fcompare_strings (bestmatch, zero,
-                                                  make_number (SCHARS 
(string)),
+                                                  make_fixnum (SCHARS 
(string)),
                                                   string, zero,
                                                   Qnil,
                                                   Qnil),
@@ -1447,7 +1447,7 @@ with a space are ignored unless STRING itself starts with 
a space.  */)
   if (type == 0)
     return call3 (collection, string, predicate, Qt);
   allmatches = bucket = Qnil;
-  zero = make_number (0);
+  zero = make_fixnum (0);
 
   /* If COLLECTION is not a list, set TAIL just for gc pro.  */
   tail = collection;
@@ -1519,9 +1519,9 @@ with a space are ignored unless STRING itself starts with 
a space.  */)
                  && SREF (string, 0) == ' ')
              || SREF (eltstring, 0) != ' ')
          && (tem = Fcompare_strings (eltstring, zero,
-                                     make_number (SCHARS (string)),
+                                     make_fixnum (SCHARS (string)),
                                      string, zero,
-                                     make_number (SCHARS (string)),
+                                     make_fixnum (SCHARS (string)),
                                      completion_ignore_case ? Qt : Qnil),
              EQ (Qt, tem)))
        {
@@ -1694,9 +1694,9 @@ the values STRING, PREDICATE and `lambda'.  */)
              if (SYMBOLP (tail))
                while (1)
                  {
-                   if (EQ (Fcompare_strings (string, make_number (0), Qnil,
+                   if (EQ (Fcompare_strings (string, make_fixnum (0), Qnil,
                                              Fsymbol_name (tail),
-                                             make_number (0) , Qnil, Qt),
+                                             make_fixnum (0) , Qnil, Qt),
                           Qt))
                      {
                        tem = tail;
@@ -1839,8 +1839,8 @@ single string, rather than a cons cell whose car is a 
string.  */)
        thiscar = Fsymbol_name (thiscar);
       else if (!STRINGP (thiscar))
        continue;
-      tem = Fcompare_strings (thiscar, make_number (0), Qnil,
-                             key, make_number (0), Qnil,
+      tem = Fcompare_strings (thiscar, make_fixnum (0), Qnil,
+                             key, make_fixnum (0), Qnil,
                              case_fold);
       if (EQ (tem, Qt))
        return elt;
@@ -1854,7 +1854,7 @@ DEFUN ("minibuffer-depth", Fminibuffer_depth, 
Sminibuffer_depth, 0, 0, 0,
        doc: /* Return current depth of activations of minibuffer, a 
nonnegative integer.  */)
   (void)
 {
-  return make_number (minibuf_level);
+  return make_fixnum (minibuf_level);
 }
 
 DEFUN ("minibuffer-prompt", Fminibuffer_prompt, Sminibuffer_prompt, 0, 0, 0,
diff --git a/src/msdos.c b/src/msdos.c
index 6c0dfa0..4031c57 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -223,8 +223,8 @@ them.  This happens with wheeled mice on Windows 9X, for 
example.  */)
 {
   int n;
 
-  CHECK_NUMBER (nbuttons);
-  n = XINT (nbuttons);
+  CHECK_FIXNUM (nbuttons);
+  n = XFIXNUM (nbuttons);
   if (n < 2 || n > 3)
     xsignal2 (Qargs_out_of_range,
              build_string ("only 2 or 3 mouse buttons are supported"),
@@ -322,8 +322,8 @@ mouse_get_pos (struct frame **f, int insist, Lisp_Object 
*bar_window,
   *bar_window = Qnil;
   mouse_get_xy (&ix, &iy);
   *time = event_timestamp ();
-  *x = make_number (mouse_last_x = ix);
-  *y = make_number (mouse_last_y = iy);
+  *x = make_fixnum (mouse_last_x = ix);
+  *y = make_fixnum (mouse_last_y = iy);
 }
 
 static void
@@ -539,8 +539,8 @@ dos_set_window_size (int *rows, int *cols)
                                   (video_name, "screen-dimensions-%dx%d",
                                    *rows, *cols), Qnil));
 
-  if (INTEGERP (video_mode)
-      && (video_mode_value = XINT (video_mode)) > 0)
+  if (FIXNUMP (video_mode)
+      && (video_mode_value = XFIXNUM (video_mode)) > 0)
     {
       regs.x.ax = video_mode_value;
       int86 (0x10, &regs, &regs);
@@ -742,21 +742,21 @@ IT_set_cursor_type (struct frame *f, Lisp_Object 
cursor_type)
       Lisp_Object bar_parms = XCDR (cursor_type);
       int width;
 
-      if (INTEGERP (bar_parms))
+      if (FIXNUMP (bar_parms))
        {
          /* Feature: negative WIDTH means cursor at the top
             of the character cell, zero means invisible cursor.  */
-         width = XINT (bar_parms);
+         width = XFIXNUM (bar_parms);
          msdos_set_cursor_shape (f, width >= 0 ? DEFAULT_CURSOR_START : 0,
                                  width);
        }
       else if (CONSP (bar_parms)
-              && INTEGERP (XCAR (bar_parms))
-              && INTEGERP (XCDR (bar_parms)))
+              && FIXNUMP (XCAR (bar_parms))
+              && FIXNUMP (XCDR (bar_parms)))
        {
-         int start_line = XINT (XCDR (bar_parms));
+         int start_line = XFIXNUM (XCDR (bar_parms));
 
-         width = XINT (XCAR (bar_parms));
+         width = XFIXNUM (XCAR (bar_parms));
          msdos_set_cursor_shape (f, start_line, width);
        }
     }
@@ -1321,7 +1321,7 @@ IT_frame_up_to_date (struct frame *f)
       if (EQ (BVAR (b,cursor_type), Qt))
        new_cursor = frame_desired_cursor;
       else if (NILP (BVAR (b, cursor_type))) /* nil means no cursor */
-       new_cursor = Fcons (Qbar, make_number (0));
+       new_cursor = Fcons (Qbar, make_fixnum (0));
       else
        new_cursor = BVAR (b, cursor_type);
     }
@@ -1564,7 +1564,7 @@ void
 IT_set_frame_parameters (struct frame *f, Lisp_Object alist)
 {
   Lisp_Object tail;
-  int i, j, length = XINT (Flength (alist));
+  int i, j, length = XFIXNUM (Flength (alist));
   Lisp_Object *parms
     = (Lisp_Object *) alloca (length * word_size);
   Lisp_Object *values
@@ -1791,7 +1791,7 @@ internal_terminal_init (void)
        }
 
       Vinitial_window_system = Qpc;
-      Vwindow_system_version = make_number (27); /* RE Emacs version */
+      Vwindow_system_version = make_fixnum (27); /* RE Emacs version */
       tty->terminal->type = output_msdos_raw;
 
       /* If Emacs was dumped on DOS/V machine, forget the stale VRAM
@@ -2423,11 +2423,11 @@ dos_rawgetc (void)
       sc = regs.h.ah;
 
       total_doskeys += 2;
-      ASET (recent_doskeys, recent_doskeys_index, make_number (c));
+      ASET (recent_doskeys, recent_doskeys_index, make_fixnum (c));
       recent_doskeys_index++;
       if (recent_doskeys_index == NUM_RECENT_DOSKEYS)
        recent_doskeys_index = 0;
-      ASET (recent_doskeys, recent_doskeys_index, make_number (sc));
+      ASET (recent_doskeys, recent_doskeys_index, make_fixnum (sc));
       recent_doskeys_index++;
       if (recent_doskeys_index == NUM_RECENT_DOSKEYS)
        recent_doskeys_index = 0;
@@ -2609,7 +2609,7 @@ dos_rawgetc (void)
       if (code == 0)
        continue;
 
-      if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight))
+      if (!hlinfo->mouse_face_hidden && FIXNUMP (Vmouse_highlight))
        {
          clear_mouse_face (hlinfo);
          hlinfo->mouse_face_hidden = 1;
@@ -2718,8 +2718,8 @@ dos_rawgetc (void)
                event.code = button_num;
                event.modifiers = dos_get_modifiers (0)
                  | (press ? down_modifier : up_modifier);
-               event.x = make_number (x);
-               event.y = make_number (y);
+               event.x = make_fixnum (x);
+               event.y = make_fixnum (y);
                event.frame_or_window = selected_frame;
                event.arg = Qnil;
                event.timestamp = event_timestamp ();
@@ -4196,7 +4196,7 @@ msdos_fatal_signal (int sig)
 void
 syms_of_msdos (void)
 {
-  recent_doskeys = Fmake_vector (make_number (NUM_RECENT_DOSKEYS), Qnil);
+  recent_doskeys = Fmake_vector (make_fixnum (NUM_RECENT_DOSKEYS), Qnil);
   staticpro (&recent_doskeys);
 
 #ifndef HAVE_X_WINDOWS
@@ -4207,7 +4207,7 @@ syms_of_msdos (void)
   DEFVAR_LISP ("dos-unsupported-char-glyph", Vdos_unsupported_char_glyph,
               doc: /* Glyph to display instead of chars not supported by 
current codepage.
 This variable is used only by MS-DOS terminals.  */);
-  Vdos_unsupported_char_glyph = make_number ('\177');
+  Vdos_unsupported_char_glyph = make_fixnum ('\177');
 
 #endif
 
diff --git a/src/nsfns.m b/src/nsfns.m
index 184657f..ece21c6 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -209,7 +209,7 @@ interpret_services_menu (NSMenu *menu, Lisp_Object prefix, 
Lisp_Object old)
           if (keys && [keys length] )
             {
               key = [keys characterAtIndex: 0];
-              res = make_number (key|super_modifier);
+              res = make_fixnum (key|super_modifier);
             }
           else
             {
@@ -589,8 +589,8 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, 
Lisp_Object oldval)
   if (FRAME_MINIBUF_ONLY_P (f))
     return;
 
-  if (TYPE_RANGED_INTEGERP (int, value))
-    nlines = XINT (value);
+  if (TYPE_RANGED_FIXNUMP (int, value))
+    nlines = XFIXNUM (value);
   else
     nlines = 0;
 
@@ -627,8 +627,8 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, 
Lisp_Object oldval)
   if (FRAME_MINIBUF_ONLY_P (f))
     return;
 
-  if (RANGED_INTEGERP (0, value, INT_MAX))
-    nlines = XFASTINT (value);
+  if (RANGED_FIXNUMP (0, value, INT_MAX))
+    nlines = XFIXNAT (value);
   else
     nlines = 0;
 
@@ -686,7 +686,7 @@ x_set_internal_border_width (struct frame *f, Lisp_Object 
arg, Lisp_Object oldva
   int old_width = FRAME_INTERNAL_BORDER_WIDTH (f);
 
   CHECK_TYPE_RANGED_INTEGER (int, arg);
-  f->internal_border_width = XINT (arg);
+  f->internal_border_width = XFIXNUM (arg);
   if (FRAME_INTERNAL_BORDER_WIDTH (f) < 0)
     f->internal_border_width = 0;
 
@@ -884,10 +884,10 @@ x_icon (struct frame *f, Lisp_Object parms)
   icon_y = x_get_arg (dpyinfo, parms, Qicon_top, 0, 0,  RES_TYPE_NUMBER);
   if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound))
     {
-      CHECK_NUMBER (icon_x);
-      CHECK_NUMBER (icon_y);
-      f->output_data.ns->icon_top = XINT (icon_y);
-      f->output_data.ns->icon_left = XINT (icon_x);
+      CHECK_FIXNUM (icon_x);
+      CHECK_FIXNUM (icon_y);
+      f->output_data.ns->icon_top = XFIXNUM (icon_y);
+      f->output_data.ns->icon_left = XFIXNUM (icon_x);
     }
   else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound))
     error ("Both left and top icon corners of icon must be specified");
@@ -1086,7 +1086,7 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
   if (EQ (parent, Qunbound))
     parent = Qnil;
   if (! NILP (parent))
-    CHECK_NUMBER (parent);
+    CHECK_FIXNUM (parent);
 
   /* make_frame_without_minibuffer can run Lisp code and garbage collect.  */
   /* No need to protect DISPLAY because that's not used after passing
@@ -1127,9 +1127,9 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
   record_unwind_protect (unwind_create_frame, frame);
 
   f->output_data.ns->window_desc = desc_ctr++;
-  if (TYPE_RANGED_INTEGERP (Window, parent))
+  if (TYPE_RANGED_FIXNUMP (Window, parent))
     {
-      f->output_data.ns->parent_desc = XFASTINT (parent);
+      f->output_data.ns->parent_desc = XFIXNAT (parent);
       f->output_data.ns->explicit_parent = 1;
     }
   else
@@ -1170,7 +1170,7 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
     /* use for default font name */
     id font = [NSFont userFixedPitchFontOfSize: -1.0]; /* default */
     x_default_parameter (f, parms, Qfontsize,
-                                    make_number (0 /* (int)[font pointSize] 
*/),
+                                    make_fixnum (0 /* (int)[font pointSize] 
*/),
                                     "fontSize", "FontSize", RES_TYPE_NUMBER);
     // Remove ' Regular', not handled by backends.
     char *fontname = xstrdup ([[font displayName] UTF8String]);
@@ -1184,14 +1184,14 @@ DEFUN ("x-create-frame", Fx_create_frame, 
Sx_create_frame,
   }
   unblock_input ();
 
-  x_default_parameter (f, parms, Qborder_width, make_number (0),
+  x_default_parameter (f, parms, Qborder_width, make_fixnum (0),
                       "borderwidth", "BorderWidth", RES_TYPE_NUMBER);
-  x_default_parameter (f, parms, Qinternal_border_width, make_number (2),
+  x_default_parameter (f, parms, Qinternal_border_width, make_fixnum (2),
                       "internalBorderWidth", "InternalBorderWidth",
                       RES_TYPE_NUMBER);
-  x_default_parameter (f, parms, Qright_divider_width, make_number (0),
+  x_default_parameter (f, parms, Qright_divider_width, make_fixnum (0),
                       NULL, NULL, RES_TYPE_NUMBER);
-  x_default_parameter (f, parms, Qbottom_divider_width, make_number (0),
+  x_default_parameter (f, parms, Qbottom_divider_width, make_fixnum (0),
                       NULL, NULL, RES_TYPE_NUMBER);
 
   /* default vertical scrollbars on right on Mac */
@@ -1226,10 +1226,10 @@ DEFUN ("x-create-frame", Fx_create_frame, 
Sx_create_frame,
 
   /* Read comment about this code in corresponding place in xfns.c.  */
   tem = x_get_arg (dpyinfo, parms, Qmin_width, NULL, NULL, RES_TYPE_NUMBER);
-  if (NUMBERP (tem))
+  if (FIXED_OR_FLOATP (tem))
     store_frame_param (f, Qmin_width, tem);
   tem = x_get_arg (dpyinfo, parms, Qmin_height, NULL, NULL, RES_TYPE_NUMBER);
-  if (NUMBERP (tem))
+  if (FIXED_OR_FLOATP (tem))
     store_frame_param (f, Qmin_height, tem);
   adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f),
                     FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 5, 1,
@@ -1275,11 +1275,11 @@ DEFUN ("x-create-frame", Fx_create_frame, 
Sx_create_frame,
      variables; ignore them here.  */
   x_default_parameter (f, parms, Qmenu_bar_lines,
                       NILP (Vmenu_bar_mode)
-                      ? make_number (0) : make_number (1),
+                      ? make_fixnum (0) : make_fixnum (1),
                       NULL, NULL, RES_TYPE_NUMBER);
   x_default_parameter (f, parms, Qtool_bar_lines,
                       NILP (Vtool_bar_mode)
-                      ? make_number (0) : make_number (1),
+                      ? make_fixnum (0) : make_fixnum (1),
                       NULL, NULL, RES_TYPE_NUMBER);
 
   x_default_parameter (f, parms, Qbuffer_predicate, Qnil, "bufferPredicate",
@@ -1781,7 +1781,7 @@ DEFUN ("x-display-screens", Fx_display_screens, 
Sx_display_screens, 0, 1, 0,
   (Lisp_Object terminal)
 {
   check_ns_display_info (terminal);
-  return make_number (1);
+  return make_fixnum (1);
 }
 
 
@@ -1791,7 +1791,7 @@ DEFUN ("x-display-mm-height", Fx_display_mm_height, 
Sx_display_mm_height, 0, 1,
 {
   struct ns_display_info *dpyinfo = check_ns_display_info (terminal);
 
-  return make_number (x_display_pixel_height (dpyinfo) / (92.0/25.4));
+  return make_fixnum (x_display_pixel_height (dpyinfo) / (92.0/25.4));
 }
 
 
@@ -1801,7 +1801,7 @@ DEFUN ("x-display-mm-width", Fx_display_mm_width, 
Sx_display_mm_width, 0, 1, 0,
 {
   struct ns_display_info *dpyinfo = check_ns_display_info (terminal);
 
-  return make_number (x_display_pixel_width (dpyinfo) / (92.0/25.4));
+  return make_fixnum (x_display_pixel_width (dpyinfo) / (92.0/25.4));
 }
 
 
@@ -2135,7 +2135,7 @@ ns_do_applescript (Lisp_Object script, Lisp_Object 
*result)
              // coerce the result to the appropriate ObjC type
              desc = [returnDescriptor coerceToDescriptorType: typeUTF8Text];
              if (desc)
-               *result = make_number([desc int32Value]);
+               *result = make_fixnum([desc int32Value]);
             }
         }
     }
@@ -2362,7 +2362,7 @@ DEFUN ("x-display-pixel-width", Fx_display_pixel_width, 
Sx_display_pixel_width,
 {
   struct ns_display_info *dpyinfo = check_ns_display_info (terminal);
 
-  return make_number (x_display_pixel_width (dpyinfo));
+  return make_fixnum (x_display_pixel_width (dpyinfo));
 }
 
 
@@ -2373,7 +2373,7 @@ DEFUN ("x-display-pixel-height", Fx_display_pixel_height,
 {
   struct ns_display_info *dpyinfo = check_ns_display_info (terminal);
 
-  return make_number (x_display_pixel_height (dpyinfo));
+  return make_fixnum (x_display_pixel_height (dpyinfo));
 }
 
 #ifdef NS_IMPL_COCOA
@@ -2476,7 +2476,7 @@ ns_make_monitor_attribute_list (struct MonitorInfo 
*monitors,
                                 int primary_monitor,
                                 const char *source)
 {
-  Lisp_Object monitor_frames = Fmake_vector (make_number (n_monitors), Qnil);
+  Lisp_Object monitor_frames = Fmake_vector (make_fixnum (n_monitors), Qnil);
   Lisp_Object frame, rest;
   NSArray *screens = [NSScreen screens];
   int i;
@@ -2617,7 +2617,7 @@ DEFUN ("x-display-planes", Fx_display_planes, 
Sx_display_planes,
   (Lisp_Object terminal)
 {
   check_ns_display_info (terminal);
-  return make_number
+  return make_fixnum
     (NSBitsPerPixelFromDepth ([[[NSScreen screens] objectAtIndex:0] depth]));
 }
 
@@ -2629,7 +2629,7 @@ DEFUN ("x-display-color-cells", Fx_display_color_cells, 
Sx_display_color_cells,
 {
   struct ns_display_info *dpyinfo = check_ns_display_info (terminal);
   /* We force 24+ bit depths to 24-bit to prevent an overflow.  */
-  return make_number (1 << min (dpyinfo->n_planes, 24));
+  return make_fixnum (1 << min (dpyinfo->n_planes, 24));
 }
 
 /* TODO: move to xdisp or similar */
@@ -2653,15 +2653,15 @@ compute_tip_xy (struct frame *f,
   right = Fcdr (Fassq (Qright, parms));
   bottom = Fcdr (Fassq (Qbottom, parms));
 
-  if ((!INTEGERP (left) && !INTEGERP (right))
-      || (!INTEGERP (top) && !INTEGERP (bottom)))
+  if ((!FIXNUMP (left) && !FIXNUMP (right))
+      || (!FIXNUMP (top) && !FIXNUMP (bottom)))
     pt = [NSEvent mouseLocation];
   else
     {
       /* Absolute coordinates.  */
-      pt.x = INTEGERP (left) ? XINT (left) : XINT (right);
+      pt.x = FIXNUMP (left) ? XFIXNUM (left) : XFIXNUM (right);
       pt.y = (x_display_pixel_height (FRAME_DISPLAY_INFO (f))
-             - (INTEGERP (top) ? XINT (top) : XINT (bottom))
+             - (FIXNUMP (top) ? XFIXNUM (top) : XFIXNUM (bottom))
              - height);
     }
 
@@ -2681,30 +2681,30 @@ compute_tip_xy (struct frame *f,
      versions of macOS and in GNUstep.  */
 
   /* Ensure in bounds.  (Note, screen origin = lower left.) */
-  if (INTEGERP (left) || INTEGERP (right))
+  if (FIXNUMP (left) || FIXNUMP (right))
     *root_x = pt.x;
-  else if (pt.x + XINT (dx) <= screen.frame.origin.x)
+  else if (pt.x + XFIXNUM (dx) <= screen.frame.origin.x)
     *root_x = screen.frame.origin.x;
-  else if (pt.x + XINT (dx) + width
+  else if (pt.x + XFIXNUM (dx) + width
           <= screen.frame.origin.x + screen.frame.size.width)
     /* It fits to the right of the pointer.  */
-    *root_x = pt.x + XINT (dx);
-  else if (width + XINT (dx) <= pt.x)
+    *root_x = pt.x + XFIXNUM (dx);
+  else if (width + XFIXNUM (dx) <= pt.x)
     /* It fits to the left of the pointer.  */
-    *root_x = pt.x - width - XINT (dx);
+    *root_x = pt.x - width - XFIXNUM (dx);
   else
     /* Put it left justified on the screen -- it ought to fit that way.  */
     *root_x = screen.frame.origin.x;
 
-  if (INTEGERP (top) || INTEGERP (bottom))
+  if (FIXNUMP (top) || FIXNUMP (bottom))
     *root_y = pt.y;
-  else if (pt.y - XINT (dy) - height >= screen.frame.origin.y)
+  else if (pt.y - XFIXNUM (dy) - height >= screen.frame.origin.y)
     /* It fits below the pointer.  */
-    *root_y = pt.y - height - XINT (dy);
-  else if (pt.y + XINT (dy) + height
+    *root_y = pt.y - height - XFIXNUM (dy);
+  else if (pt.y + XFIXNUM (dy) + height
           <= screen.frame.origin.y + screen.frame.size.height)
     /* It fits above the pointer.  */
-      *root_y = pt.y + XINT (dy);
+      *root_y = pt.y + XFIXNUM (dy);
   else
     /* Put it on the top.  */
     *root_y = screen.frame.origin.y + screen.frame.size.height - height;
@@ -2729,19 +2729,19 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
   str = SSDATA (string);
   f = decode_window_system_frame (frame);
   if (NILP (timeout))
-    timeout = make_number (5);
+    timeout = make_fixnum (5);
   else
-    CHECK_NATNUM (timeout);
+    CHECK_FIXNAT (timeout);
 
   if (NILP (dx))
-    dx = make_number (5);
+    dx = make_fixnum (5);
   else
-    CHECK_NUMBER (dx);
+    CHECK_FIXNUM (dx);
 
   if (NILP (dy))
-    dy = make_number (-10);
+    dy = make_fixnum (-10);
   else
-    CHECK_NUMBER (dy);
+    CHECK_FIXNUM (dy);
 
   block_input ();
   if (ns_tooltip == nil)
@@ -2765,7 +2765,7 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
   compute_tip_xy (f, parms, dx, dy, (int)size.width, (int)size.height,
                  &root_x, &root_y);
 
-  [ns_tooltip showAtX: root_x Y: root_y for: XINT (timeout)];
+  [ns_tooltip showAtX: root_x Y: root_y for: XFIXNUM (timeout)];
   unblock_input ();
 
   return unbind_to (count, Qnil);
@@ -2812,44 +2812,44 @@ frame_geometry (Lisp_Object frame, Lisp_Object 
attribute)
 
   /* Construct list.  */
   if (EQ (attribute, Qouter_edges))
-    return list4 (make_number (f->left_pos), make_number (f->top_pos),
-                 make_number (f->left_pos + outer_width),
-                 make_number (f->top_pos + outer_height));
+    return list4 (make_fixnum (f->left_pos), make_fixnum (f->top_pos),
+                 make_fixnum (f->left_pos + outer_width),
+                 make_fixnum (f->top_pos + outer_height));
   else if (EQ (attribute, Qnative_edges))
-    return list4 (make_number (native_left), make_number (native_top),
-                 make_number (native_right), make_number (native_bottom));
+    return list4 (make_fixnum (native_left), make_fixnum (native_top),
+                 make_fixnum (native_right), make_fixnum (native_bottom));
   else if (EQ (attribute, Qinner_edges))
-    return list4 (make_number (native_left + internal_border_width),
-                 make_number (native_top
+    return list4 (make_fixnum (native_left + internal_border_width),
+                 make_fixnum (native_top
                               + tool_bar_height
                               + internal_border_width),
-                 make_number (native_right - internal_border_width),
-                 make_number (native_bottom - internal_border_width));
+                 make_fixnum (native_right - internal_border_width),
+                 make_fixnum (native_bottom - internal_border_width));
   else
     return
       listn (CONSTYPE_HEAP, 10,
             Fcons (Qouter_position,
-                   Fcons (make_number (f->left_pos),
-                          make_number (f->top_pos))),
+                   Fcons (make_fixnum (f->left_pos),
+                          make_fixnum (f->top_pos))),
             Fcons (Qouter_size,
-                   Fcons (make_number (outer_width),
-                          make_number (outer_height))),
+                   Fcons (make_fixnum (outer_width),
+                          make_fixnum (outer_height))),
             Fcons (Qexternal_border_size,
                    (fullscreen
-                    ? Fcons (make_number (0), make_number (0))
-                    : Fcons (make_number (border), make_number (border)))),
+                    ? Fcons (make_fixnum (0), make_fixnum (0))
+                    : Fcons (make_fixnum (border), make_fixnum (border)))),
             Fcons (Qtitle_bar_size,
-                   Fcons (make_number (0), make_number (title_height))),
+                   Fcons (make_fixnum (0), make_fixnum (title_height))),
             Fcons (Qmenu_bar_external, Qnil),
-            Fcons (Qmenu_bar_size, Fcons (make_number (0), make_number (0))),
+            Fcons (Qmenu_bar_size, Fcons (make_fixnum (0), make_fixnum (0))),
             Fcons (Qtool_bar_external,
                    FRAME_EXTERNAL_TOOL_BAR (f) ? Qt : Qnil),
             Fcons (Qtool_bar_position, FRAME_TOOL_BAR_POSITION (f)),
             Fcons (Qtool_bar_size,
-                   Fcons (make_number (tool_bar_width),
-                          make_number (tool_bar_height))),
+                   Fcons (make_fixnum (tool_bar_width),
+                          make_fixnum (tool_bar_height))),
             Fcons (Qinternal_border_width,
-                   make_number (internal_border_width)));
+                   make_fixnum (internal_border_width)));
 }
 
 DEFUN ("ns-frame-geometry", Fns_frame_geometry, Sns_frame_geometry, 0, 1, 0,
@@ -2947,13 +2947,13 @@ The coordinates X and Y are interpreted in pixels 
relative to a position
   CHECK_TYPE_RANGED_INTEGER (int, x);
   CHECK_TYPE_RANGED_INTEGER (int, y);
 
-  mouse_x = screen_frame.origin.x + XINT (x);
+  mouse_x = screen_frame.origin.x + XFIXNUM (x);
 
   if (screen == primary_screen)
-    mouse_y = screen_frame.origin.y + XINT (y);
+    mouse_y = screen_frame.origin.y + XFIXNUM (y);
   else
     mouse_y = (primary_screen_height - screen_frame.size.height
-               - screen_frame.origin.y) + XINT (y);
+               - screen_frame.origin.y) + XFIXNUM (y);
 
   CGPoint mouse_pos = CGPointMake(mouse_x, mouse_y);
   CGWarpMouseCursorPosition (mouse_pos);
@@ -2976,8 +2976,8 @@ position (0, 0) of the selected frame's terminal.  */)
   NSScreen *screen = [[view window] screen];
   NSPoint pt = [NSEvent mouseLocation];
 
-  return Fcons(make_number(pt.x - screen.frame.origin.x),
-               make_number(screen.frame.size.height -
+  return Fcons(make_fixnum(pt.x - screen.frame.origin.x),
+               make_fixnum(screen.frame.size.height -
                            (pt.y - screen.frame.origin.y)));
 }
 
diff --git a/src/nsfont.m b/src/nsfont.m
index 232e496..b1ebb53 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -186,24 +186,24 @@ ns_descriptor_to_entity (NSFontDescriptor *desc,
     FONT_SET_STYLE (font_entity, FONT_WEIGHT_INDEX,
                    traits & NSFontBoldTrait ? Qbold : Qmedium);
 /*    FONT_SET_STYLE (font_entity, FONT_WEIGHT_INDEX,
-                   make_number (100 + 100
+                   make_fixnum (100 + 100
                        * ns_attribute_fvalue (desc, NSFontWeightTrait)));*/
     FONT_SET_STYLE (font_entity, FONT_SLANT_INDEX,
                    traits & NSFontItalicTrait ? Qitalic : Qnormal);
 /*    FONT_SET_STYLE (font_entity, FONT_SLANT_INDEX,
-                   make_number (100 + 100
+                   make_fixnum (100 + 100
                         * ns_attribute_fvalue (desc, NSFontSlantTrait)));*/
     FONT_SET_STYLE (font_entity, FONT_WIDTH_INDEX,
                     traits & NSFontCondensedTrait ? Qcondensed :
                     traits & NSFontExpandedTrait ? Qexpanded : Qnormal);
 /*    FONT_SET_STYLE (font_entity, FONT_WIDTH_INDEX,
-                   make_number (100 + 100
+                   make_fixnum (100 + 100
                         * ns_attribute_fvalue (desc, NSFontWidthTrait)));*/
 
-    ASET (font_entity, FONT_SIZE_INDEX, make_number (0));
-    ASET (font_entity, FONT_AVGWIDTH_INDEX, make_number (0));
+    ASET (font_entity, FONT_SIZE_INDEX, make_fixnum (0));
+    ASET (font_entity, FONT_AVGWIDTH_INDEX, make_fixnum (0));
     ASET (font_entity, FONT_SPACING_INDEX,
-         make_number([desc symbolicTraits] & NSFontMonoSpaceTrait
+         make_fixnum([desc symbolicTraits] & NSFontMonoSpaceTrait
              ? FONT_SPACING_MONO : FONT_SPACING_PROPORTIONAL));
 
     ASET (font_entity, FONT_EXTRA_INDEX, extra);
@@ -445,8 +445,8 @@ static NSCharacterSet
          {
            for (; CONSP (range_list); range_list = XCDR (range_list))
              {
-               int start = XINT (XCAR (XCAR (range_list)));
-               int end = XINT (XCDR (XCAR (range_list)));
+               int start = XFIXNUM (XCAR (XCAR (range_list)));
+               int end = XFIXNUM (XCDR (XCAR (range_list)));
                if (NSFONT_TRACE)
                    debug_print (XCAR (range_list));
                if (end < 0x10000)
@@ -576,7 +576,7 @@ ns_findfonts (Lisp_Object font_spec, BOOL isMatch)
 
     /* Add synthItal member if needed.  */
     family = [fdesc objectForKey: NSFontFamilyAttribute];
-    if (family != nil && !foundItal && XINT (Flength (list)) > 0)
+    if (family != nil && !foundItal && XFIXNUM (Flength (list)) > 0)
       {
         NSFontDescriptor *s1 = [NSFontDescriptor new];
         NSFontDescriptor *sDesc
@@ -596,7 +596,7 @@ ns_findfonts (Lisp_Object font_spec, BOOL isMatch)
 
     if (NSFONT_TRACE)
        fprintf (stderr, "    Returning %"pI"d entities.\n",
-                 XINT (Flength (list)));
+                 XFIXNUM (Flength (list)));
 
     return list;
 }
@@ -668,7 +668,7 @@ nsfont_list_family (struct frame *f)
 
   if (NSFONT_TRACE)
     fprintf (stderr, "nsfont: list families returning %"pI"d entries\n",
-            XINT (Flength (list)));
+            XFIXNUM (Flength (list)));
 
   unblock_input ();
   return list;
@@ -705,7 +705,7 @@ nsfont_open (struct frame *f, Lisp_Object font_entity, int 
pixel_size)
     {
       /* try to get it out of frame params */
         Lisp_Object tem = get_frame_param (f, Qfontsize);
-        pixel_size = NILP (tem) ? 0 : XFASTINT (tem);
+        pixel_size = NILP (tem) ? 0 : XFIXNAT (tem);
     }
 
   tem = AREF (font_entity, FONT_ADSTYLE_INDEX);
diff --git a/src/nsimage.m b/src/nsimage.m
index 2cc205a..f657c49 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -85,10 +85,10 @@ ns_load_image (struct frame *f, struct image *img,
   eassert (valid_image_p (img->spec));
 
   lisp_index = Fplist_get (XCDR (img->spec), QCindex);
-  index = INTEGERP (lisp_index) ? XFASTINT (lisp_index) : 0;
+  index = FIXNUMP (lisp_index) ? XFIXNAT (lisp_index) : 0;
 
   lisp_rotation = Fplist_get (XCDR (img->spec), QCrotation);
-  rotation = NUMBERP (lisp_rotation) ? XFLOATINT (lisp_rotation) : 0;
+  rotation = FIXED_OR_FLOATP (lisp_rotation) ? XFLOATINT (lisp_rotation) : 0;
 
   if (STRINGP (spec_file))
     {
@@ -113,7 +113,7 @@ ns_load_image (struct frame *f, struct image *img,
   if (![eImg setFrame: index])
     {
       add_to_log ("Unable to set index %d for image %s",
-                  make_number (index), img->spec);
+                  make_fixnum (index), img->spec);
       return 0;
     }
 
@@ -495,7 +495,7 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
                       floatValue];
 
       if (frames > 1)
-        metadata = Fcons (Qcount, Fcons (make_number (frames), metadata));
+        metadata = Fcons (Qcount, Fcons (make_fixnum (frames), metadata));
       if (delay > 0)
         metadata = Fcons (Qdelay, Fcons (make_float (delay), metadata));
     }
@@ -532,19 +532,19 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
   double width = -1, height = -1, max_width = -1, max_height = -1;
 
   value = Fplist_get (spec, QCscale);
-  if (NUMBERP (value))
+  if (FIXED_OR_FLOATP (value))
     scale = XFLOATINT (value) ;
 
   value = Fplist_get (spec, QCmax_width);
-  if (NUMBERP (value))
+  if (FIXED_OR_FLOATP (value))
     max_width = XFLOATINT (value);
 
   value = Fplist_get (spec, QCmax_height);
-  if (NUMBERP (value))
+  if (FIXED_OR_FLOATP (value))
     max_height = XFLOATINT (value);
 
   value = Fplist_get (spec, QCwidth);
-  if (NUMBERP (value))
+  if (FIXED_OR_FLOATP (value))
     {
       width = XFLOATINT (value) * scale;
       /* :width overrides :max-width. */
@@ -552,7 +552,7 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
     }
 
   value = Fplist_get (spec, QCheight);
-  if (NUMBERP (value))
+  if (FIXED_OR_FLOATP (value))
     {
       height = XFLOATINT (value) * scale;
       /* :height overrides :max-height. */
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 18c3230..7010b77 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -377,7 +377,7 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu 
*submenu)
             {
              string = AREF (items, 4*i+1);
 
-              if (EQ (string, make_number (0))) // FIXME: Why???  --Stef
+              if (EQ (string, make_fixnum (0))) // FIXME: Why???  --Stef
                 continue;
               if (NILP (string))
                 {
diff --git a/src/nsselect.m b/src/nsselect.m
index e71a20e..35705bf 100644
--- a/src/nsselect.m
+++ b/src/nsselect.m
@@ -90,20 +90,20 @@ static Lisp_Object
 clean_local_selection_data (Lisp_Object obj)
 {
   if (CONSP (obj)
-      && INTEGERP (XCAR (obj))
+      && FIXNUMP (XCAR (obj))
       && CONSP (XCDR (obj))
-      && INTEGERP (XCAR (XCDR (obj)))
+      && FIXNUMP (XCAR (XCDR (obj)))
       && NILP (XCDR (XCDR (obj))))
     obj = Fcons (XCAR (obj), XCDR (obj));
 
   if (CONSP (obj)
-      && INTEGERP (XCAR (obj))
-      && INTEGERP (XCDR (obj)))
+      && FIXNUMP (XCAR (obj))
+      && FIXNUMP (XCDR (obj)))
     {
-      if (XINT (XCAR (obj)) == 0)
+      if (XFIXNUM (XCAR (obj)) == 0)
         return XCDR (obj);
-      if (XINT (XCAR (obj)) == -1)
-        return make_number (- XINT (XCDR (obj)));
+      if (XFIXNUM (XCAR (obj)) == -1)
+        return make_fixnum (- XFIXNUM (XCDR (obj)));
     }
 
   if (VECTORP (obj))
diff --git a/src/nsterm.m b/src/nsterm.m
index a15684d..90758d1 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1913,11 +1913,11 @@ x_set_window_size (struct frame *f,
 
  frame_size_history_add
    (f, Qx_set_window_size_1, width, height,
-    list5 (Fcons (make_number (pixelwidth), make_number (pixelheight)),
-          Fcons (make_number (wr.size.width), make_number (wr.size.height)),
-          make_number (f->border_width),
-          make_number (FRAME_NS_TITLEBAR_HEIGHT (f)),
-          make_number (FRAME_TOOLBAR_HEIGHT (f))));
+    list5 (Fcons (make_fixnum (pixelwidth), make_fixnum (pixelheight)),
+          Fcons (make_fixnum (wr.size.width), make_fixnum (wr.size.height)),
+          make_fixnum (f->border_width),
+          make_fixnum (FRAME_NS_TITLEBAR_HEIGHT (f)),
+          make_fixnum (FRAME_TOOLBAR_HEIGHT (f))));
 
   [window setFrame: wr display: YES];
 
@@ -2480,8 +2480,8 @@ x_set_frame_alpha (struct frame *f)
 
   if (FLOATP (Vframe_alpha_lower_limit))
     alpha_min = XFLOAT_DATA (Vframe_alpha_lower_limit);
-  else if (INTEGERP (Vframe_alpha_lower_limit))
-    alpha_min = (XINT (Vframe_alpha_lower_limit)) / 100.0;
+  else if (FIXNUMP (Vframe_alpha_lower_limit))
+    alpha_min = (XFIXNUM (Vframe_alpha_lower_limit)) / 100.0;
 
   if (alpha < 0.0)
     return;
@@ -3520,8 +3520,8 @@ ns_draw_text_decoration (struct glyph_string *s, struct 
face *face,
               BOOL underline_at_descent_line, 
use_underline_position_properties;
               Lisp_Object val = buffer_local_value (Qunderline_minimum_offset,
                                                     s->w->contents);
-              if (INTEGERP (val))
-                minimum_offset = XFASTINT (val);
+              if (FIXNUMP (val))
+                minimum_offset = XFIXNAT (val);
               else
                 minimum_offset = 1;
               val = buffer_local_value (Qx_underline_at_descent_line,
@@ -5342,7 +5342,7 @@ ns_term_init (Lisp_Object display_name)
           {
             color = XCAR (color_map);
             name = SSDATA (XCAR (color));
-            c = XINT (XCDR (color));
+            c = XFIXNUM (XCDR (color));
             [cl setColor:
                   [NSColor colorForEmacsRed: RED_FROM_ULONG (c) / 255.0
                                       green: GREEN_FROM_ULONG (c) / 255.0
@@ -6155,7 +6155,7 @@ not_in_argv (NSString *arg)
       emacs_event->code = KEY_NS_CHANGE_FONT;
 
       size = [newFont pointSize];
-      ns_input_fontsize = make_number (lrint (size));
+      ns_input_fontsize = make_fixnum (lrint (size));
       ns_input_font = build_string ([[newFont familyName] UTF8String]);
       EV_TRAILER (e);
     }
@@ -6234,7 +6234,7 @@ not_in_argv (NSString *arg)
 
   [NSCursor setHiddenUntilMouseMoves: YES];
 
-  if (hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight))
+  if (hlinfo->mouse_face_hidden && FIXNUMP (Vmouse_highlight))
     {
       clear_mouse_face (hlinfo);
       hlinfo->mouse_face_hidden = 1;
@@ -6684,8 +6684,8 @@ not_in_argv (NSString *arg)
               static int totalDeltaX, totalDeltaY;
               int lineHeight;
 
-              if (NUMBERP (ns_mwheel_line_height))
-                lineHeight = XINT (ns_mwheel_line_height);
+              if (FIXED_OR_FLOATP (ns_mwheel_line_height))
+                lineHeight = XFIXNUM (ns_mwheel_line_height);
               else
                 {
                   /* FIXME: Use actual line height instead of the default.  */
@@ -6754,7 +6754,7 @@ not_in_argv (NSString *arg)
             return;
 
           emacs_event->kind = horizontal ? HORIZ_WHEEL_EVENT : WHEEL_EVENT;
-          emacs_event->arg = (make_number (lines));
+          emacs_event->arg = (make_fixnum (lines));
 
           emacs_event->code = 0;
           emacs_event->modifiers = EV_MODIFIERS (theEvent) |
@@ -9341,11 +9341,11 @@ syms_of_nsterm (void)
   DEFSYM (Qfile, "file");
   DEFSYM (Qurl, "url");
 
-  Fput (Qalt, Qmodifier_value, make_number (alt_modifier));
-  Fput (Qhyper, Qmodifier_value, make_number (hyper_modifier));
-  Fput (Qmeta, Qmodifier_value, make_number (meta_modifier));
-  Fput (Qsuper, Qmodifier_value, make_number (super_modifier));
-  Fput (Qcontrol, Qmodifier_value, make_number (ctrl_modifier));
+  Fput (Qalt, Qmodifier_value, make_fixnum (alt_modifier));
+  Fput (Qhyper, Qmodifier_value, make_fixnum (hyper_modifier));
+  Fput (Qmeta, Qmodifier_value, make_fixnum (meta_modifier));
+  Fput (Qsuper, Qmodifier_value, make_fixnum (super_modifier));
+  Fput (Qcontrol, Qmodifier_value, make_fixnum (ctrl_modifier));
 
   DEFVAR_LISP ("ns-input-file", ns_input_file,
               "The file specified in the last NS event.");
diff --git a/src/print.c b/src/print.c
index 34c7fa1..824f8d7 100644
--- a/src/print.c
+++ b/src/print.c
@@ -266,7 +266,7 @@ printchar_to_stream (unsigned int ch, FILE *stream)
          break;
       if (! (i < n))
        break;
-      ch = XFASTINT (AREF (dv, i));
+      ch = XFIXNAT (AREF (dv, i));
     }
 }
 
@@ -279,7 +279,7 @@ static void
 printchar (unsigned int ch, Lisp_Object fun)
 {
   if (!NILP (fun) && !EQ (fun, Qt))
-    call1 (fun, make_number (ch));
+    call1 (fun, make_fixnum (ch));
   else
     {
       unsigned char str[MAX_MULTIBYTE_LENGTH];
@@ -525,9 +525,9 @@ PRINTCHARFUN defaults to the value of `standard-output' 
(which see).  */)
 {
   if (NILP (printcharfun))
     printcharfun = Vstandard_output;
-  CHECK_NUMBER (character);
+  CHECK_FIXNUM (character);
   PRINTPREPARE;
-  printchar (XINT (character), printcharfun);
+  printchar (XFIXNUM (character), printcharfun);
   PRINTFINISH;
   return character;
 }
@@ -776,8 +776,8 @@ You can call `print' while debugging emacs, and pass it 
this function
 to make it write to the debugging output.  */)
   (Lisp_Object character)
 {
-  CHECK_NUMBER (character);
-  printchar_to_stream (XINT (character), stderr);
+  CHECK_FIXNUM (character);
+  printchar_to_stream (XFIXNUM (character), stderr);
   return character;
 }
 
@@ -1208,11 +1208,11 @@ print_preprocess (Lisp_Object obj)
                  && SYMBOLP (obj)
                  && !SYMBOL_INTERNED_P (obj)))
            { /* OBJ appears more than once.    Let's remember that.  */
-             if (!INTEGERP (num))
+             if (!FIXNUMP (num))
                {
                  print_number_index++;
                  /* Negative number indicates it hasn't been printed yet.  */
-                 Fputhash (obj, make_number (- print_number_index),
+                 Fputhash (obj, make_fixnum (- print_number_index),
                            Vprint_number_table);
                }
              print_depth--;
@@ -1350,12 +1350,12 @@ print_prune_string_charset (Lisp_Object string)
        {
          if (NILP (print_prune_charset_plist))
            print_prune_charset_plist = list1 (Qcharset);
-         Fremove_text_properties (make_number (0),
-                                  make_number (SCHARS (string)),
+         Fremove_text_properties (make_fixnum (0),
+                                  make_fixnum (SCHARS (string)),
                                   print_prune_charset_plist, string);
        }
       else
-       Fset_text_properties (make_number (0), make_number (SCHARS (string)),
+       Fset_text_properties (make_fixnum (0), make_fixnum (SCHARS (string)),
                              Qnil, string);
     }
   return string;
@@ -1367,6 +1367,76 @@ print_vectorlike (Lisp_Object obj, Lisp_Object 
printcharfun, bool escapeflag,
 {
   switch (PSEUDOVECTOR_TYPE (XVECTOR (obj)))
     {
+    case PVEC_BIGNUM:
+      {
+       struct Lisp_Bignum *b = XBIGNUM (obj);
+       char *str = mpz_get_str (NULL, 10, b->value);
+       record_unwind_protect_ptr (xfree, str);
+       print_c_string (str, printcharfun);
+      }
+      break;
+
+    case PVEC_MARKER:
+      print_c_string ("#<marker ", printcharfun);
+      /* Do you think this is necessary?  */
+      if (XMARKER (obj)->insertion_type != 0)
+       print_c_string ("(moves after insertion) ", printcharfun);
+      if (! XMARKER (obj)->buffer)
+       print_c_string ("in no buffer", printcharfun);
+      else
+       {
+         int len = sprintf (buf, "at %"pD"d in ", marker_position (obj));
+         strout (buf, len, len, printcharfun);
+         print_string (BVAR (XMARKER (obj)->buffer, name), printcharfun);
+       }
+      printchar ('>', printcharfun);
+      break;
+
+    case PVEC_OVERLAY:
+      print_c_string ("#<overlay ", printcharfun);
+      if (! XMARKER (OVERLAY_START (obj))->buffer)
+       print_c_string ("in no buffer", printcharfun);
+      else
+       {
+         int len = sprintf (buf, "from %"pD"d to %"pD"d in ",
+                            marker_position (OVERLAY_START (obj)),
+                            marker_position (OVERLAY_END   (obj)));
+         strout (buf, len, len, printcharfun);
+         print_string (BVAR (XMARKER (OVERLAY_START (obj))->buffer, name),
+                       printcharfun);
+       }
+      printchar ('>', printcharfun);
+      break;
+
+#ifdef HAVE_MODULES
+    case PVEC_USER_PTR:
+      {
+       print_c_string ("#<user-ptr ", printcharfun);
+       int i = sprintf (buf, "ptr=%p finalizer=%p",
+                        XUSER_PTR (obj)->p,
+                        XUSER_PTR (obj)->finalizer);
+       strout (buf, i, i, printcharfun);
+       printchar ('>', printcharfun);
+      }
+      break;
+#endif
+
+    case PVEC_FINALIZER:
+      print_c_string ("#<finalizer", printcharfun);
+      if (NILP (XFINALIZER (obj)->function))
+       print_c_string (" used", printcharfun);
+      printchar ('>', printcharfun);
+      break;
+
+    case PVEC_MISC_PTR:
+      {
+       /* This shouldn't happen in normal usage, but let's
+          print it anyway for the benefit of the debugger.  */
+       int i = sprintf (buf, "#<ptr %p>", xmint_pointer (obj));
+       strout (buf, i, i, printcharfun);
+      }
+      break;
+
     case PVEC_PROCESS:
       if (escapeflag)
        {
@@ -1391,9 +1461,9 @@ print_vectorlike (Lisp_Object obj, Lisp_Object 
printcharfun, bool escapeflag,
        /* Don't print more bytes than the specified maximum.
           Negative values of print-length are invalid.  Treat them
           like a print-length of nil.  */
-       if (NATNUMP (Vprint_length)
-           && XFASTINT (Vprint_length) < size_in_bytes)
-         size_in_bytes = XFASTINT (Vprint_length);
+       if (FIXNATP (Vprint_length)
+           && XFIXNAT (Vprint_length) < size_in_bytes)
+         size_in_bytes = XFIXNAT (Vprint_length);
 
        for (ptrdiff_t i = 0; i < size_in_bytes; i++)
          {
@@ -1505,8 +1575,8 @@ print_vectorlike (Lisp_Object obj, Lisp_Object 
printcharfun, bool escapeflag,
        ptrdiff_t size = real_size;
 
        /* Don't print more elements than the specified maximum.  */
-       if (NATNUMP (Vprint_length) && XFASTINT (Vprint_length) < size)
-         size = XFASTINT (Vprint_length);
+       if (FIXNATP (Vprint_length) && XFIXNAT (Vprint_length) < size)
+         size = XFIXNAT (Vprint_length);
 
        printchar ('(', printcharfun);
        for (ptrdiff_t i = 0; i < size; i++)
@@ -1636,8 +1706,8 @@ print_vectorlike (Lisp_Object obj, Lisp_Object 
printcharfun, bool escapeflag,
 
        /* Don't print more elements than the specified maximum.  */
        ptrdiff_t n
-         = (NATNUMP (Vprint_length) && XFASTINT (Vprint_length) < size
-            ? XFASTINT (Vprint_length) : size);
+         = (FIXNATP (Vprint_length) && XFIXNAT (Vprint_length) < size
+            ? XFIXNAT (Vprint_length) : size);
 
        print_c_string ("#s(", printcharfun);
        for (ptrdiff_t i = 0; i < n; i ++)
@@ -1697,9 +1767,9 @@ print_vectorlike (Lisp_Object obj, Lisp_Object 
printcharfun, bool escapeflag,
          }
 
        /* Don't print more elements than the specified maximum.  */
-       if (NATNUMP (Vprint_length)
-           && XFASTINT (Vprint_length) < size)
-         size = XFASTINT (Vprint_length);
+       if (FIXNATP (Vprint_length)
+           && XFIXNAT (Vprint_length) < size)
+         size = XFIXNAT (Vprint_length);
 
        for (int i = idx; i < size; i++)
          {
@@ -1789,16 +1859,16 @@ print_object (Lisp_Object obj, Lisp_Object 
printcharfun, bool escapeflag)
     {
       /* With the print-circle feature.  */
       Lisp_Object num = Fgethash (obj, Vprint_number_table, Qnil);
-      if (INTEGERP (num))
+      if (FIXNUMP (num))
        {
-         EMACS_INT n = XINT (num);
+         EMACS_INT n = XFIXNUM (num);
          if (n < 0)
            { /* Add a prefix #n= if OBJ has not yet been printed;
                 that is, its status field is nil.  */
              int len = sprintf (buf, "#%"pI"d=", -n);
              strout (buf, len, len, printcharfun);
              /* OBJ is going to be printed.  Remember that fact.  */
-             Fputhash (obj, make_number (- n), Vprint_number_table);
+             Fputhash (obj, make_fixnum (- n), Vprint_number_table);
            }
          else
            {
@@ -1816,7 +1886,7 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, 
bool escapeflag)
     {
     case_Lisp_Int:
       {
-       int len = sprintf (buf, "%"pI"d", XINT (obj));
+       int len = sprintf (buf, "%"pI"d", XFIXNUM (obj));
        strout (buf, len, len, printcharfun);
       }
       break;
@@ -1991,8 +2061,8 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, 
bool escapeflag)
 
     case Lisp_Cons:
       /* If deeper than spec'd depth, print placeholder.  */
-      if (INTEGERP (Vprint_level)
-         && print_depth > XINT (Vprint_level))
+      if (FIXNUMP (Vprint_level)
+         && print_depth > XFIXNUM (Vprint_level))
        print_c_string ("...", printcharfun);
       else if (print_quoted && CONSP (XCDR (obj)) && NILP (XCDR (XCDR (obj)))
               && EQ (XCAR (obj), Qquote))
@@ -2033,8 +2103,8 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, 
bool escapeflag)
 
          /* Negative values of print-length are invalid in CL.
             Treat them like nil, as CMUCL does.  */
-         printmax_t print_length = (NATNUMP (Vprint_length)
-                                    ? XFASTINT (Vprint_length)
+         printmax_t print_length = (FIXNATP (Vprint_length)
+                                    ? XFIXNAT (Vprint_length)
                                     : TYPE_MAXIMUM (printmax_t));
 
          printmax_t i = 0;
@@ -2057,7 +2127,7 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, 
bool escapeflag)
                  if (i != 0)
                    {
                      Lisp_Object num = Fgethash (obj, Vprint_number_table, 
Qnil);
-                     if (INTEGERP (num))
+                     if (FIXNUMP (num))
                        {
                          print_c_string (" . ", printcharfun);
                          print_object (obj, printcharfun, escapeflag);
@@ -2096,94 +2166,16 @@ print_object (Lisp_Object obj, Lisp_Object 
printcharfun, bool escapeflag)
       break;
 
     case Lisp_Vectorlike:
-      if (! print_vectorlike (obj, printcharfun, escapeflag, buf))
-       goto badtype;
-      break;
-
-    case Lisp_Misc:
-      switch (XMISCTYPE (obj))
-       {
-       case Lisp_Misc_Marker:
-         print_c_string ("#<marker ", printcharfun);
-         /* Do you think this is necessary?  */
-         if (XMARKER (obj)->insertion_type != 0)
-           print_c_string ("(moves after insertion) ", printcharfun);
-         if (! XMARKER (obj)->buffer)
-           print_c_string ("in no buffer", printcharfun);
-         else
-           {
-             int len = sprintf (buf, "at %"pD"d in ", marker_position (obj));
-             strout (buf, len, len, printcharfun);
-             print_string (BVAR (XMARKER (obj)->buffer, name), printcharfun);
-           }
-         printchar ('>', printcharfun);
-         break;
-
-       case Lisp_Misc_Overlay:
-         print_c_string ("#<overlay ", printcharfun);
-         if (! XMARKER (OVERLAY_START (obj))->buffer)
-           print_c_string ("in no buffer", printcharfun);
-         else
-           {
-             int len = sprintf (buf, "from %"pD"d to %"pD"d in ",
-                                marker_position (OVERLAY_START (obj)),
-                                marker_position (OVERLAY_END   (obj)));
-             strout (buf, len, len, printcharfun);
-             print_string (BVAR (XMARKER (OVERLAY_START (obj))->buffer, name),
-                           printcharfun);
-           }
-         printchar ('>', printcharfun);
-          break;
-
-#ifdef HAVE_MODULES
-       case Lisp_Misc_User_Ptr:
-         {
-           print_c_string ("#<user-ptr ", printcharfun);
-           int i = sprintf (buf, "ptr=%p finalizer=%p",
-                            XUSER_PTR (obj)->p,
-                            XUSER_PTR (obj)->finalizer);
-           strout (buf, i, i, printcharfun);
-           printchar ('>', printcharfun);
-           break;
-         }
-#endif
-
-        case Lisp_Misc_Finalizer:
-          print_c_string ("#<finalizer", printcharfun);
-          if (NILP (XFINALIZER (obj)->function))
-            print_c_string (" used", printcharfun);
-         printchar ('>', printcharfun);
-          break;
-
-         /* Remaining cases shouldn't happen in normal usage, but let's
-            print them anyway for the benefit of the debugger.  */
-
-       case Lisp_Misc_Free:
-         print_c_string ("#<misc free cell>", printcharfun);
-         break;
-
-       case Lisp_Misc_Ptr:
-         {
-           int i = sprintf (buf, "#<ptr %p>", xmint_pointer (obj));
-           strout (buf, i, i, printcharfun);
-         }
-         break;
-
-       default:
-         goto badtype;
-       }
-      break;
-
+      if (print_vectorlike (obj, printcharfun, escapeflag, buf))
+       break;
+      FALLTHROUGH;
     default:
-    badtype:
       {
        int len;
        /* We're in trouble if this happens!
           Probably should just emacs_abort ().  */
        print_c_string ("#<EMACS BUG: INVALID DATATYPE ", printcharfun);
-       if (MISCP (obj))
-         len = sprintf (buf, "(MISC 0x%04x)", (unsigned) XMISCTYPE (obj));
-       else if (VECTORLIKEP (obj))
+       if (VECTORLIKEP (obj))
          len = sprintf (buf, "(PVEC 0x%08zx)", (size_t) ASIZE (obj));
        else
          len = sprintf (buf, "(0x%02x)", (unsigned) XTYPE (obj));
@@ -2207,9 +2199,9 @@ print_interval (INTERVAL interval, Lisp_Object 
printcharfun)
   if (NILP (interval->plist))
     return;
   printchar (' ', printcharfun);
-  print_object (make_number (interval->position), printcharfun, 1);
+  print_object (make_fixnum (interval->position), printcharfun, 1);
   printchar (' ', printcharfun);
-  print_object (make_number (interval->position + LENGTH (interval)),
+  print_object (make_fixnum (interval->position + LENGTH (interval)),
                printcharfun, 1);
   printchar (' ', printcharfun);
   print_object (interval->plist, printcharfun, 1);
diff --git a/src/process.c b/src/process.c
index aafb46c..a266da1 100644
--- a/src/process.c
+++ b/src/process.c
@@ -684,12 +684,12 @@ static Lisp_Object
 status_convert (int w)
 {
   if (WIFSTOPPED (w))
-    return Fcons (Qstop, Fcons (make_number (WSTOPSIG (w)), Qnil));
+    return Fcons (Qstop, Fcons (make_fixnum (WSTOPSIG (w)), Qnil));
   else if (WIFEXITED (w))
-    return Fcons (Qexit, Fcons (make_number (WEXITSTATUS (w)),
+    return Fcons (Qexit, Fcons (make_fixnum (WEXITSTATUS (w)),
                                WCOREDUMP (w) ? Qt : Qnil));
   else if (WIFSIGNALED (w))
-    return Fcons (Qsignal, Fcons (make_number (WTERMSIG (w)),
+    return Fcons (Qsignal, Fcons (make_fixnum (WTERMSIG (w)),
                                  WCOREDUMP (w) ? Qt : Qnil));
   else
     return Qrun;
@@ -718,7 +718,7 @@ decode_status (Lisp_Object l, Lisp_Object *symbol, 
Lisp_Object *code,
   if (SYMBOLP (l))
     {
       *symbol = l;
-      *code = make_number (0);
+      *code = make_fixnum (0);
       *coredump = 0;
     }
   else
@@ -747,7 +747,7 @@ status_message (struct Lisp_Process *p)
     {
       char const *signame;
       synchronize_system_messages_locale ();
-      signame = strsignal (XFASTINT (code));
+      signame = strsignal (XFIXNAT (code));
       if (signame == 0)
        string = build_string ("unknown");
       else
@@ -761,7 +761,7 @@ status_message (struct Lisp_Process *p)
          c1 = STRING_CHAR (SDATA (string));
          c2 = downcase (c1);
          if (c1 != c2)
-           Faset (string, make_number (0), make_number (c2));
+           Faset (string, make_fixnum (0), make_fixnum (c2));
        }
       AUTO_STRING (suffix, coredump ? " (core dumped)\n" : "\n");
       return concat2 (string, suffix);
@@ -769,10 +769,10 @@ status_message (struct Lisp_Process *p)
   else if (EQ (symbol, Qexit))
     {
       if (NETCONN1_P (p))
-       return build_string (XFASTINT (code) == 0
+       return build_string (XFIXNAT (code) == 0
                             ? "deleted\n"
                             : "connection broken by remote peer\n");
-      if (XFASTINT (code) == 0)
+      if (XFIXNAT (code) == 0)
        return build_string ("finished\n");
       AUTO_STRING (prefix, "exited abnormally with code ");
       string = Fnumber_to_string (code);
@@ -1064,7 +1064,7 @@ nil, indicating the current buffer's process.  */)
   p->raw_status_new = 0;
   if (NETCONN1_P (p) || SERIALCONN1_P (p) || PIPECONN1_P (p))
     {
-      pset_status (p, list2 (Qexit, make_number (0)));
+      pset_status (p, list2 (Qexit, make_fixnum (0)));
       p->tick = ++process_tick;
       status_notify (p, NULL);
       redisplay_preserve_echo_area (13);
@@ -1083,7 +1083,7 @@ nil, indicating the current buffer's process.  */)
            update_status (p);
          symbol = CONSP (p->status) ? XCAR (p->status) : p->status;
          if (! (EQ (symbol, Qsignal) || EQ (symbol, Qexit)))
-           pset_status (p, list2 (Qsignal, make_number (SIGKILL)));
+           pset_status (p, list2 (Qsignal, make_fixnum (SIGKILL)));
 
          p->tick = ++process_tick;
          status_notify (p, NULL);
@@ -1151,7 +1151,7 @@ If PROCESS has not yet exited or died, return 0.  */)
     update_status (XPROCESS (process));
   if (CONSP (XPROCESS (process)->status))
     return XCAR (XCDR (XPROCESS (process)->status));
-  return make_number (0);
+  return make_fixnum (0);
 }
 
 DEFUN ("process-id", Fprocess_id, Sprocess_id, 1, 1, 0,
@@ -1383,7 +1383,7 @@ nil otherwise.  */)
   if (NETCONN_P (process)
       || XPROCESS (process)->infd < 0
       || (set_window_size (XPROCESS (process)->infd,
-                          XINT (height), XINT (width))
+                          XFIXNUM (height), XFIXNUM (width))
          < 0))
     return Qnil;
   else
@@ -1584,12 +1584,12 @@ Return nil if format of ADDRESS is invalid.  */)
 
       for (i = 0; i < nargs; i++)
        {
-         if (! RANGED_INTEGERP (0, p->contents[i], 65535))
+         if (! RANGED_FIXNUMP (0, p->contents[i], 65535))
            return Qnil;
 
          if (nargs <= 5         /* IPv4 */
              && i < 4           /* host, not port */
-             && XINT (p->contents[i]) > 255)
+             && XFIXNUM (p->contents[i]) > 255)
            return Qnil;
 
          args[i + 1] = p->contents[i];
@@ -1789,7 +1789,7 @@ usage: (make-process &rest ARGS)  */)
       val = Vcoding_system_for_read;
     if (NILP (val))
       {
-       ptrdiff_t nargs2 = 3 + XINT (Flength (command));
+       ptrdiff_t nargs2 = 3 + XFIXNUM (Flength (command));
        Lisp_Object tem2;
        SAFE_ALLOCA_LISP (args2, nargs2);
        ptrdiff_t i = 0;
@@ -1819,7 +1819,7 @@ usage: (make-process &rest ARGS)  */)
       {
        if (EQ (coding_systems, Qt))
          {
-           ptrdiff_t nargs2 = 3 + XINT (Flength (command));
+           ptrdiff_t nargs2 = 3 + XFIXNUM (Flength (command));
            Lisp_Object tem2;
            SAFE_ALLOCA_LISP (args2, nargs2);
            ptrdiff_t i = 0;
@@ -1864,7 +1864,7 @@ usage: (make-process &rest ARGS)  */)
        {
          tem = Qnil;
          openp (Vexec_path, program, Vexec_suffixes, &tem,
-                make_number (X_OK), false);
+                make_fixnum (X_OK), false);
          if (NILP (tem))
            report_file_error ("Searching for program", program);
          tem = Fexpand_file_name (tem, Qnil);
@@ -2503,9 +2503,9 @@ conv_sockaddr_to_lisp (struct sockaddr *sa, ptrdiff_t len)
       {
        DECLARE_POINTER_ALIAS (sin, struct sockaddr_in, sa);
        len = sizeof (sin->sin_addr) + 1;
-       address = Fmake_vector (make_number (len), Qnil);
+       address = Fmake_vector (make_fixnum (len), Qnil);
        p = XVECTOR (address);
-       p->contents[--len] = make_number (ntohs (sin->sin_port));
+       p->contents[--len] = make_fixnum (ntohs (sin->sin_port));
        cp = (unsigned char *) &sin->sin_addr;
        break;
       }
@@ -2515,11 +2515,11 @@ conv_sockaddr_to_lisp (struct sockaddr *sa, ptrdiff_t 
len)
        DECLARE_POINTER_ALIAS (sin6, struct sockaddr_in6, sa);
        DECLARE_POINTER_ALIAS (ip6, uint16_t, &sin6->sin6_addr);
        len = sizeof (sin6->sin6_addr) / 2 + 1;
-       address = Fmake_vector (make_number (len), Qnil);
+       address = Fmake_vector (make_fixnum (len), Qnil);
        p = XVECTOR (address);
-       p->contents[--len] = make_number (ntohs (sin6->sin6_port));
+       p->contents[--len] = make_fixnum (ntohs (sin6->sin6_port));
        for (i = 0; i < len; i++)
-         p->contents[i] = make_number (ntohs (ip6[i]));
+         p->contents[i] = make_fixnum (ntohs (ip6[i]));
        return address;
       }
 #endif
@@ -2547,8 +2547,8 @@ conv_sockaddr_to_lisp (struct sockaddr *sa, ptrdiff_t len)
 #endif
     default:
       len -= offsetof (struct sockaddr, sa_family) + sizeof (sa->sa_family);
-      address = Fcons (make_number (sa->sa_family),
-                      Fmake_vector (make_number (len), Qnil));
+      address = Fcons (make_fixnum (sa->sa_family),
+                      Fmake_vector (make_fixnum (len), Qnil));
       p = XVECTOR (XCDR (address));
       cp = (unsigned char *) &sa->sa_family + sizeof (sa->sa_family);
       break;
@@ -2556,7 +2556,7 @@ conv_sockaddr_to_lisp (struct sockaddr *sa, ptrdiff_t len)
 
   i = 0;
   while (i < len)
-    p->contents[i++] = make_number (*cp++);
+    p->contents[i++] = make_fixnum (*cp++);
 
   return address;
 }
@@ -2566,8 +2566,8 @@ conv_sockaddr_to_lisp (struct sockaddr *sa, ptrdiff_t len)
 static Lisp_Object
 conv_addrinfo_to_lisp (struct addrinfo *res)
 {
-  Lisp_Object protocol = make_number (res->ai_protocol);
-  eassert (XINT (protocol) == res->ai_protocol);
+  Lisp_Object protocol = make_fixnum (res->ai_protocol);
+  eassert (XFIXNUM (protocol) == res->ai_protocol);
   return Fcons (protocol, conv_sockaddr_to_lisp (res->ai_addr, 
res->ai_addrlen));
 }
 
@@ -2602,14 +2602,14 @@ get_lisp_to_sockaddr_size (Lisp_Object address, int 
*familyp)
       return sizeof (struct sockaddr_un);
     }
 #endif
-  else if (CONSP (address) && TYPE_RANGED_INTEGERP (int, XCAR (address))
+  else if (CONSP (address) && TYPE_RANGED_FIXNUMP (int, XCAR (address))
           && VECTORP (XCDR (address)))
     {
       struct sockaddr *sa;
       p = XVECTOR (XCDR (address));
       if (MAX_ALLOCA - sizeof sa->sa_family < p->header.size)
        return 0;
-      *familyp = XINT (XCAR (address));
+      *familyp = XFIXNUM (XCAR (address));
       return p->header.size + sizeof (sa->sa_family);
     }
   return 0;
@@ -2639,7 +2639,7 @@ conv_lisp_to_sockaddr (int family, Lisp_Object address, 
struct sockaddr *sa, int
        {
          DECLARE_POINTER_ALIAS (sin, struct sockaddr_in, sa);
          len = sizeof (sin->sin_addr) + 1;
-         hostport = XINT (p->contents[--len]);
+         hostport = XFIXNUM (p->contents[--len]);
          sin->sin_port = htons (hostport);
          cp = (unsigned char *)&sin->sin_addr;
          sa->sa_family = family;
@@ -2650,12 +2650,12 @@ conv_lisp_to_sockaddr (int family, Lisp_Object address, 
struct sockaddr *sa, int
          DECLARE_POINTER_ALIAS (sin6, struct sockaddr_in6, sa);
          DECLARE_POINTER_ALIAS (ip6, uint16_t, &sin6->sin6_addr);
          len = sizeof (sin6->sin6_addr) / 2 + 1;
-         hostport = XINT (p->contents[--len]);
+         hostport = XFIXNUM (p->contents[--len]);
          sin6->sin6_port = htons (hostport);
          for (i = 0; i < len; i++)
-           if (INTEGERP (p->contents[i]))
+           if (FIXNUMP (p->contents[i]))
              {
-               int j = XFASTINT (p->contents[i]) & 0xffff;
+               int j = XFIXNAT (p->contents[i]) & 0xffff;
                ip6[i] = ntohs (j);
              }
          sa->sa_family = family;
@@ -2686,8 +2686,8 @@ conv_lisp_to_sockaddr (int family, Lisp_Object address, 
struct sockaddr *sa, int
     }
 
   for (i = 0; i < len; i++)
-    if (INTEGERP (p->contents[i]))
-      *cp++ = XFASTINT (p->contents[i]) & 0xff;
+    if (FIXNUMP (p->contents[i]))
+      *cp++ = XFIXNAT (p->contents[i]) & 0xff;
 }
 
 #ifdef DATAGRAM_SOCKETS
@@ -2818,8 +2818,8 @@ set_socket_option (int s, Lisp_Object opt, Lisp_Object 
val)
     case SOPT_INT:
       {
        int optval;
-       if (TYPE_RANGED_INTEGERP (int, val))
-         optval = XINT (val);
+       if (TYPE_RANGED_FIXNUMP (int, val))
+         optval = XFIXNUM (val);
        else
          error ("Bad option value for %s", name);
        ret = setsockopt (s, sopt->optlevel, sopt->optnum,
@@ -2857,8 +2857,8 @@ set_socket_option (int s, Lisp_Object opt, Lisp_Object 
val)
 
        linger.l_onoff = 1;
        linger.l_linger = 0;
-       if (TYPE_RANGED_INTEGERP (int, val))
-         linger.l_linger = XINT (val);
+       if (TYPE_RANGED_FIXNUMP (int, val))
+         linger.l_linger = XFIXNUM (val);
        else
          linger.l_onoff = NILP (val) ? 0 : 1;
        ret = setsockopt (s, sopt->optlevel, sopt->optnum,
@@ -3102,7 +3102,7 @@ usage:  (make-serial-process &rest ARGS)  */)
   if (NILP (Fplist_member (contact, QCspeed)))
     error (":speed not specified");
   if (!NILP (Fplist_get (contact, QCspeed)))
-    CHECK_NUMBER (Fplist_get (contact, QCspeed));
+    CHECK_FIXNUM (Fplist_get (contact, QCspeed));
 
   name = Fplist_get (contact, QCname);
   if (NILP (name))
@@ -3336,7 +3336,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object 
addrinfos,
   int family;
   struct sockaddr *sa = NULL;
   int ret;
-  ptrdiff_t addrlen;
+  ptrdiff_t addrlen UNINIT;
   struct Lisp_Process *p = XPROCESS (proc);
   Lisp_Object contact = p->childp;
   int optbits = 0;
@@ -3357,7 +3357,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object 
addrinfos,
     {
       Lisp_Object addrinfo = XCAR (addrinfos);
       addrinfos = XCDR (addrinfos);
-      int protocol = XINT (XCAR (addrinfo));
+      int protocol = XFIXNUM (XCAR (addrinfo));
       Lisp_Object ip_address = XCDR (addrinfo);
 
 #ifdef WINDOWSNT
@@ -3464,7 +3464,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object 
addrinfos,
              DECLARE_POINTER_ALIAS (psa1, struct sockaddr, &sa1);
              if (getsockname (s, psa1, &len1) == 0)
                {
-                 Lisp_Object service = make_number (ntohs (sa1.sin_port));
+                 Lisp_Object service = make_fixnum (ntohs (sa1.sin_port));
                  contact = Fplist_put (contact, QCservice, service);
                  /* Save the port number so that we can stash it in
                     the process object later.  */
@@ -3922,7 +3922,7 @@ usage: (make-network-process &rest ARGS)  */)
       if (!get_lisp_to_sockaddr_size (address, &family))
        error ("Malformed :address");
 
-      addrinfos = list1 (Fcons (make_number (any_protocol), address));
+      addrinfos = list1 (Fcons (make_fixnum (any_protocol), address));
       goto open_socket;
     }
 
@@ -3946,8 +3946,8 @@ usage: (make-network-process &rest ARGS)  */)
 #endif
   else if (EQ (tem, Qipv4))
     family = AF_INET;
-  else if (TYPE_RANGED_INTEGERP (int, tem))
-    family = XINT (tem);
+  else if (TYPE_RANGED_FIXNUMP (int, tem))
+    family = XFIXNUM (tem);
   else
     error ("Unknown address family");
 
@@ -3986,7 +3986,7 @@ usage: (make-network-process &rest ARGS)  */)
       CHECK_STRING (service);
       if (sizeof address_un.sun_path <= SBYTES (service))
        error ("Service name too long");
-      addrinfos = list1 (Fcons (make_number (any_protocol), service));
+      addrinfos = list1 (Fcons (make_fixnum (any_protocol), service));
       goto open_socket;
     }
 #endif
@@ -4013,10 +4013,10 @@ usage: (make-network-process &rest ARGS)  */)
          portstring = "0";
          portstringlen = 1;
        }
-      else if (INTEGERP (service))
+      else if (FIXNUMP (service))
        {
          portstring = portbuf;
-         portstringlen = sprintf (portbuf, "%"pI"d", XINT (service));
+         portstringlen = sprintf (portbuf, "%"pI"d", XFIXNUM (service));
        }
       else
        {
@@ -4101,8 +4101,8 @@ usage: (make-network-process &rest ARGS)  */)
 
   if (EQ (service, Qt))
     port = 0;
-  else if (INTEGERP (service))
-    port = XINT (service);
+  else if (FIXNUMP (service))
+    port = XFIXNUM (service);
   else
     {
       CHECK_STRING (service);
@@ -4175,8 +4175,8 @@ usage: (make-network-process &rest ARGS)  */)
 
   /* :server QLEN */
   p->is_server = !NILP (server);
-  if (TYPE_RANGED_INTEGERP (int, server))
-    p->backlog = XINT (server);
+  if (TYPE_RANGED_FIXNUMP (int, server))
+    p->backlog = XFIXNUM (server);
 
   /* :nowait BOOL */
   if (!p->is_server && socktype != SOCK_DGRAM && nowait)
@@ -4400,7 +4400,7 @@ network_interface_info (Lisp_Object ifname)
        {
          if (flags & 1)
            {
-             elt = Fcons (make_number (fnum), elt);
+             elt = Fcons (make_fixnum (fnum), elt);
            }
        }
     }
@@ -4411,21 +4411,21 @@ network_interface_info (Lisp_Object ifname)
 #if defined (SIOCGIFHWADDR) && defined (HAVE_STRUCT_IFREQ_IFR_HWADDR)
   if (ioctl (s, SIOCGIFHWADDR, &rq) == 0)
     {
-      Lisp_Object hwaddr = Fmake_vector (make_number (6), Qnil);
+      Lisp_Object hwaddr = Fmake_vector (make_fixnum (6), Qnil);
       register struct Lisp_Vector *p = XVECTOR (hwaddr);
       int n;
 
       any = 1;
       for (n = 0; n < 6; n++)
-       p->contents[n] = make_number (((unsigned char *)
+       p->contents[n] = make_fixnum (((unsigned char *)
                                       &rq.ifr_hwaddr.sa_data[0])
                                      [n]);
-      elt = Fcons (make_number (rq.ifr_hwaddr.sa_family), hwaddr);
+      elt = Fcons (make_fixnum (rq.ifr_hwaddr.sa_family), hwaddr);
     }
 #elif defined (HAVE_GETIFADDRS) && defined (LLADDR)
   if (getifaddrs (&ifap) != -1)
     {
-      Lisp_Object hwaddr = Fmake_vector (make_number (6), Qnil);
+      Lisp_Object hwaddr = Fmake_vector (make_fixnum (6), Qnil);
       register struct Lisp_Vector *p = XVECTOR (hwaddr);
       struct ifaddrs *it;
 
@@ -4442,9 +4442,9 @@ network_interface_info (Lisp_Object ifname)
 
           memcpy (linkaddr, LLADDR (sdl), sdl->sdl_alen);
           for (n = 0; n < 6; n++)
-            p->contents[n] = make_number (linkaddr[n]);
+            p->contents[n] = make_fixnum (linkaddr[n]);
 
-          elt = Fcons (make_number (it->ifa_addr->sa_family), hwaddr);
+          elt = Fcons (make_fixnum (it->ifa_addr->sa_family), hwaddr);
           break;
         }
     }
@@ -4630,13 +4630,13 @@ is nil, from any process) before the timeout expired.  
*/)
 
   if (!NILP (millisec))
     { /* Obsolete calling convention using integers rather than floats.  */
-      CHECK_NUMBER (millisec);
+      CHECK_FIXNUM (millisec);
       if (NILP (seconds))
-       seconds = make_float (XINT (millisec) / 1000.0);
+       seconds = make_float (XFIXNUM (millisec) / 1000.0);
       else
        {
-         CHECK_NUMBER (seconds);
-         seconds = make_float (XINT (millisec) / 1000.0 + XINT (seconds));
+         CHECK_FIXNUM (seconds);
+         seconds = make_float (XFIXNUM (millisec) / 1000.0 + XFIXNUM 
(seconds));
        }
     }
 
@@ -4645,11 +4645,11 @@ is nil, from any process) before the timeout expired.  
*/)
 
   if (!NILP (seconds))
     {
-      if (INTEGERP (seconds))
+      if (FIXNUMP (seconds))
        {
-         if (XINT (seconds) > 0)
+         if (XFIXNUM (seconds) > 0)
            {
-             secs = XINT (seconds);
+             secs = XFIXNUM (seconds);
              nsecs = 0;
            }
        }
@@ -4673,7 +4673,7 @@ is nil, from any process) before the timeout expired.  */)
                                   Qnil,
                                   !NILP (process) ? XPROCESS (process) : NULL,
                                   (NILP (just_this_one) ? 0
-                                   : !INTEGERP (just_this_one) ? 1 : -1))
+                                   : !FIXNUMP (just_this_one) ? 1 : -1))
       <= 0)
      ? Qnil : Qt);
 }
@@ -4702,7 +4702,7 @@ server_accept_connection (Lisp_Object server, int channel)
       if (!would_block (code) && !NILP (ps->log))
        call3 (ps->log, server, Qnil,
               concat3 (build_string ("accept failed with code"),
-                       Fnumber_to_string (make_number (code)),
+                       Fnumber_to_string (make_fixnum (code)),
                        build_string ("\n")));
       return;
     }
@@ -4730,9 +4730,9 @@ server_accept_connection (Lisp_Object server, int channel)
        args[nargs++] = procname_format_in;
        nargs++;
        unsigned char *ip = (unsigned char *)&saddr.in.sin_addr.s_addr;
-       service = make_number (ntohs (saddr.in.sin_port));
+       service = make_fixnum (ntohs (saddr.in.sin_port));
        for (int i = 0; i < 4; i++)
-         args[nargs++] = make_number (ip[i]);
+         args[nargs++] = make_fixnum (ip[i]);
        args[nargs++] = service;
       }
       break;
@@ -4743,9 +4743,9 @@ server_accept_connection (Lisp_Object server, int channel)
        args[nargs++] = procname_format_in6;
        nargs++;
        DECLARE_POINTER_ALIAS (ip6, uint16_t, &saddr.in6.sin6_addr);
-       service = make_number (ntohs (saddr.in.sin_port));
+       service = make_fixnum (ntohs (saddr.in.sin_port));
        for (int i = 0; i < 8; i++)
-         args[nargs++] = make_number (ip6[i]);
+         args[nargs++] = make_fixnum (ip6[i]);
        args[nargs++] = service;
       }
       break;
@@ -4754,7 +4754,7 @@ server_accept_connection (Lisp_Object server, int channel)
     default:
       args[nargs++] = procname_format_default;
       nargs++;
-      args[nargs++] = make_number (connect_counter);
+      args[nargs++] = make_fixnum (connect_counter);
       break;
     }
 
@@ -5676,7 +5676,7 @@ wait_reading_process_output (intmax_t time_limit, int 
nsecs, int read_kbd,
                  deactivate_process (proc);
                  if (EQ (XPROCESS (proc)->status, Qrun))
                    pset_status (XPROCESS (proc),
-                                list2 (Qexit, make_number (0)));
+                                list2 (Qexit, make_fixnum (0)));
                }
              else
                {
@@ -5687,7 +5687,7 @@ wait_reading_process_output (intmax_t time_limit, int 
nsecs, int read_kbd,
                    update_status (XPROCESS (proc));
                  if (EQ (XPROCESS (proc)->status, Qrun))
                    pset_status (XPROCESS (proc),
-                                list2 (Qexit, make_number (256)));
+                                list2 (Qexit, make_fixnum (256)));
                }
            }
          if (FD_ISSET (channel, &Writeok)
@@ -5739,7 +5739,7 @@ wait_reading_process_output (intmax_t time_limit, int 
nsecs, int read_kbd,
                  else
                    {
                      p->tick = ++process_tick;
-                     pset_status (p, list2 (Qfailed, make_number (xerrno)));
+                     pset_status (p, list2 (Qfailed, make_fixnum (xerrno)));
                    }
                  deactivate_process (proc);
                  if (!NILP (addrinfos))
@@ -5808,7 +5808,7 @@ read_process_output_error_handler (Lisp_Object error_val)
   cmd_error_internal (error_val, "error in process filter: ");
   Vinhibit_quit = Qt;
   update_echo_area ();
-  Fsleep_for (make_number (2), Qnil);
+  Fsleep_for (make_fixnum (2), Qnil);
   return Qt;
 }
 
@@ -6126,7 +6126,7 @@ Otherwise it discards the output.  */)
 
       /* If the restriction isn't what it should be, set it.  */
       if (old_begv != BEGV || old_zv != ZV)
-       Fnarrow_to_region (make_number (old_begv), make_number (old_zv));
+       Fnarrow_to_region (make_fixnum (old_begv), make_fixnum (old_zv));
 
       bset_read_only (current_buffer, old_read_only);
       SET_PT_BOTH (opoint, opoint_byte);
@@ -6173,7 +6173,7 @@ write_queue_push (struct Lisp_Process *p, Lisp_Object 
input_obj,
       obj = make_unibyte_string (buf, len);
     }
 
-  entry = Fcons (obj, Fcons (make_number (offset), make_number (len)));
+  entry = Fcons (obj, Fcons (make_fixnum (offset), make_fixnum (len)));
 
   if (front)
     pset_write_queue (p, Fcons (entry, p->write_queue));
@@ -6201,8 +6201,8 @@ write_queue_pop (struct Lisp_Process *p, Lisp_Object *obj,
   *obj = XCAR (entry);
   offset_length = XCDR (entry);
 
-  *len = XINT (XCDR (offset_length));
-  offset = XINT (XCAR (offset_length));
+  *len = XFIXNUM (XCDR (offset_length));
+  offset = XFIXNUM (XCAR (offset_length));
   *buf = SSDATA (*obj) + offset;
 
   return 1;
@@ -6420,7 +6420,7 @@ send_process (Lisp_Object proc, const char *buf, 
ptrdiff_t len,
              else if (errno == EPIPE)
                {
                  p->raw_status_new = 0;
-                 pset_status (p, list2 (Qexit, make_number (256)));
+                 pset_status (p, list2 (Qexit, make_fixnum (256)));
                  p->tick = ++process_tick;
                  deactivate_process (proc);
                  error ("process %s no longer connected to pipe; closed it",
@@ -6456,11 +6456,11 @@ set up yet, this function will block until socket setup 
has completed.  */)
 
   validate_region (&start, &end);
 
-  start_byte = CHAR_TO_BYTE (XINT (start));
-  end_byte = CHAR_TO_BYTE (XINT (end));
+  start_byte = CHAR_TO_BYTE (XFIXNUM (start));
+  end_byte = CHAR_TO_BYTE (XFIXNUM (end));
 
-  if (XINT (start) < GPT && XINT (end) > GPT)
-    move_gap_both (XINT (start), start_byte);
+  if (XFIXNUM (start) < GPT && XFIXNUM (end) > GPT)
+    move_gap_both (XFIXNUM (start), start_byte);
 
   if (NETCONN_P (proc))
     wait_while_connecting (proc);
@@ -6542,7 +6542,7 @@ process group.  */)
   if (gid == p->pid)
     return Qnil;
   if (gid != -1)
-    return make_number (gid);
+    return make_fixnum (gid);
   return Qt;
 }
 
@@ -6847,16 +6847,16 @@ SIGCODE may be an integer, or a symbol whose name is a 
signal name.  */)
     {
       Lisp_Object tem = Fget_process (process);
       if (NILP (tem))
-       tem = string_to_number (SSDATA (process), 10, S2N_OVERFLOW_TO_FLOAT);
+       tem = string_to_number (SSDATA (process), 10, 0);
       process = tem;
     }
-  else if (!NUMBERP (process))
+  else if (!FIXED_OR_FLOATP (process))
     process = get_process (process);
 
   if (NILP (process))
     return process;
 
-  if (NUMBERP (process))
+  if (FIXED_OR_FLOATP (process))
     CONS_TO_INTEGER (process, pid_t, pid);
   else
     {
@@ -6866,10 +6866,10 @@ SIGCODE may be an integer, or a symbol whose name is a 
signal name.  */)
        error ("Cannot signal process %s", SDATA (XPROCESS (process)->name));
     }
 
-  if (INTEGERP (sigcode))
+  if (FIXNUMP (sigcode))
     {
       CHECK_TYPE_RANGED_INTEGER (int, sigcode);
-      signo = XINT (sigcode);
+      signo = XFIXNUM (sigcode);
     }
   else
     {
@@ -6883,7 +6883,7 @@ SIGCODE may be an integer, or a symbol whose name is a 
signal name.  */)
        error ("Undefined signal name %s", name);
     }
 
-  return make_number (kill (pid, signo));
+  return make_fixnum (kill (pid, signo));
 }
 
 DEFUN ("process-send-eof", Fprocess_send_eof, Sprocess_send_eof, 0, 1, 0,
@@ -7053,11 +7053,11 @@ handle_child_signal (int sig)
       if (! CONSP (head))
        continue;
       xpid = XCAR (head);
-      if (all_pids_are_fixnums ? INTEGERP (xpid) : NUMBERP (xpid))
+      if (all_pids_are_fixnums ? FIXNUMP (xpid) : FIXED_OR_FLOATP (xpid))
        {
          pid_t deleted_pid;
-         if (INTEGERP (xpid))
-           deleted_pid = XINT (xpid);
+         if (FIXNUMP (xpid))
+           deleted_pid = XFIXNUM (xpid);
          else
            deleted_pid = XFLOAT_DATA (xpid);
          if (child_status_changed (deleted_pid, 0, 0))
@@ -7123,7 +7123,7 @@ exec_sentinel_error_handler (Lisp_Object error_val)
   cmd_error_internal (error_val, "error in process sentinel: ");
   Vinhibit_quit = Qt;
   update_echo_area ();
-  Fsleep_for (make_number (2), Qnil);
+  Fsleep_for (make_fixnum (2), Qnil);
   return Qt;
 }
 
diff --git a/src/profiler.c b/src/profiler.c
index 312574d..7330f88 100644
--- a/src/profiler.c
+++ b/src/profiler.c
@@ -55,7 +55,7 @@ make_log (EMACS_INT heap_size, EMACS_INT max_stack_depth)
   ptrdiff_t i = ASIZE (h->key_and_value) >> 1;
   while (i > 0)
     set_hash_key_slot (h, --i,
-                      Fmake_vector (make_number (max_stack_depth), Qnil));
+                      Fmake_vector (make_fixnum (max_stack_depth), Qnil));
   return log;
 }
 
@@ -80,12 +80,12 @@ static EMACS_INT approximate_median (log_t *log,
 {
   eassert (size > 0);
   if (size < 2)
-    return XINT (HASH_VALUE (log, start));
+    return XFIXNUM (HASH_VALUE (log, start));
   if (size < 3)
     /* Not an actual median, but better for our application than
        choosing either of the two numbers.  */
-    return ((XINT (HASH_VALUE (log, start))
-            + XINT (HASH_VALUE (log, start + 1)))
+    return ((XFIXNUM (HASH_VALUE (log, start))
+            + XFIXNUM (HASH_VALUE (log, start + 1)))
            / 2);
   else
     {
@@ -110,7 +110,7 @@ static void evict_lower_half (log_t *log)
   for (i = 0; i < size; i++)
     /* Evict not only values smaller but also values equal to the median,
        so as to make sure we evict something no matter what.  */
-    if (XINT (HASH_VALUE (log, i)) <= median)
+    if (XFIXNUM (HASH_VALUE (log, i)) <= median)
       {
        Lisp_Object key = HASH_KEY (log, i);
        { /* FIXME: we could make this more efficient.  */
@@ -156,15 +156,15 @@ record_backtrace (log_t *log, EMACS_INT count)
     ptrdiff_t j = hash_lookup (log, backtrace, &hash);
     if (j >= 0)
       {
-       EMACS_INT old_val = XINT (HASH_VALUE (log, j));
+       EMACS_INT old_val = XFIXNUM (HASH_VALUE (log, j));
        EMACS_INT new_val = saturated_add (old_val, count);
-       set_hash_value_slot (log, j, make_number (new_val));
+       set_hash_value_slot (log, j, make_fixnum (new_val));
       }
     else
       { /* BEWARE!  hash_put in general can allocate memory.
           But currently it only does that if log->next_free is -1.  */
        eassert (0 <= log->next_free);
-       ptrdiff_t j = hash_put (log, backtrace, make_number (count), hash);
+       ptrdiff_t j = hash_put (log, backtrace, make_fixnum (count), hash);
        /* Let's make sure we've put `backtrace' right where it
           already was to start with.  */
        eassert (index == j);
@@ -266,14 +266,14 @@ setup_cpu_timer (Lisp_Object sampling_interval)
   struct timespec interval;
   int billion = 1000000000;
 
-  if (! RANGED_INTEGERP (1, sampling_interval,
+  if (! RANGED_FIXNUMP (1, sampling_interval,
                         (TYPE_MAXIMUM (time_t) < EMACS_INT_MAX / billion
                          ? ((EMACS_INT) TYPE_MAXIMUM (time_t) * billion
                             + (billion - 1))
                          : EMACS_INT_MAX)))
     return -1;
 
-  current_sampling_interval = XINT (sampling_interval);
+  current_sampling_interval = XFIXNUM (sampling_interval);
   interval = make_timespec (current_sampling_interval / billion,
                            current_sampling_interval % billion);
   emacs_sigaction_init (&action, deliver_profiler_signal);
@@ -422,8 +422,8 @@ Before returning, a new log is allocated for future 
samples.  */)
   cpu_log = (profiler_cpu_running
             ? make_log (profiler_log_size, profiler_max_stack_depth)
             : Qnil);
-  Fputhash (Fmake_vector (make_number (1), QAutomatic_GC),
-           make_number (cpu_gc_count),
+  Fputhash (Fmake_vector (make_fixnum (1), QAutomatic_GC),
+           make_fixnum (cpu_gc_count),
            result);
   cpu_gc_count = 0;
   return result;
diff --git a/src/search.c b/src/search.c
index 4e5a253..f5c7719 100644
--- a/src/search.c
+++ b/src/search.c
@@ -402,8 +402,8 @@ string_match_1 (Lisp_Object regexp, Lisp_Object string, 
Lisp_Object start,
     {
       ptrdiff_t len = SCHARS (string);
 
-      CHECK_NUMBER (start);
-      pos = XINT (start);
+      CHECK_FIXNUM (start);
+      pos = XFIXNUM (start);
       if (pos < 0 && -pos <= len)
        pos = len + pos;
       else if (0 > pos || pos > len)
@@ -448,7 +448,7 @@ string_match_1 (Lisp_Object regexp, Lisp_Object string, 
Lisp_Object start,
            = string_byte_to_char (string, search_regs.end[i]);
        }
 
-  return make_number (string_byte_to_char (string, val));
+  return make_fixnum (string_byte_to_char (string, val));
 }
 
 DEFUN ("string-match", Fstring_match, Sstring_match, 2, 3, 0,
@@ -1038,8 +1038,8 @@ search_command (Lisp_Object string, Lisp_Object bound, 
Lisp_Object noerror,
 
   if (!NILP (count))
     {
-      CHECK_NUMBER (count);
-      n *= XINT (count);
+      CHECK_FIXNUM (count);
+      n *= XFIXNUM (count);
     }
 
   CHECK_STRING (string);
@@ -1052,8 +1052,8 @@ search_command (Lisp_Object string, Lisp_Object bound, 
Lisp_Object noerror,
     }
   else
     {
-      CHECK_NUMBER_COERCE_MARKER (bound);
-      lim = XINT (bound);
+      CHECK_FIXNUM_COERCE_MARKER (bound);
+      lim = XFIXNUM (bound);
       if (n > 0 ? lim < PT : lim > PT)
        error ("Invalid search bound (wrong side of point)");
       if (lim > ZV)
@@ -1099,7 +1099,7 @@ search_command (Lisp_Object string, Lisp_Object bound, 
Lisp_Object noerror,
   eassert (BEGV <= np && np <= ZV);
   SET_PT (np);
 
-  return make_number (np);
+  return make_fixnum (np);
 }
 
 /* Return true if REGEXP it matches just one constant string.  */
@@ -1154,9 +1154,9 @@ do                                                \
     if (! NILP (trt))                          \
       {                                                \
        Lisp_Object temp;                       \
-       temp = Faref (trt, make_number (d));    \
-       if (INTEGERP (temp))                    \
-         out = XINT (temp);                    \
+       temp = Faref (trt, make_fixnum (d));    \
+       if (FIXNUMP (temp))                     \
+         out = XFIXNUM (temp);                 \
        else                                    \
          out = d;                              \
       }                                                \
@@ -2423,10 +2423,10 @@ since only regular expressions have distinguished 
subexpressions.  */)
     sub = 0;
   else
     {
-      CHECK_NUMBER (subexp);
-      if (! (0 <= XINT (subexp) && XINT (subexp) < search_regs.num_regs))
-       args_out_of_range (subexp, make_number (search_regs.num_regs));
-      sub = XINT (subexp);
+      CHECK_FIXNUM (subexp);
+      if (! (0 <= XFIXNUM (subexp) && XFIXNUM (subexp) < search_regs.num_regs))
+       args_out_of_range (subexp, make_fixnum (search_regs.num_regs));
+      sub = XFIXNUM (subexp);
     }
 
   if (NILP (string))
@@ -2434,16 +2434,16 @@ since only regular expressions have distinguished 
subexpressions.  */)
       if (search_regs.start[sub] < BEGV
          || search_regs.start[sub] > search_regs.end[sub]
          || search_regs.end[sub] > ZV)
-       args_out_of_range (make_number (search_regs.start[sub]),
-                          make_number (search_regs.end[sub]));
+       args_out_of_range (make_fixnum (search_regs.start[sub]),
+                          make_fixnum (search_regs.end[sub]));
     }
   else
     {
       if (search_regs.start[sub] < 0
          || search_regs.start[sub] > search_regs.end[sub]
          || search_regs.end[sub] > SCHARS (string))
-       args_out_of_range (make_number (search_regs.start[sub]),
-                          make_number (search_regs.end[sub]));
+       args_out_of_range (make_fixnum (search_regs.start[sub]),
+                          make_fixnum (search_regs.end[sub]));
     }
 
   if (NILP (fixedcase))
@@ -2528,9 +2528,9 @@ since only regular expressions have distinguished 
subexpressions.  */)
     {
       Lisp_Object before, after;
 
-      before = Fsubstring (string, make_number (0),
-                          make_number (search_regs.start[sub]));
-      after = Fsubstring (string, make_number (search_regs.end[sub]), Qnil);
+      before = Fsubstring (string, make_fixnum (0),
+                          make_fixnum (search_regs.start[sub]));
+      after = Fsubstring (string, make_fixnum (search_regs.end[sub]), Qnil);
 
       /* Substitute parts of the match into NEWTEXT
         if desired.  */
@@ -2593,8 +2593,8 @@ since only regular expressions have distinguished 
subexpressions.  */)
                    middle = Qnil;
                  accum = concat3 (accum, middle,
                                   Fsubstring (string,
-                                              make_number (substart),
-                                              make_number (subend)));
+                                              make_fixnum (substart),
+                                              make_fixnum (subend)));
                  lastpos = pos;
                  lastpos_byte = pos_byte;
                }
@@ -2783,12 +2783,12 @@ since only regular expressions have distinguished 
subexpressions.  */)
   }
 
   if (case_action == all_caps)
-    Fupcase_region (make_number (search_regs.start[sub]),
-                   make_number (newpoint),
+    Fupcase_region (make_fixnum (search_regs.start[sub]),
+                   make_fixnum (newpoint),
                    Qnil);
   else if (case_action == cap_initial)
-    Fupcase_initials_region (make_number (search_regs.start[sub]),
-                            make_number (newpoint));
+    Fupcase_initials_region (make_fixnum (search_regs.start[sub]),
+                            make_fixnum (newpoint));
 
   if (search_regs.start[sub] != sub_start
       || search_regs.end[sub] != sub_end
@@ -2812,16 +2812,16 @@ match_limit (Lisp_Object num, bool beginningp)
 {
   EMACS_INT n;
 
-  CHECK_NUMBER (num);
-  n = XINT (num);
+  CHECK_FIXNUM (num);
+  n = XFIXNUM (num);
   if (n < 0)
-    args_out_of_range (num, make_number (0));
+    args_out_of_range (num, make_fixnum (0));
   if (search_regs.num_regs <= 0)
     error ("No match data, because no search succeeded");
   if (n >= search_regs.num_regs
       || search_regs.start[n] < 0)
     return Qnil;
-  return (make_number ((beginningp) ? search_regs.start[n]
+  return (make_fixnum ((beginningp) ? search_regs.start[n]
                                    : search_regs.end[n]));
 }
 
@@ -2911,11 +2911,11 @@ Return value is undefined if the last search failed.  
*/)
            {
              data[2 * i] = Fmake_marker ();
              Fset_marker (data[2 * i],
-                          make_number (start),
+                          make_fixnum (start),
                           last_thing_searched);
              data[2 * i + 1] = Fmake_marker ();
              Fset_marker (data[2 * i + 1],
-                          make_number (search_regs.end[i]),
+                          make_fixnum (search_regs.end[i]),
                           last_thing_searched);
            }
          else
@@ -2992,7 +2992,7 @@ If optional arg RESEAT is non-nil, make markers on LIST 
point nowhere.  */)
 
   /* Allocate registers if they don't already exist.  */
   {
-    EMACS_INT length = XFASTINT (Flength (list)) / 2;
+    EMACS_INT length = XFIXNAT (Flength (list)) / 2;
 
     if (length > search_regs.num_regs)
       {
@@ -3040,7 +3040,7 @@ If optional arg RESEAT is non-nil, make markers on LIST 
point nowhere.  */)
                  XSETBUFFER (last_thing_searched, XMARKER (marker)->buffer);
              }
 
-           CHECK_NUMBER_COERCE_MARKER (marker);
+           CHECK_FIXNUM_COERCE_MARKER (marker);
            from = marker;
 
            if (!NILP (reseat) && MARKERP (m))
@@ -3057,13 +3057,13 @@ If optional arg RESEAT is non-nil, make markers on LIST 
point nowhere.  */)
            if (MARKERP (marker) && XMARKER (marker)->buffer == 0)
              XSETFASTINT (marker, 0);
 
-           CHECK_NUMBER_COERCE_MARKER (marker);
-           if (PTRDIFF_MIN <= XINT (from) && XINT (from) <= PTRDIFF_MAX
-               && PTRDIFF_MIN <= XINT (marker)
-               && XINT (marker) <= PTRDIFF_MAX)
+           CHECK_FIXNUM_COERCE_MARKER (marker);
+           if (PTRDIFF_MIN <= XFIXNUM (from) && XFIXNUM (from) <= PTRDIFF_MAX
+               && PTRDIFF_MIN <= XFIXNUM (marker)
+               && XFIXNUM (marker) <= PTRDIFF_MAX)
              {
-               search_regs.start[i] = XINT (from);
-               search_regs.end[i] = XINT (marker);
+               search_regs.start[i] = XFIXNUM (from);
+               search_regs.end[i] = XFIXNUM (marker);
              }
            else
              {
@@ -3349,11 +3349,11 @@ the buffer.  If the buffer doesn't have a cache, the 
value is nil.  */)
                                NULL, true);
          if (shortage != 0 || i >= nl_count_cache)
            break;
-         ASET (cache_newlines, i, make_number (found - 1));
+         ASET (cache_newlines, i, make_fixnum (found - 1));
        }
       /* Fill the rest of slots with an invalid position.  */
       for ( ; i < nl_count_cache; i++)
-       ASET (cache_newlines, i, make_number (-1));
+       ASET (cache_newlines, i, make_fixnum (-1));
     }
 
   /* Now do the same, but without using the cache.  */
@@ -3371,10 +3371,10 @@ the buffer.  If the buffer doesn't have a cache, the 
value is nil.  */)
                                 NULL, true);
          if (shortage != 0 || i >= nl_count_buf)
            break;
-         ASET (buf_newlines, i, make_number (found - 1));
+         ASET (buf_newlines, i, make_fixnum (found - 1));
        }
       for ( ; i < nl_count_buf; i++)
-       ASET (buf_newlines, i, make_number (-1));
+       ASET (buf_newlines, i, make_fixnum (-1));
     }
 
   /* Construct the value and return it.  */
diff --git a/src/sound.c b/src/sound.c
index b149acd..6f15f5d 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -385,9 +385,9 @@ parse_sound (Lisp_Object sound, Lisp_Object *attrs)
   /* Volume must be in the range 0..100 or unspecified.  */
   if (!NILP (attrs[SOUND_VOLUME]))
     {
-      if (INTEGERP (attrs[SOUND_VOLUME]))
+      if (FIXNUMP (attrs[SOUND_VOLUME]))
        {
-         EMACS_INT volume = XINT (attrs[SOUND_VOLUME]);
+         EMACS_INT volume = XFIXNUM (attrs[SOUND_VOLUME]);
          if (! (0 <= volume && volume <= 100))
            return 0;
        }
@@ -1400,8 +1400,8 @@ Internal use only, use `play-sound' instead.  */)
   /* Set up a device.  */
   current_sound_device->file = attrs[SOUND_DEVICE];
 
-  if (INTEGERP (attrs[SOUND_VOLUME]))
-    current_sound_device->volume = XFASTINT (attrs[SOUND_VOLUME]);
+  if (FIXNUMP (attrs[SOUND_VOLUME]))
+    current_sound_device->volume = XFIXNAT (attrs[SOUND_VOLUME]);
   else if (FLOATP (attrs[SOUND_VOLUME]))
     current_sound_device->volume = XFLOAT_DATA (attrs[SOUND_VOLUME]) * 100;
 
@@ -1423,9 +1423,9 @@ Internal use only, use `play-sound' instead.  */)
 
   file = Fexpand_file_name (attrs[SOUND_FILE], Vdata_directory);
   file = ENCODE_FILE (file);
-  if (INTEGERP (attrs[SOUND_VOLUME]))
+  if (FIXNUMP (attrs[SOUND_VOLUME]))
     {
-      ui_volume_tmp = XFASTINT (attrs[SOUND_VOLUME]);
+      ui_volume_tmp = XFIXNAT (attrs[SOUND_VOLUME]);
     }
   else if (FLOATP (attrs[SOUND_VOLUME]))
     {
diff --git a/src/syntax.c b/src/syntax.c
index 2f9fd05..a9bc36a 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -491,7 +491,7 @@ parse_sexp_propertize (ptrdiff_t charpos)
     {
       EMACS_INT modiffs = CHARS_MODIFF;
       safe_call1 (Qinternal__syntax_propertize,
-                 make_number (min (zv, 1 + charpos)));
+                 make_fixnum (min (zv, 1 + charpos)));
       if (modiffs != CHARS_MODIFF)
        error ("parse-sexp-propertize-function modified the buffer!");
       if (syntax_propertize__done <= charpos
@@ -609,14 +609,14 @@ find_defun_start (ptrdiff_t pos, ptrdiff_t pos_byte)
   if (!NILP (Vcomment_use_syntax_ppss))
     {
       EMACS_INT modiffs = CHARS_MODIFF;
-      Lisp_Object ppss = call1 (Qsyntax_ppss, make_number (pos));
+      Lisp_Object ppss = call1 (Qsyntax_ppss, make_fixnum (pos));
       if (modiffs != CHARS_MODIFF)
        error ("syntax-ppss modified the buffer!");
       TEMP_SET_PT_BOTH (opoint, opoint_byte);
-      Lisp_Object boc = Fnth (make_number (8), ppss);
-      if (NUMBERP (boc))
+      Lisp_Object boc = Fnth (make_fixnum (8), ppss);
+      if (FIXED_OR_FLOATP (boc))
         {
-          find_start_value = XINT (boc);
+          find_start_value = XFIXNUM (boc);
           find_start_value_byte = CHAR_TO_BYTE (find_start_value);
         }
       else
@@ -953,7 +953,7 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, 
ptrdiff_t stop,
            {
              adjusted = true;
              find_start_value
-               = CONSP (state.levelstarts) ? XINT (XCAR (state.levelstarts))
+               = CONSP (state.levelstarts) ? XFIXNUM (XCAR (state.levelstarts))
                : state.thislevelstart >= 0 ? state.thislevelstart
                : find_start_value;
              find_start_value_byte = CHAR_TO_BYTE (find_start_value);
@@ -1119,9 +1119,9 @@ this is probably the wrong function to use, because it 
can't take
 {
   int char_int;
   CHECK_CHARACTER (character);
-  char_int = XINT (character);
+  char_int = XFIXNUM (character);
   SETUP_BUFFER_SYNTAX_TABLE ();
-  return make_number (syntax_code_spec[SYNTAX (char_int)]);
+  return make_fixnum (syntax_code_spec[SYNTAX (char_int)]);
 }
 
 DEFUN ("matching-paren", Fmatching_paren, Smatching_paren, 1, 1, 0,
@@ -1131,7 +1131,7 @@ DEFUN ("matching-paren", Fmatching_paren, 
Smatching_paren, 1, 1, 0,
   int char_int;
   enum syntaxcode code;
   CHECK_CHARACTER (character);
-  char_int = XINT (character);
+  char_int = XFIXNUM (character);
   SETUP_BUFFER_SYNTAX_TABLE ();
   code = SYNTAX (char_int);
   if (code == Sopen || code == Sclose)
@@ -1166,7 +1166,7 @@ the value of a `syntax-table' text property.  */)
       int len;
       int character = STRING_CHAR_AND_LENGTH (p, len);
       XSETINT (match, character);
-      if (XFASTINT (match) == ' ')
+      if (XFIXNAT (match) == ' ')
        match = Qnil;
       p += len;
     }
@@ -1213,7 +1213,7 @@ the value of a `syntax-table' text property.  */)
     return AREF (Vsyntax_code_object, val);
   else
     /* Since we can't use a shared object, let's make a new one.  */
-    return Fcons (make_number (val), match);
+    return Fcons (make_fixnum (val), match);
 }
 
 /* I really don't know why this is interactive
@@ -1278,7 +1278,7 @@ usage: (modify-syntax-entry CHAR NEWENTRY &optional 
SYNTAX-TABLE)  */)
   if (CONSP (c))
     SET_RAW_SYNTAX_ENTRY_RANGE (syntax_table, c, newentry);
   else
-    SET_RAW_SYNTAX_ENTRY (syntax_table, XINT (c), newentry);
+    SET_RAW_SYNTAX_ENTRY (syntax_table, XFIXNUM (c), newentry);
 
   /* We clear the regexp cache, since character classes can now have
      different values from those in the compiled regexps.*/
@@ -1320,13 +1320,13 @@ DEFUN ("internal-describe-syntax-value", 
Finternal_describe_syntax_value,
   first = XCAR (value);
   match_lisp = XCDR (value);
 
-  if (!INTEGERP (first) || !(NILP (match_lisp) || CHARACTERP (match_lisp)))
+  if (!FIXNUMP (first) || !(NILP (match_lisp) || CHARACTERP (match_lisp)))
     {
       insert_string ("invalid");
       return syntax;
     }
 
-  syntax_code = XINT (first) & INT_MAX;
+  syntax_code = XFIXNUM (first) & INT_MAX;
   code = syntax_code & 0377;
   start1 = SYNTAX_FLAGS_COMSTART_FIRST (syntax_code);
   start2 = SYNTAX_FLAGS_COMSTART_SECOND (syntax_code);
@@ -1349,7 +1349,7 @@ DEFUN ("internal-describe-syntax-value", 
Finternal_describe_syntax_value,
   if (NILP (match_lisp))
     insert (" ", 1);
   else
-    insert_char (XINT (match_lisp));
+    insert_char (XFIXNUM (match_lisp));
 
   if (start1)
     insert ("1", 1);
@@ -1414,7 +1414,7 @@ DEFUN ("internal-describe-syntax-value", 
Finternal_describe_syntax_value,
   if (!NILP (match_lisp))
     {
       insert_string (", matches ");
-      insert_char (XINT (match_lisp));
+      insert_char (XFIXNUM (match_lisp));
     }
 
   if (start1)
@@ -1481,10 +1481,10 @@ scan_words (ptrdiff_t from, EMACS_INT count)
       func = CHAR_TABLE_REF (Vfind_word_boundary_function_table, ch0);
       if (! NILP (Ffboundp (func)))
        {
-         pos = call2 (func, make_number (from - 1), make_number (end));
-         if (INTEGERP (pos) && from < XINT (pos) && XINT (pos) <= ZV)
+         pos = call2 (func, make_fixnum (from - 1), make_fixnum (end));
+         if (FIXNUMP (pos) && from < XFIXNUM (pos) && XFIXNUM (pos) <= ZV)
            {
-             from = XINT (pos);
+             from = XFIXNUM (pos);
              from_byte = CHAR_TO_BYTE (from);
            }
        }
@@ -1530,10 +1530,10 @@ scan_words (ptrdiff_t from, EMACS_INT count)
       func = CHAR_TABLE_REF (Vfind_word_boundary_function_table, ch1);
       if (! NILP (Ffboundp (func)))
        {
-         pos = call2 (func, make_number (from), make_number (beg));
-         if (INTEGERP (pos) && BEGV <= XINT (pos) && XINT (pos) < from)
+         pos = call2 (func, make_fixnum (from), make_fixnum (beg));
+         if (FIXNUMP (pos) && BEGV <= XFIXNUM (pos) && XFIXNUM (pos) < from)
            {
-             from = XINT (pos);
+             from = XFIXNUM (pos);
              from_byte = CHAR_TO_BYTE (from);
            }
        }
@@ -1587,16 +1587,16 @@ instead.  See Info node `(elisp) Word Motion' for 
details.  */)
   if (NILP (arg))
     XSETFASTINT (arg, 1);
   else
-    CHECK_NUMBER (arg);
+    CHECK_FIXNUM (arg);
 
-  val = orig_val = scan_words (PT, XINT (arg));
+  val = orig_val = scan_words (PT, XFIXNUM (arg));
   if (! orig_val)
-    val = XINT (arg) > 0 ? ZV : BEGV;
+    val = XFIXNUM (arg) > 0 ? ZV : BEGV;
 
   /* Avoid jumping out of an input field.  */
-  tmp = Fconstrain_to_field (make_number (val), make_number (PT),
+  tmp = Fconstrain_to_field (make_fixnum (val), make_fixnum (PT),
                             Qnil, Qnil, Qnil);
-  val = XFASTINT (tmp);
+  val = XFIXNAT (tmp);
 
   SET_PT (val);
   return val == orig_val ? Qt : Qnil;
@@ -1677,16 +1677,16 @@ skip_chars (bool forwardp, Lisp_Object string, 
Lisp_Object lim,
   if (NILP (lim))
     XSETINT (lim, forwardp ? ZV : BEGV);
   else
-    CHECK_NUMBER_COERCE_MARKER (lim);
+    CHECK_FIXNUM_COERCE_MARKER (lim);
 
   /* In any case, don't allow scan outside bounds of buffer.  */
-  if (XINT (lim) > ZV)
+  if (XFIXNUM (lim) > ZV)
     XSETFASTINT (lim, ZV);
-  if (XINT (lim) < BEGV)
+  if (XFIXNUM (lim) < BEGV)
     XSETFASTINT (lim, BEGV);
 
   multibyte = (!NILP (BVAR (current_buffer, enable_multibyte_characters))
-              && (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE));
+              && (XFIXNUM (lim) - PT != CHAR_TO_BYTE (XFIXNUM (lim)) - 
PT_BYTE));
   string_multibyte = SBYTES (string) > SCHARS (string);
 
   memset (fastmap, 0, sizeof fastmap);
@@ -1722,7 +1722,7 @@ skip_chars (bool forwardp, Lisp_Object string, 
Lisp_Object lim,
                error ("Invalid ISO C character class");
              if (cc != -1)
                {
-                 iso_classes = Fcons (make_number (cc), iso_classes);
+                 iso_classes = Fcons (make_fixnum (cc), iso_classes);
                  i_byte = ch - str;
                  continue;
                }
@@ -1818,7 +1818,7 @@ skip_chars (bool forwardp, Lisp_Object string, 
Lisp_Object lim,
                error ("Invalid ISO C character class");
              if (cc != -1)
                {
-                 iso_classes = Fcons (make_number (cc), iso_classes);
+                 iso_classes = Fcons (make_fixnum (cc), iso_classes);
                  i_byte = ch - str;
                  continue;
                }
@@ -1937,13 +1937,13 @@ skip_chars (bool forwardp, Lisp_Object string, 
Lisp_Object lim,
 
     if (forwardp)
       {
-       endp = (XINT (lim) == GPT) ? GPT_ADDR : CHAR_POS_ADDR (XINT (lim));
-       stop = (pos < GPT && GPT < XINT (lim)) ? GPT_ADDR : endp;
+       endp = (XFIXNUM (lim) == GPT) ? GPT_ADDR : CHAR_POS_ADDR (XFIXNUM 
(lim));
+       stop = (pos < GPT && GPT < XFIXNUM (lim)) ? GPT_ADDR : endp;
       }
     else
       {
-       endp = CHAR_POS_ADDR (XINT (lim));
-       stop = (pos >= GPT && GPT > XINT (lim)) ? GAP_END_ADDR : endp;
+       endp = CHAR_POS_ADDR (XFIXNUM (lim));
+       stop = (pos >= GPT && GPT > XFIXNUM (lim)) ? GAP_END_ADDR : endp;
       }
 
     /* This code may look up syntax tables using functions that rely on the
@@ -2095,7 +2095,7 @@ skip_chars (bool forwardp, Lisp_Object string, 
Lisp_Object lim,
     SET_PT_BOTH (pos, pos_byte);
 
     SAFE_FREE ();
-    return make_number (PT - start_point);
+    return make_fixnum (PT - start_point);
   }
 }
 
@@ -2116,19 +2116,19 @@ skip_syntaxes (bool forwardp, Lisp_Object string, 
Lisp_Object lim)
   if (NILP (lim))
     XSETINT (lim, forwardp ? ZV : BEGV);
   else
-    CHECK_NUMBER_COERCE_MARKER (lim);
+    CHECK_FIXNUM_COERCE_MARKER (lim);
 
   /* In any case, don't allow scan outside bounds of buffer.  */
-  if (XINT (lim) > ZV)
+  if (XFIXNUM (lim) > ZV)
     XSETFASTINT (lim, ZV);
-  if (XINT (lim) < BEGV)
+  if (XFIXNUM (lim) < BEGV)
     XSETFASTINT (lim, BEGV);
 
-  if (forwardp ? (PT >= XFASTINT (lim)) : (PT <= XFASTINT (lim)))
-    return make_number (0);
+  if (forwardp ? (PT >= XFIXNAT (lim)) : (PT <= XFIXNAT (lim)))
+    return make_fixnum (0);
 
   multibyte = (!NILP (BVAR (current_buffer, enable_multibyte_characters))
-              && (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE));
+              && (XFIXNUM (lim) - PT != CHAR_TO_BYTE (XFIXNUM (lim)) - 
PT_BYTE));
 
   memset (fastmap, 0, sizeof fastmap);
 
@@ -2173,8 +2173,8 @@ skip_syntaxes (bool forwardp, Lisp_Object string, 
Lisp_Object lim)
        while (true)
          {
            p = BYTE_POS_ADDR (pos_byte);
-           endp = XINT (lim) == GPT ? GPT_ADDR : CHAR_POS_ADDR (XINT (lim));
-           stop = pos < GPT && GPT < XINT (lim) ? GPT_ADDR : endp;
+           endp = XFIXNUM (lim) == GPT ? GPT_ADDR : CHAR_POS_ADDR (XFIXNUM 
(lim));
+           stop = pos < GPT && GPT < XFIXNUM (lim) ? GPT_ADDR : endp;
 
            do
              {
@@ -2206,8 +2206,8 @@ skip_syntaxes (bool forwardp, Lisp_Object string, 
Lisp_Object lim)
     else
       {
        p = BYTE_POS_ADDR (pos_byte);
-       endp = CHAR_POS_ADDR (XINT (lim));
-       stop = pos >= GPT && GPT > XINT (lim) ? GAP_END_ADDR : endp;
+       endp = CHAR_POS_ADDR (XFIXNUM (lim));
+       stop = pos >= GPT && GPT > XFIXNUM (lim) ? GAP_END_ADDR : endp;
 
        if (multibyte)
          {
@@ -2257,7 +2257,7 @@ skip_syntaxes (bool forwardp, Lisp_Object string, 
Lisp_Object lim)
   done:
     SET_PT_BOTH (pos, pos_byte);
 
-    return make_number (PT - start_point);
+    return make_fixnum (PT - start_point);
   }
 }
 
@@ -2276,7 +2276,7 @@ in_classes (int c, Lisp_Object iso_classes)
       elt = XCAR (iso_classes);
       iso_classes = XCDR (iso_classes);
 
-      if (re_iswctype (c, XFASTINT (elt)))
+      if (re_iswctype (c, XFIXNAT (elt)))
        fits_class = 1;
     }
 
@@ -2443,8 +2443,8 @@ between them, return t; otherwise return nil.  */)
   int dummy2;
   unsigned short int quit_count = 0;
 
-  CHECK_NUMBER (count);
-  count1 = XINT (count);
+  CHECK_FIXNUM (count);
+  count1 = XFIXNUM (count);
   stop = count1 > 0 ? ZV : BEGV;
 
   from = PT;
@@ -2794,7 +2794,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT 
depth, bool sexpflag)
              if (depth < min_depth)
                xsignal3 (Qscan_error,
                          build_string ("Containing expression ends 
prematurely"),
-                         make_number (last_good), make_number (from));
+                         make_fixnum (last_good), make_fixnum (from));
              break;
 
            case Sstring:
@@ -2950,7 +2950,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT 
depth, bool sexpflag)
              if (depth < min_depth)
                xsignal3 (Qscan_error,
                          build_string ("Containing expression ends 
prematurely"),
-                         make_number (last_good), make_number (from));
+                         make_fixnum (last_good), make_fixnum (from));
              break;
 
            case Sendcomment:
@@ -3030,7 +3030,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT 
depth, bool sexpflag)
  lose:
   xsignal3 (Qscan_error,
            build_string ("Unbalanced parentheses"),
-           make_number (last_good), make_number (from));
+           make_fixnum (last_good), make_fixnum (from));
 }
 
 DEFUN ("scan-lists", Fscan_lists, Sscan_lists, 3, 3, 0,
@@ -3054,11 +3054,11 @@ before we have scanned over COUNT lists, return nil if 
the depth at
 that point is zero, and signal an error if the depth is nonzero.  */)
   (Lisp_Object from, Lisp_Object count, Lisp_Object depth)
 {
-  CHECK_NUMBER (from);
-  CHECK_NUMBER (count);
-  CHECK_NUMBER (depth);
+  CHECK_FIXNUM (from);
+  CHECK_FIXNUM (count);
+  CHECK_FIXNUM (depth);
 
-  return scan_lists (XINT (from), XINT (count), XINT (depth), 0);
+  return scan_lists (XFIXNUM (from), XFIXNUM (count), XFIXNUM (depth), 0);
 }
 
 DEFUN ("scan-sexps", Fscan_sexps, Sscan_sexps, 2, 2, 0,
@@ -3074,10 +3074,10 @@ If the beginning or end is reached between groupings
 but before count is used up, nil is returned.  */)
   (Lisp_Object from, Lisp_Object count)
 {
-  CHECK_NUMBER (from);
-  CHECK_NUMBER (count);
+  CHECK_FIXNUM (from);
+  CHECK_FIXNUM (count);
 
-  return scan_lists (XINT (from), XINT (count), 0, 1);
+  return scan_lists (XFIXNUM (from), XFIXNUM (count), 0, 1);
 }
 
 DEFUN ("backward-prefix-chars", Fbackward_prefix_chars, Sbackward_prefix_chars,
@@ -3217,8 +3217,8 @@ do { prev_from = from;                            \
   while (!NILP (tem))          /* >= second enclosing sexps.  */
     {
       Lisp_Object temhd = Fcar (tem);
-      if (RANGED_INTEGERP (PTRDIFF_MIN, temhd, PTRDIFF_MAX))
-        curlevel->last = XINT (temhd);
+      if (RANGED_FIXNUMP (PTRDIFF_MIN, temhd, PTRDIFF_MAX))
+        curlevel->last = XFIXNUM (temhd);
       if (++curlevel == endlevel)
         curlevel--; /* error ("Nesting too deep for parser"); */
       curlevel->prev = -1;
@@ -3463,7 +3463,7 @@ do { prev_from = from;                            \
   state->location_byte = from_byte;
   state->levelstarts = Qnil;
   while (curlevel > levelstart)
-    state->levelstarts = Fcons (make_number ((--curlevel)->last),
+    state->levelstarts = Fcons (make_fixnum ((--curlevel)->last),
                                 state->levelstarts);
   state->prev_syntax = (SYNTAX_FLAGS_COMSTARTEND_FIRST (prev_from_syntax)
                         || state->quoted) ? prev_from_syntax : Smax;
@@ -3491,7 +3491,7 @@ internalize_parse_state (Lisp_Object external, struct 
lisp_parse_state *state)
     {
       tem = Fcar (external);
       if (!NILP (tem))
-       state->depth = XINT (tem);
+       state->depth = XFIXNUM (tem);
       else
        state->depth = 0;
 
@@ -3501,13 +3501,13 @@ internalize_parse_state (Lisp_Object external, struct 
lisp_parse_state *state)
       tem = Fcar (external);
       /* Check whether we are inside string_fence-style string: */
       state->instring = (!NILP (tem)
-                         ? (CHARACTERP (tem) ? XFASTINT (tem) : 
ST_STRING_STYLE)
+                         ? (CHARACTERP (tem) ? XFIXNAT (tem) : ST_STRING_STYLE)
                          : -1);
 
       external = Fcdr (external);
       tem = Fcar (external);
       state->incomment = (!NILP (tem)
-                          ? (INTEGERP (tem) ? XINT (tem) : -1)
+                          ? (FIXNUMP (tem) ? XFIXNUM (tem) : -1)
                           : 0);
 
       external = Fcdr (external);
@@ -3521,21 +3521,21 @@ internalize_parse_state (Lisp_Object external, struct 
lisp_parse_state *state)
       tem = Fcar (external);
       state->comstyle = (NILP (tem)
                          ? 0
-                         : (RANGED_INTEGERP (0, tem, ST_COMMENT_STYLE)
-                            ? XINT (tem)
+                         : (RANGED_FIXNUMP (0, tem, ST_COMMENT_STYLE)
+                            ? XFIXNUM (tem)
                             : ST_COMMENT_STYLE));
 
       external = Fcdr (external);
       tem = Fcar (external);
       state->comstr_start =
-       RANGED_INTEGERP (PTRDIFF_MIN, tem, PTRDIFF_MAX) ? XINT (tem) : -1;
+       RANGED_FIXNUMP (PTRDIFF_MIN, tem, PTRDIFF_MAX) ? XFIXNUM (tem) : -1;
       external = Fcdr (external);
       tem = Fcar (external);
       state->levelstarts = tem;
 
       external = Fcdr (external);
       tem = Fcar (external);
-      state->prev_syntax = NILP (tem) ? Smax : XINT (tem);
+      state->prev_syntax = NILP (tem) ? Smax : XFIXNUM (tem);
     }
 }
 
@@ -3584,16 +3584,16 @@ Sixth arg COMMENTSTOP non-nil means stop after the 
start of a comment.
 
   if (!NILP (targetdepth))
     {
-      CHECK_NUMBER (targetdepth);
-      target = XINT (targetdepth);
+      CHECK_FIXNUM (targetdepth);
+      target = XFIXNUM (targetdepth);
     }
   else
     target = TYPE_MINIMUM (EMACS_INT); /* We won't reach this depth.  */
 
   validate_region (&from, &to);
   internalize_parse_state (oldstate, &state);
-  scan_sexps_forward (&state, XINT (from), CHAR_TO_BYTE (XINT (from)),
-                     XINT (to),
+  scan_sexps_forward (&state, XFIXNUM (from), CHAR_TO_BYTE (XFIXNUM (from)),
+                     XFIXNUM (to),
                      target, !NILP (stopbefore),
                      (NILP (commentstop)
                       ? 0 : (EQ (commentstop, Qsyntax_table) ? -1 : 1)));
@@ -3601,32 +3601,32 @@ Sixth arg COMMENTSTOP non-nil means stop after the 
start of a comment.
   SET_PT_BOTH (state.location, state.location_byte);
 
   return
-    Fcons (make_number (state.depth),
+    Fcons (make_fixnum (state.depth),
           Fcons (state.prevlevelstart < 0
-                 ? Qnil : make_number (state.prevlevelstart),
+                 ? Qnil : make_fixnum (state.prevlevelstart),
             Fcons (state.thislevelstart < 0
-                   ? Qnil : make_number (state.thislevelstart),
+                   ? Qnil : make_fixnum (state.thislevelstart),
               Fcons (state.instring >= 0
                      ? (state.instring == ST_STRING_STYLE
-                        ? Qt : make_number (state.instring)) : Qnil,
+                        ? Qt : make_fixnum (state.instring)) : Qnil,
                 Fcons (state.incomment < 0 ? Qt :
                        (state.incomment == 0 ? Qnil :
-                        make_number (state.incomment)),
+                        make_fixnum (state.incomment)),
                   Fcons (state.quoted ? Qt : Qnil,
-                    Fcons (make_number (state.mindepth),
+                    Fcons (make_fixnum (state.mindepth),
                       Fcons ((state.comstyle
                               ? (state.comstyle == ST_COMMENT_STYLE
                                  ? Qsyntax_table
-                                 : make_number (state.comstyle))
+                                 : make_fixnum (state.comstyle))
                               : Qnil),
                         Fcons (((state.incomment
                                   || (state.instring >= 0))
-                                 ? make_number (state.comstr_start)
+                                 ? make_fixnum (state.comstr_start)
                                  : Qnil),
                           Fcons (state.levelstarts,
                              Fcons (state.prev_syntax == Smax
                                     ? Qnil
-                                    : make_number (state.prev_syntax),
+                                    : make_fixnum (state.prev_syntax),
                                 Qnil)))))))))));
 }
 
@@ -3642,11 +3642,11 @@ init_syntax_once (void)
   /* Create objects which can be shared among syntax tables.  */
   Vsyntax_code_object = make_uninit_vector (Smax);
   for (i = 0; i < Smax; i++)
-    ASET (Vsyntax_code_object, i, Fcons (make_number (i), Qnil));
+    ASET (Vsyntax_code_object, i, Fcons (make_fixnum (i), Qnil));
 
   /* Now we are ready to set up this property, so we can
      create syntax tables.  */
-  Fput (Qsyntax_table, Qchar_table_extra_slots, make_number (0));
+  Fput (Qsyntax_table, Qchar_table_extra_slots, make_fixnum (0));
 
   temp = AREF (Vsyntax_code_object, Swhitespace);
 
@@ -3678,21 +3678,21 @@ init_syntax_once (void)
   SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '%', temp);
 
   SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '(',
-                       Fcons (make_number (Sopen), make_number (')')));
+                       Fcons (make_fixnum (Sopen), make_fixnum (')')));
   SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, ')',
-                       Fcons (make_number (Sclose), make_number ('(')));
+                       Fcons (make_fixnum (Sclose), make_fixnum ('(')));
   SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '[',
-                       Fcons (make_number (Sopen), make_number (']')));
+                       Fcons (make_fixnum (Sopen), make_fixnum (']')));
   SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, ']',
-                       Fcons (make_number (Sclose), make_number ('[')));
+                       Fcons (make_fixnum (Sclose), make_fixnum ('[')));
   SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '{',
-                       Fcons (make_number (Sopen), make_number ('}')));
+                       Fcons (make_fixnum (Sopen), make_fixnum ('}')));
   SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '}',
-                       Fcons (make_number (Sclose), make_number ('{')));
+                       Fcons (make_fixnum (Sclose), make_fixnum ('{')));
   SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '"',
-                       Fcons (make_number (Sstring), Qnil));
+                       Fcons (make_fixnum (Sstring), Qnil));
   SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\\',
-                       Fcons (make_number (Sescape), Qnil));
+                       Fcons (make_fixnum (Sescape), Qnil));
 
   temp = AREF (Vsyntax_code_object, Ssymbol);
   for (i = 0; i < 10; i++)
diff --git a/src/syntax.h b/src/syntax.h
index f02a17c..d971c74 100644
--- a/src/syntax.h
+++ b/src/syntax.h
@@ -118,7 +118,7 @@ INLINE int
 syntax_property_with_flags (int c, bool via_property)
 {
   Lisp_Object ent = syntax_property_entry (c, via_property);
-  return CONSP (ent) ? XINT (XCAR (ent)) : Swhitespace;
+  return CONSP (ent) ? XFIXNUM (XCAR (ent)) : Swhitespace;
 }
 INLINE int
 SYNTAX_WITH_FLAGS (int c)
diff --git a/src/sysdep.c b/src/sysdep.c
index 231b116..889ad6b 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -2850,8 +2850,8 @@ serial_configure (struct Lisp_Process *p,
     tem = Fplist_get (contact, QCspeed);
   else
     tem = Fplist_get (p->childp, QCspeed);
-  CHECK_NUMBER (tem);
-  err = cfsetspeed (&attr, XINT (tem));
+  CHECK_FIXNUM (tem);
+  err = cfsetspeed (&attr, XFIXNUM (tem));
   if (err != 0)
     report_file_error ("Failed cfsetspeed", tem);
   childp2 = Fplist_put (childp2, QCspeed, tem);
@@ -2862,17 +2862,17 @@ serial_configure (struct Lisp_Process *p,
   else
     tem = Fplist_get (p->childp, QCbytesize);
   if (NILP (tem))
-    tem = make_number (8);
-  CHECK_NUMBER (tem);
-  if (XINT (tem) != 7 && XINT (tem) != 8)
+    tem = make_fixnum (8);
+  CHECK_FIXNUM (tem);
+  if (XFIXNUM (tem) != 7 && XFIXNUM (tem) != 8)
     error (":bytesize must be nil (8), 7, or 8");
-  summary[0] = XINT (tem) + '0';
+  summary[0] = XFIXNUM (tem) + '0';
 #if defined (CSIZE) && defined (CS7) && defined (CS8)
   attr.c_cflag &= ~CSIZE;
-  attr.c_cflag |= ((XINT (tem) == 7) ? CS7 : CS8);
+  attr.c_cflag |= ((XFIXNUM (tem) == 7) ? CS7 : CS8);
 #else
   /* Don't error on bytesize 8, which should be set by cfmakeraw.  */
-  if (XINT (tem) != 8)
+  if (XFIXNUM (tem) != 8)
     error ("Bytesize cannot be changed");
 #endif
   childp2 = Fplist_put (childp2, QCbytesize, tem);
@@ -2916,18 +2916,18 @@ serial_configure (struct Lisp_Process *p,
   else
     tem = Fplist_get (p->childp, QCstopbits);
   if (NILP (tem))
-    tem = make_number (1);
-  CHECK_NUMBER (tem);
-  if (XINT (tem) != 1 && XINT (tem) != 2)
+    tem = make_fixnum (1);
+  CHECK_FIXNUM (tem);
+  if (XFIXNUM (tem) != 1 && XFIXNUM (tem) != 2)
     error (":stopbits must be nil (1 stopbit), 1, or 2");
-  summary[2] = XINT (tem) + '0';
+  summary[2] = XFIXNUM (tem) + '0';
 #if defined (CSTOPB)
   attr.c_cflag &= ~CSTOPB;
-  if (XINT (tem) == 2)
+  if (XFIXNUM (tem) == 2)
     attr.c_cflag |= CSTOPB;
 #else
   /* Don't error on 1 stopbit, which should be set by cfmakeraw.  */
-  if (XINT (tem) != 1)
+  if (XFIXNUM (tem) != 1)
     error ("Stopbits cannot be configured");
 #endif
   childp2 = Fplist_put (childp2, QCstopbits, tem);
@@ -3239,7 +3239,7 @@ system_process_attributes (Lisp_Object pid)
   struct group *gr;
   long clocks_per_sec;
   char *procfn_end;
-  char procbuf[1025], *p, *q;
+  char procbuf[1025], *p, *q UNINIT;
   int fd;
   ssize_t nread;
   static char const default_cmd[] = "???";
@@ -3261,7 +3261,7 @@ system_process_attributes (Lisp_Object pid)
   Lisp_Object decoded_cmd;
   ptrdiff_t count;
 
-  CHECK_NUMBER_OR_FLOAT (pid);
+  CHECK_FIXNUM_OR_FLOAT (pid);
   CONS_TO_INTEGER (pid, pid_t, proc_id);
   sprintf (procfn, "/proc/%"pMd, proc_id);
   if (stat (procfn, &st) < 0)
@@ -3369,8 +3369,8 @@ system_process_attributes (Lisp_Object pid)
                                ltime_from_jiffies (cstime + cutime,
                                                    clocks_per_sec)),
                         attrs);
-         attrs = Fcons (Fcons (Qpri, make_number (priority)), attrs);
-         attrs = Fcons (Fcons (Qnice, make_number (niceness)), attrs);
+         attrs = Fcons (Fcons (Qpri, make_fixnum (priority)), attrs);
+         attrs = Fcons (Fcons (Qnice, make_fixnum (niceness)), attrs);
          attrs = Fcons (Fcons (Qthcount, make_fixnum_or_float (thcount)),
                         attrs);
          tnow = current_timespec ();
@@ -3495,7 +3495,7 @@ system_process_attributes (Lisp_Object pid)
   Lisp_Object decoded_cmd;
   ptrdiff_t count;
 
-  CHECK_NUMBER_OR_FLOAT (pid);
+  CHECK_FIXNUM_OR_FLOAT (pid);
   CONS_TO_INTEGER (pid, pid_t, proc_id);
   sprintf (procfn, "/proc/%"pMd, proc_id);
   if (stat (procfn, &st) < 0)
@@ -3563,8 +3563,8 @@ system_process_attributes (Lisp_Object pid)
 
       attrs = Fcons (Fcons (Qtime, make_lisp_time (pinfo.pr_time)), attrs);
       attrs = Fcons (Fcons (Qctime, make_lisp_time (pinfo.pr_ctime)), attrs);
-      attrs = Fcons (Fcons (Qpri, make_number (pinfo.pr_lwp.pr_pri)), attrs);
-      attrs = Fcons (Fcons (Qnice, make_number (pinfo.pr_lwp.pr_nice)), attrs);
+      attrs = Fcons (Fcons (Qpri, make_fixnum (pinfo.pr_lwp.pr_pri)), attrs);
+      attrs = Fcons (Fcons (Qnice, make_fixnum (pinfo.pr_lwp.pr_nice)), attrs);
       attrs = Fcons (Fcons (Qthcount, make_fixnum_or_float (pinfo.pr_nlwp)),
                     attrs);
 
@@ -3630,7 +3630,7 @@ system_process_attributes (Lisp_Object pid)
   Lisp_Object attrs = Qnil;
   Lisp_Object decoded_comm;
 
-  CHECK_NUMBER_OR_FLOAT (pid);
+  CHECK_FIXNUM_OR_FLOAT (pid);
   CONS_TO_INTEGER (pid, int, proc_id);
   mib[3] = proc_id;
 
@@ -3697,8 +3697,8 @@ system_process_attributes (Lisp_Object pid)
   attrs = Fcons (Fcons (Qtpgid,   make_fixnum_or_float (proc.ki_tpgid)), 
attrs);
   attrs = Fcons (Fcons (Qminflt,  make_fixnum_or_float 
(proc.ki_rusage.ru_minflt)), attrs);
   attrs = Fcons (Fcons (Qmajflt,  make_fixnum_or_float 
(proc.ki_rusage.ru_majflt)), attrs);
-  attrs = Fcons (Fcons (Qcminflt, make_number (proc.ki_rusage_ch.ru_minflt)), 
attrs);
-  attrs = Fcons (Fcons (Qcmajflt, make_number (proc.ki_rusage_ch.ru_majflt)), 
attrs);
+  attrs = Fcons (Fcons (Qcminflt, make_fixnum (proc.ki_rusage_ch.ru_minflt)), 
attrs);
+  attrs = Fcons (Fcons (Qcmajflt, make_fixnum (proc.ki_rusage_ch.ru_majflt)), 
attrs);
 
   attrs = Fcons (Fcons (Qutime, make_lisp_timeval (proc.ki_rusage.ru_utime)),
                 attrs);
@@ -3720,11 +3720,11 @@ system_process_attributes (Lisp_Object pid)
 
   attrs = Fcons (Fcons (Qthcount, make_fixnum_or_float (proc.ki_numthreads)),
                 attrs);
-  attrs = Fcons (Fcons (Qpri,   make_number (proc.ki_pri.pri_native)), attrs);
-  attrs = Fcons (Fcons (Qnice,  make_number (proc.ki_nice)), attrs);
+  attrs = Fcons (Fcons (Qpri,   make_fixnum (proc.ki_pri.pri_native)), attrs);
+  attrs = Fcons (Fcons (Qnice,  make_fixnum (proc.ki_nice)), attrs);
   attrs = Fcons (Fcons (Qstart, make_lisp_timeval (proc.ki_start)), attrs);
-  attrs = Fcons (Fcons (Qvsize, make_number (proc.ki_size >> 10)), attrs);
-  attrs = Fcons (Fcons (Qrss,   make_number (proc.ki_rssize * pagesize >> 10)),
+  attrs = Fcons (Fcons (Qvsize, make_fixnum (proc.ki_size >> 10)), attrs);
+  attrs = Fcons (Fcons (Qrss,   make_fixnum (proc.ki_rssize * pagesize >> 10)),
                 attrs);
 
   now = current_timespec ();
@@ -3810,7 +3810,7 @@ system_process_attributes (Lisp_Object pid)
   Lisp_Object attrs = Qnil;
   Lisp_Object decoded_comm;
 
-  CHECK_NUMBER_OR_FLOAT (pid);
+  CHECK_FIXNUM_OR_FLOAT (pid);
   CONS_TO_INTEGER (pid, int, proc_id);
   mib[3] = proc_id;
 
@@ -3900,7 +3900,7 @@ system_process_attributes (Lisp_Object pid)
     }
 
   starttime = proc.kp_proc.p_starttime;
-  attrs = Fcons (Fcons (Qnice,  make_number (proc.kp_proc.p_nice)), attrs);
+  attrs = Fcons (Fcons (Qnice,  make_fixnum (proc.kp_proc.p_nice)), attrs);
   attrs = Fcons (Fcons (Qstart, make_lisp_timeval (starttime)), attrs);
 
   now = current_timespec ();
diff --git a/src/term.c b/src/term.c
index f5fca7f..ce24f69 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1359,7 +1359,7 @@ term_get_fkeys_1 (void)
       char *sequence = tgetstr (keys[i].cap, address);
       if (sequence)
        Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (sequence),
-                    Fmake_vector (make_number (1),
+                    Fmake_vector (make_fixnum (1),
                                   intern (keys[i].name)));
     }
 
@@ -1379,13 +1379,13 @@ term_get_fkeys_1 (void)
          /* Define f0 first, so that f10 takes precedence in case the
             key sequences happens to be the same.  */
          Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (k0),
-                      Fmake_vector (make_number (1), intern ("f0")));
+                      Fmake_vector (make_fixnum (1), intern ("f0")));
        Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (k_semi),
-                    Fmake_vector (make_number (1), intern ("f10")));
+                    Fmake_vector (make_fixnum (1), intern ("f10")));
       }
     else if (k0)
       Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (k0),
-                  Fmake_vector (make_number (1), intern (k0_name)));
+                  Fmake_vector (make_fixnum (1), intern (k0_name)));
   }
 
   /* Set up cookies for numbered function keys above f10. */
@@ -1408,7 +1408,7 @@ term_get_fkeys_1 (void)
            {
              sprintf (fkey, "f%d", i);
              Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string 
(sequence),
-                          Fmake_vector (make_number (1),
+                          Fmake_vector (make_fixnum (1),
                                         intern (fkey)));
            }
        }
@@ -1425,7 +1425,7 @@ term_get_fkeys_1 (void)
          char *sequence = tgetstr (cap2, address);                     \
          if (sequence)                                                 \
            Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string 
(sequence), \
-                        Fmake_vector (make_number (1),                 \
+                        Fmake_vector (make_fixnum (1),                 \
                                       intern (sym)));                  \
        }
 
@@ -2050,7 +2050,7 @@ TERMINAL does not refer to a text terminal.  */)
 {
   struct terminal *t = decode_tty_terminal (terminal);
 
-  return make_number (t ? t->display_info.tty->TN_max_colors : 0);
+  return make_fixnum (t ? t->display_info.tty->TN_max_colors : 0);
 }
 
 #ifndef DOS_NT
@@ -2137,7 +2137,7 @@ set_tty_color_mode (struct tty_display_info *tty, struct 
frame *f)
   tem = assq_no_quit (Qtty_color_mode, f->param_alist);
   val = CONSP (tem) ? XCDR (tem) : Qnil;
 
-  if (INTEGERP (val))
+  if (FIXNUMP (val))
     color_mode = val;
   else if (SYMBOLP (tty_color_mode_alist))
     {
@@ -2147,7 +2147,7 @@ set_tty_color_mode (struct tty_display_info *tty, struct 
frame *f)
   else
     color_mode = Qnil;
 
-  mode = TYPE_RANGED_INTEGERP (int, color_mode) ? XINT (color_mode) : 0;
+  mode = TYPE_RANGED_FIXNUMP (int, color_mode) ? XFIXNUM (color_mode) : 0;
 
   if (mode != tty->previous_color_mode)
     {
@@ -2805,8 +2805,8 @@ mouse_get_xy (int *x, int *y)
                                                 &time_dummy);
   if (!NILP (lmx))
     {
-      *x = XINT (lmx);
-      *y = XINT (lmy);
+      *x = XFIXNUM (lmx);
+      *y = XFIXNUM (lmy);
     }
 }
 
@@ -3403,9 +3403,9 @@ tty_menu_help_callback (char const *help_string, int 
pane, int item)
     pane_name = first_item[MENU_ITEMS_ITEM_NAME];
 
   /* (menu-item MENU-NAME PANE-NUMBER)  */
-  menu_object = list3 (Qmenu_item, pane_name, make_number (pane));
+  menu_object = list3 (Qmenu_item, pane_name, make_fixnum (pane));
   show_help_echo (help_string ? build_string (help_string) : Qnil,
-                 Qnil, menu_object, make_number (item));
+                 Qnil, menu_object, make_fixnum (item));
 }
 
 struct tty_pop_down_menu
@@ -3477,7 +3477,7 @@ tty_menu_new_item_coords (struct frame *f, int which, int 
*x, int *y)
          pos = AREF (items, i + 3);
          if (NILP (str))
            return;
-         ix = XINT (pos);
+         ix = XFIXNUM (pos);
          if (ix <= *x
              /* We use <= so the blank between 2 items on a TTY is
                 considered part of the previous item.  */
@@ -3488,14 +3488,14 @@ tty_menu_new_item_coords (struct frame *f, int which, 
int *x, int *y)
              if (which == TTYM_NEXT)
                {
                  if (i < last_i)
-                   *x = XINT (AREF (items, i + 4 + 3));
+                   *x = XFIXNUM (AREF (items, i + 4 + 3));
                  else
                    *x = 0;     /* Wrap around to the first item.  */
                }
              else if (prev_x < 0)
                {
                  /* Wrap around to the last item.  */
-                 *x = XINT (AREF (items, last_i + 3));
+                 *x = XFIXNUM (AREF (items, last_i + 3));
                }
              else
                *x = prev_x;
@@ -3754,7 +3754,7 @@ tty_menu_show (struct frame *f, int x, int y, int 
menuflags,
     case TTYM_NEXT:
     case TTYM_PREV:
       tty_menu_new_item_coords (f, status, &item_x, &item_y);
-      entry = Fcons (make_number (item_x), make_number (item_y));
+      entry = Fcons (make_fixnum (item_x), make_fixnum (item_y));
       break;
 
     case TTYM_FAILURE:
diff --git a/src/termhooks.h b/src/termhooks.h
index d8c5edc..160bd2f 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -346,7 +346,7 @@ enum {
      FIXNUM_BITS, so using it to represent a modifier key means that
      characters thus modified have different integer equivalents
      depending on the architecture they're running on.  Oh, and
-     applying XINT to a character whose 2^28 bit is set might sign-extend
+     applying XFIXNUM to a character whose 2^28 bit is set might sign-extend
      it, so you get a bunch of bits in the mask you didn't want.
 
      The CHAR_ macros are defined in lisp.h.  */
diff --git a/src/terminal.c b/src/terminal.c
index 1b3acbe..18982fe 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -551,10 +551,10 @@ calculate_glyph_code_table (struct terminal *t)
       struct unimapdesc unimapdesc = { entry_ct, entries };
       if (ioctl (fd, GIO_UNIMAP, &unimapdesc) == 0)
        {
-         glyphtab = Fmake_char_table (Qnil, make_number (-1));
+         glyphtab = Fmake_char_table (Qnil, make_fixnum (-1));
          for (int i = 0; i < unimapdesc.entry_ct; i++)
            char_table_set (glyphtab, entries[i].unicode,
-                           make_number (entries[i].fontpos));
+                           make_fixnum (entries[i].fontpos));
          break;
        }
       if (errno != ENOMEM)
diff --git a/src/textprop.c b/src/textprop.c
index ea1ae3b..8e8baf4 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -79,7 +79,7 @@ text_read_only (Lisp_Object propval)
 static void
 modify_text_properties (Lisp_Object buffer, Lisp_Object start, Lisp_Object end)
 {
-  ptrdiff_t b = XINT (start), e = XINT (end);
+  ptrdiff_t b = XFIXNUM (start), e = XFIXNUM (end);
   struct buffer *buf = XBUFFER (buffer), *old = current_buffer;
 
   set_buffer_internal (buf);
@@ -137,15 +137,15 @@ validate_interval_range (Lisp_Object object, Lisp_Object 
*begin,
   ptrdiff_t searchpos;
 
   CHECK_STRING_OR_BUFFER (object);
-  CHECK_NUMBER_COERCE_MARKER (*begin);
-  CHECK_NUMBER_COERCE_MARKER (*end);
+  CHECK_FIXNUM_COERCE_MARKER (*begin);
+  CHECK_FIXNUM_COERCE_MARKER (*end);
 
   /* If we are asked for a point, but from a subr which operates
      on a range, then return nothing.  */
   if (EQ (*begin, *end) && begin != end)
     return NULL;
 
-  if (XINT (*begin) > XINT (*end))
+  if (XFIXNUM (*begin) > XFIXNUM (*end))
     {
       Lisp_Object n;
       n = *begin;
@@ -157,8 +157,8 @@ validate_interval_range (Lisp_Object object, Lisp_Object 
*begin,
     {
       register struct buffer *b = XBUFFER (object);
 
-      if (!(BUF_BEGV (b) <= XINT (*begin) && XINT (*begin) <= XINT (*end)
-           && XINT (*end) <= BUF_ZV (b)))
+      if (!(BUF_BEGV (b) <= XFIXNUM (*begin) && XFIXNUM (*begin) <= XFIXNUM 
(*end)
+           && XFIXNUM (*end) <= BUF_ZV (b)))
        args_out_of_range (*begin, *end);
       i = buffer_intervals (b);
 
@@ -166,24 +166,24 @@ validate_interval_range (Lisp_Object object, Lisp_Object 
*begin,
       if (BUF_BEGV (b) == BUF_ZV (b))
        return NULL;
 
-      searchpos = XINT (*begin);
+      searchpos = XFIXNUM (*begin);
     }
   else
     {
       ptrdiff_t len = SCHARS (object);
 
-      if (! (0 <= XINT (*begin) && XINT (*begin) <= XINT (*end)
-            && XINT (*end) <= len))
+      if (! (0 <= XFIXNUM (*begin) && XFIXNUM (*begin) <= XFIXNUM (*end)
+            && XFIXNUM (*end) <= len))
        args_out_of_range (*begin, *end);
-      XSETFASTINT (*begin, XFASTINT (*begin));
+      XSETFASTINT (*begin, XFIXNAT (*begin));
       if (begin != end)
-       XSETFASTINT (*end, XFASTINT (*end));
+       XSETFASTINT (*end, XFIXNAT (*end));
       i = string_intervals (object);
 
       if (len == 0)
        return NULL;
 
-      searchpos = XINT (*begin);
+      searchpos = XFIXNUM (*begin);
     }
 
   if (!i)
@@ -544,7 +544,7 @@ interval_of (ptrdiff_t position, Lisp_Object object)
     }
 
   if (!(beg <= position && position <= end))
-    args_out_of_range (make_number (position), make_number (position));
+    args_out_of_range (make_fixnum (position), make_fixnum (position));
   if (beg == end || !i)
     return NULL;
 
@@ -572,7 +572,7 @@ If POSITION is at the end of OBJECT, the value is nil.  */)
      it means it's the end of OBJECT.
      There are no properties at the very end,
      since no character follows.  */
-  if (XINT (position) == LENGTH (i) + i->position)
+  if (XFIXNUM (position) == LENGTH (i) + i->position)
     return Qnil;
 
   return i->plist;
@@ -604,7 +604,7 @@ get_char_property_and_overlay (Lisp_Object position, 
register Lisp_Object prop,
 {
   struct window *w = 0;
 
-  CHECK_NUMBER_COERCE_MARKER (position);
+  CHECK_FIXNUM_COERCE_MARKER (position);
 
   if (NILP (object))
     XSETBUFFER (object, current_buffer);
@@ -621,14 +621,14 @@ get_char_property_and_overlay (Lisp_Object position, 
register Lisp_Object prop,
       Lisp_Object *overlay_vec;
       struct buffer *obuf = current_buffer;
 
-      if (XINT (position) < BUF_BEGV (XBUFFER (object))
-         || XINT (position) > BUF_ZV (XBUFFER (object)))
+      if (XFIXNUM (position) < BUF_BEGV (XBUFFER (object))
+         || XFIXNUM (position) > BUF_ZV (XBUFFER (object)))
        xsignal1 (Qargs_out_of_range, position);
 
       set_buffer_temp (XBUFFER (object));
 
       USE_SAFE_ALLOCA;
-      GET_OVERLAYS_AT (XINT (position), overlay_vec, noverlays, NULL, false);
+      GET_OVERLAYS_AT (XFIXNUM (position), overlay_vec, noverlays, NULL, 
false);
       noverlays = sort_overlays (overlay_vec, noverlays, w);
 
       set_buffer_temp (obuf);
@@ -714,8 +714,8 @@ before LIMIT.  LIMIT is a no-op if it is greater than 
(point-max).  */)
   temp = Fnext_overlay_change (position);
   if (! NILP (limit))
     {
-      CHECK_NUMBER_COERCE_MARKER (limit);
-      if (XINT (limit) < XINT (temp))
+      CHECK_FIXNUM_COERCE_MARKER (limit);
+      if (XFIXNUM (limit) < XFIXNUM (temp))
        temp = limit;
     }
   return Fnext_property_change (position, Qnil, temp);
@@ -740,8 +740,8 @@ before LIMIT.  LIMIT is a no-op if it is less than 
(point-min).  */)
   temp = Fprevious_overlay_change (position);
   if (! NILP (limit))
     {
-      CHECK_NUMBER_COERCE_MARKER (limit);
-      if (XINT (limit) > XINT (temp))
+      CHECK_FIXNUM_COERCE_MARKER (limit);
+      if (XFIXNUM (limit) > XFIXNUM (temp))
        temp = limit;
     }
   return Fprevious_property_change (position, Qnil, temp);
@@ -774,10 +774,10 @@ last valid position in OBJECT.  */)
       if (NILP (position))
        {
          if (NILP (limit))
-           position = make_number (SCHARS (object));
+           position = make_fixnum (SCHARS (object));
          else
            {
-             CHECK_NUMBER (limit);
+             CHECK_FIXNUM (limit);
              position = limit;
            }
        }
@@ -796,26 +796,26 @@ last valid position in OBJECT.  */)
          Fset_buffer (object);
        }
 
-      CHECK_NUMBER_COERCE_MARKER (position);
+      CHECK_FIXNUM_COERCE_MARKER (position);
 
       initial_value = Fget_char_property (position, prop, object);
 
       if (NILP (limit))
        XSETFASTINT (limit, ZV);
       else
-       CHECK_NUMBER_COERCE_MARKER (limit);
+       CHECK_FIXNUM_COERCE_MARKER (limit);
 
-      if (XFASTINT (position) >= XFASTINT (limit))
+      if (XFIXNAT (position) >= XFIXNAT (limit))
        {
          position = limit;
-         if (XFASTINT (position) > ZV)
+         if (XFIXNAT (position) > ZV)
            XSETFASTINT (position, ZV);
        }
       else
        while (true)
          {
            position = Fnext_char_property_change (position, limit);
-           if (XFASTINT (position) >= XFASTINT (limit))
+           if (XFIXNAT (position) >= XFIXNAT (limit))
              {
                position = limit;
                break;
@@ -859,10 +859,10 @@ first valid position in OBJECT.  */)
       if (NILP (position))
        {
          if (NILP (limit))
-           position = make_number (0);
+           position = make_fixnum (0);
          else
            {
-             CHECK_NUMBER (limit);
+             CHECK_FIXNUM (limit);
              position = limit;
            }
        }
@@ -880,30 +880,30 @@ first valid position in OBJECT.  */)
          Fset_buffer (object);
        }
 
-      CHECK_NUMBER_COERCE_MARKER (position);
+      CHECK_FIXNUM_COERCE_MARKER (position);
 
       if (NILP (limit))
        XSETFASTINT (limit, BEGV);
       else
-       CHECK_NUMBER_COERCE_MARKER (limit);
+       CHECK_FIXNUM_COERCE_MARKER (limit);
 
-      if (XFASTINT (position) <= XFASTINT (limit))
+      if (XFIXNAT (position) <= XFIXNAT (limit))
        {
          position = limit;
-         if (XFASTINT (position) < BEGV)
+         if (XFIXNAT (position) < BEGV)
            XSETFASTINT (position, BEGV);
        }
       else
        {
          Lisp_Object initial_value
-           = Fget_char_property (make_number (XFASTINT (position) - 1),
+           = Fget_char_property (make_fixnum (XFIXNAT (position) - 1),
                                  prop, object);
 
          while (true)
            {
              position = Fprevious_char_property_change (position, limit);
 
-             if (XFASTINT (position) <= XFASTINT (limit))
+             if (XFIXNAT (position) <= XFIXNAT (limit))
                {
                  position = limit;
                  break;
@@ -911,7 +911,7 @@ first valid position in OBJECT.  */)
              else
                {
                  Lisp_Object value
-                   = Fget_char_property (make_number (XFASTINT (position) - 1),
+                   = Fget_char_property (make_fixnum (XFIXNAT (position) - 1),
                                          prop, object);
 
                  if (!EQ (value, initial_value))
@@ -948,7 +948,7 @@ past position LIMIT; return LIMIT if nothing is found 
before LIMIT.  */)
     XSETBUFFER (object, current_buffer);
 
   if (!NILP (limit) && !EQ (limit, Qt))
-    CHECK_NUMBER_COERCE_MARKER (limit);
+    CHECK_FIXNUM_COERCE_MARKER (limit);
 
   i = validate_interval_range (object, &position, &position, soft);
 
@@ -976,19 +976,19 @@ past position LIMIT; return LIMIT if nothing is found 
before LIMIT.  */)
   next = next_interval (i);
 
   while (next && intervals_equal (i, next)
-        && (NILP (limit) || next->position < XFASTINT (limit)))
+        && (NILP (limit) || next->position < XFIXNAT (limit)))
     next = next_interval (next);
 
   if (!next
       || (next->position
-         >= (INTEGERP (limit)
-             ? XFASTINT (limit)
+         >= (FIXNUMP (limit)
+             ? XFIXNAT (limit)
              : (STRINGP (object)
                 ? SCHARS (object)
                 : BUF_ZV (XBUFFER (object))))))
     return limit;
   else
-    return make_number (next->position);
+    return make_fixnum (next->position);
 }
 
 DEFUN ("next-single-property-change", Fnext_single_property_change,
@@ -1015,7 +1015,7 @@ past position LIMIT; return LIMIT if nothing is found 
before LIMIT.  */)
     XSETBUFFER (object, current_buffer);
 
   if (!NILP (limit))
-    CHECK_NUMBER_COERCE_MARKER (limit);
+    CHECK_FIXNUM_COERCE_MARKER (limit);
 
   i = validate_interval_range (object, &position, &position, soft);
   if (!i)
@@ -1025,19 +1025,19 @@ past position LIMIT; return LIMIT if nothing is found 
before LIMIT.  */)
   next = next_interval (i);
   while (next
         && EQ (here_val, textget (next->plist, prop))
-        && (NILP (limit) || next->position < XFASTINT (limit)))
+        && (NILP (limit) || next->position < XFIXNAT (limit)))
     next = next_interval (next);
 
   if (!next
       || (next->position
-         >= (INTEGERP (limit)
-             ? XFASTINT (limit)
+         >= (FIXNUMP (limit)
+             ? XFIXNAT (limit)
              : (STRINGP (object)
                 ? SCHARS (object)
                 : BUF_ZV (XBUFFER (object))))))
     return limit;
   else
-    return make_number (next->position);
+    return make_fixnum (next->position);
 }
 
 DEFUN ("previous-property-change", Fprevious_property_change,
@@ -1062,30 +1062,30 @@ back past position LIMIT; return LIMIT if nothing is 
found until LIMIT.  */)
     XSETBUFFER (object, current_buffer);
 
   if (!NILP (limit))
-    CHECK_NUMBER_COERCE_MARKER (limit);
+    CHECK_FIXNUM_COERCE_MARKER (limit);
 
   i = validate_interval_range (object, &position, &position, soft);
   if (!i)
     return limit;
 
   /* Start with the interval containing the char before point.  */
-  if (i->position == XFASTINT (position))
+  if (i->position == XFIXNAT (position))
     i = previous_interval (i);
 
   previous = previous_interval (i);
   while (previous && intervals_equal (previous, i)
         && (NILP (limit)
-            || (previous->position + LENGTH (previous) > XFASTINT (limit))))
+            || (previous->position + LENGTH (previous) > XFIXNAT (limit))))
     previous = previous_interval (previous);
 
   if (!previous
       || (previous->position + LENGTH (previous)
-         <= (INTEGERP (limit)
-             ? XFASTINT (limit)
+         <= (FIXNUMP (limit)
+             ? XFIXNAT (limit)
              : (STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object))))))
     return limit;
   else
-    return make_number (previous->position + LENGTH (previous));
+    return make_fixnum (previous->position + LENGTH (previous));
 }
 
 DEFUN ("previous-single-property-change", Fprevious_single_property_change,
@@ -1112,12 +1112,12 @@ back past position LIMIT; return LIMIT if nothing is 
found until LIMIT.  */)
     XSETBUFFER (object, current_buffer);
 
   if (!NILP (limit))
-    CHECK_NUMBER_COERCE_MARKER (limit);
+    CHECK_FIXNUM_COERCE_MARKER (limit);
 
   i = validate_interval_range (object, &position, &position, soft);
 
   /* Start with the interval containing the char before point.  */
-  if (i && i->position == XFASTINT (position))
+  if (i && i->position == XFIXNAT (position))
     i = previous_interval (i);
 
   if (!i)
@@ -1128,17 +1128,17 @@ back past position LIMIT; return LIMIT if nothing is 
found until LIMIT.  */)
   while (previous
         && EQ (here_val, textget (previous->plist, prop))
         && (NILP (limit)
-            || (previous->position + LENGTH (previous) > XFASTINT (limit))))
+            || (previous->position + LENGTH (previous) > XFIXNAT (limit))))
     previous = previous_interval (previous);
 
   if (!previous
       || (previous->position + LENGTH (previous)
-         <= (INTEGERP (limit)
-             ? XFASTINT (limit)
+         <= (FIXNUMP (limit)
+             ? XFIXNAT (limit)
              : (STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object))))))
     return limit;
   else
-    return make_number (previous->position + LENGTH (previous));
+    return make_fixnum (previous->position + LENGTH (previous));
 }
 
 /* Used by add-text-properties and add-face-text-property. */
@@ -1164,8 +1164,8 @@ add_text_properties_1 (Lisp_Object start, Lisp_Object end,
   if (!i)
     return Qnil;
 
-  s = XINT (start);
-  len = XINT (end) - s;
+  s = XFIXNUM (start);
+  len = XFIXNUM (end) - s;
 
   /* If this interval already has the properties, we can skip it.  */
   if (interval_has_all_properties (properties, i))
@@ -1221,8 +1221,8 @@ add_text_properties_1 (Lisp_Object start, Lisp_Object end,
          if (interval_has_all_properties (properties, i))
            {
              if (BUFFERP (object))
-               signal_after_change (XINT (start), XINT (end) - XINT (start),
-                                    XINT (end) - XINT (start));
+               signal_after_change (XFIXNUM (start), XFIXNUM (end) - XFIXNUM 
(start),
+                                    XFIXNUM (end) - XFIXNUM (start));
 
              eassert (modified);
              return Qt;
@@ -1232,8 +1232,8 @@ add_text_properties_1 (Lisp_Object start, Lisp_Object end,
            {
              add_properties (properties, i, object, set_type);
              if (BUFFERP (object))
-               signal_after_change (XINT (start), XINT (end) - XINT (start),
-                                    XINT (end) - XINT (start));
+               signal_after_change (XFIXNUM (start), XFIXNUM (end) - XFIXNUM 
(start),
+                                    XFIXNUM (end) - XFIXNUM (start));
              return Qt;
            }
 
@@ -1243,8 +1243,8 @@ add_text_properties_1 (Lisp_Object start, Lisp_Object end,
          copy_properties (unchanged, i);
          add_properties (properties, i, object, set_type);
          if (BUFFERP (object))
-           signal_after_change (XINT (start), XINT (end) - XINT (start),
-                                XINT (end) - XINT (start));
+           signal_after_change (XFIXNUM (start), XFIXNUM (end) - XFIXNUM 
(start),
+                                XFIXNUM (end) - XFIXNUM (start));
          return Qt;
        }
 
@@ -1363,8 +1363,8 @@ set_text_properties (Lisp_Object start, Lisp_Object end, 
Lisp_Object properties,
   /* If we want no properties for a whole string,
      get rid of its intervals.  */
   if (NILP (properties) && STRINGP (object)
-      && XFASTINT (start) == 0
-      && XFASTINT (end) == SCHARS (object))
+      && XFIXNAT (start) == 0
+      && XFIXNAT (end) == SCHARS (object))
     {
       if (!string_intervals (object))
        return Qnil;
@@ -1413,8 +1413,8 @@ set_text_properties (Lisp_Object start, Lisp_Object end, 
Lisp_Object properties,
   set_text_properties_1 (start, end, properties, object, i);
 
   if (BUFFERP (object) && !NILP (coherent_change_p))
-    signal_after_change (XINT (start), XINT (end) - XINT (start),
-                        XINT (end) - XINT (start));
+    signal_after_change (XFIXNUM (start), XFIXNUM (end) - XFIXNUM (start),
+                        XFIXNUM (end) - XFIXNUM (start));
   return Qt;
 }
 
@@ -1431,15 +1431,15 @@ set_text_properties_1 (Lisp_Object start, Lisp_Object 
end, Lisp_Object propertie
   register ptrdiff_t s, len;
   INTERVAL unchanged;
 
-  if (XINT (start) < XINT (end))
+  if (XFIXNUM (start) < XFIXNUM (end))
     {
-      s = XINT (start);
-      len = XINT (end) - s;
+      s = XFIXNUM (start);
+      len = XFIXNUM (end) - s;
     }
-  else if (XINT (end) < XINT (start))
+  else if (XFIXNUM (end) < XFIXNUM (start))
     {
-      s = XINT (end);
-      len = XINT (start) - s;
+      s = XFIXNUM (end);
+      len = XFIXNUM (start) - s;
     }
   else
     return;
@@ -1531,8 +1531,8 @@ Use `set-text-properties' if you want to remove all text 
properties.  */)
   if (!i)
     return Qnil;
 
-  s = XINT (start);
-  len = XINT (end) - s;
+  s = XFIXNUM (start);
+  len = XFIXNUM (end) - s;
 
   /* If there are no properties on this entire interval, return.  */
   if (! interval_has_some_properties (properties, i))
@@ -1589,8 +1589,8 @@ Use `set-text-properties' if you want to remove all text 
properties.  */)
            {
              eassert (modified);
              if (BUFFERP (object))
-               signal_after_change (XINT (start), XINT (end) - XINT (start),
-                                    XINT (end) - XINT (start));
+               signal_after_change (XFIXNUM (start), XFIXNUM (end) - XFIXNUM 
(start),
+                                    XFIXNUM (end) - XFIXNUM (start));
              return Qt;
            }
 
@@ -1598,8 +1598,8 @@ Use `set-text-properties' if you want to remove all text 
properties.  */)
            {
              remove_properties (properties, Qnil, i, object);
              if (BUFFERP (object))
-               signal_after_change (XINT (start), XINT (end) - XINT (start),
-                                    XINT (end) - XINT (start));
+               signal_after_change (XFIXNUM (start), XFIXNUM (end) - XFIXNUM 
(start),
+                                    XFIXNUM (end) - XFIXNUM (start));
              return Qt;
            }
 
@@ -1609,8 +1609,8 @@ Use `set-text-properties' if you want to remove all text 
properties.  */)
          copy_properties (unchanged, i);
          remove_properties (properties, Qnil, i, object);
          if (BUFFERP (object))
-           signal_after_change (XINT (start), XINT (end) - XINT (start),
-                                XINT (end) - XINT (start));
+           signal_after_change (XFIXNUM (start), XFIXNUM (end) - XFIXNUM 
(start),
+                                XFIXNUM (end) - XFIXNUM (start));
          return Qt;
        }
 
@@ -1643,8 +1643,8 @@ Return t if any property was actually removed, nil 
otherwise.  */)
   if (!i)
     return Qnil;
 
-  s = XINT (start);
-  len = XINT (end) - s;
+  s = XFIXNUM (start);
+  len = XFIXNUM (end) - s;
 
   /* If there are no properties on the interval, return.  */
   if (! interval_has_some_properties_list (properties, i))
@@ -1687,9 +1687,9 @@ Return t if any property was actually removed, nil 
otherwise.  */)
              if (modified)
                {
                  if (BUFFERP (object))
-                   signal_after_change (XINT (start),
-                                        XINT (end) - XINT (start),
-                                        XINT (end) - XINT (start));
+                   signal_after_change (XFIXNUM (start),
+                                        XFIXNUM (end) - XFIXNUM (start),
+                                        XFIXNUM (end) - XFIXNUM (start));
                  return Qt;
                }
              else
@@ -1701,8 +1701,8 @@ Return t if any property was actually removed, nil 
otherwise.  */)
                modify_text_properties (object, start, end);
              remove_properties (Qnil, properties, i, object);
              if (BUFFERP (object))
-               signal_after_change (XINT (start), XINT (end) - XINT (start),
-                                    XINT (end) - XINT (start));
+               signal_after_change (XFIXNUM (start), XFIXNUM (end) - XFIXNUM 
(start),
+                                    XFIXNUM (end) - XFIXNUM (start));
              return Qt;
            }
          else
@@ -1714,8 +1714,8 @@ Return t if any property was actually removed, nil 
otherwise.  */)
                modify_text_properties (object, start, end);
              remove_properties (Qnil, properties, i, object);
              if (BUFFERP (object))
-               signal_after_change (XINT (start), XINT (end) - XINT (start),
-                                    XINT (end) - XINT (start));
+               signal_after_change (XFIXNUM (start), XFIXNUM (end) - XFIXNUM 
(start),
+                                    XFIXNUM (end) - XFIXNUM (start));
              return Qt;
            }
        }
@@ -1733,9 +1733,9 @@ Return t if any property was actually removed, nil 
otherwise.  */)
           if (modified)
             {
               if (BUFFERP (object))
-                signal_after_change (XINT (start),
-                                     XINT (end) - XINT (start),
-                                     XINT (end) - XINT (start));
+                signal_after_change (XFIXNUM (start),
+                                     XFIXNUM (end) - XFIXNUM (start),
+                                     XFIXNUM (end) - XFIXNUM (start));
               return Qt;
             }
           else
@@ -1762,7 +1762,7 @@ markers).  If OBJECT is a string, START and END are 
0-based indices into it.  */
   i = validate_interval_range (object, &start, &end, soft);
   if (!i)
     return (!NILP (value) || EQ (start, end) ? Qnil : start);
-  e = XINT (end);
+  e = XFIXNUM (end);
 
   while (i)
     {
@@ -1771,9 +1771,9 @@ markers).  If OBJECT is a string, START and END are 
0-based indices into it.  */
       if (EQ (textget (i->plist, property), value))
        {
          pos = i->position;
-         if (pos < XINT (start))
-           pos = XINT (start);
-         return make_number (pos);
+         if (pos < XFIXNUM (start))
+           pos = XFIXNUM (start);
+         return make_fixnum (pos);
        }
       i = next_interval (i);
     }
@@ -1798,8 +1798,8 @@ markers).  If OBJECT is a string, START and END are 
0-based indices into it.  */
   i = validate_interval_range (object, &start, &end, soft);
   if (!i)
     return (NILP (value) || EQ (start, end)) ? Qnil : start;
-  s = XINT (start);
-  e = XINT (end);
+  s = XFIXNUM (start);
+  e = XFIXNUM (end);
 
   while (i)
     {
@@ -1809,7 +1809,7 @@ markers).  If OBJECT is a string, START and END are 
0-based indices into it.  */
        {
          if (i->position > s)
            s = i->position;
-         return make_number (s);
+         return make_fixnum (s);
        }
       i = next_interval (i);
     }
@@ -1827,7 +1827,7 @@ int
 text_property_stickiness (Lisp_Object prop, Lisp_Object pos, Lisp_Object 
buffer)
 {
   bool ignore_previous_character;
-  Lisp_Object prev_pos = make_number (XINT (pos) - 1);
+  Lisp_Object prev_pos = make_fixnum (XFIXNUM (pos) - 1);
   Lisp_Object front_sticky;
   bool is_rear_sticky = true, is_front_sticky = false; /* defaults */
   Lisp_Object defalt = Fassq (prop, Vtext_property_default_nonsticky);
@@ -1835,7 +1835,7 @@ text_property_stickiness (Lisp_Object prop, Lisp_Object 
pos, Lisp_Object buffer)
   if (NILP (buffer))
     XSETBUFFER (buffer, current_buffer);
 
-  ignore_previous_character = XINT (pos) <= BUF_BEGV (XBUFFER (buffer));
+  ignore_previous_character = XFIXNUM (pos) <= BUF_BEGV (XBUFFER (buffer));
 
   if (ignore_previous_character || (CONSP (defalt) && !NILP (XCDR (defalt))))
     is_rear_sticky = false;
@@ -1907,11 +1907,11 @@ copy_text_properties (Lisp_Object start, Lisp_Object 
end, Lisp_Object src,
   if (!i)
     return Qnil;
 
-  CHECK_NUMBER_COERCE_MARKER (pos);
+  CHECK_FIXNUM_COERCE_MARKER (pos);
   {
     Lisp_Object dest_start, dest_end;
 
-    e = XINT (pos) + (XINT (end) - XINT (start));
+    e = XFIXNUM (pos) + (XFIXNUM (end) - XFIXNUM (start));
     if (MOST_POSITIVE_FIXNUM < e)
       args_out_of_range (pos, end);
     dest_start = pos;
@@ -1921,9 +1921,9 @@ copy_text_properties (Lisp_Object start, Lisp_Object end, 
Lisp_Object src,
     validate_interval_range (dest, &dest_start, &dest_end, soft);
   }
 
-  s = XINT (start);
-  e = XINT (end);
-  p = XINT (pos);
+  s = XFIXNUM (start);
+  e = XFIXNUM (end);
+  p = XFIXNUM (pos);
 
   stuff = Qnil;
 
@@ -1948,7 +1948,7 @@ copy_text_properties (Lisp_Object start, Lisp_Object end, 
Lisp_Object src,
       if (! NILP (plist))
        /* Must defer modifications to the interval tree in case
           src and dest refer to the same string or buffer.  */
-       stuff = Fcons (list3 (make_number (p), make_number (p + len), plist),
+       stuff = Fcons (list3 (make_fixnum (p), make_fixnum (p + len), plist),
                       stuff);
 
       i = next_interval (i);
@@ -1991,8 +1991,8 @@ text_property_list (Lisp_Object object, Lisp_Object 
start, Lisp_Object end, Lisp
   i = validate_interval_range (object, &start, &end, soft);
   if (i)
     {
-      ptrdiff_t s = XINT (start);
-      ptrdiff_t e = XINT (end);
+      ptrdiff_t s = XFIXNUM (start);
+      ptrdiff_t e = XFIXNUM (end);
 
       while (s < e)
        {
@@ -2015,7 +2015,7 @@ text_property_list (Lisp_Object object, Lisp_Object 
start, Lisp_Object end, Lisp
                }
 
          if (!NILP (plist))
-           result = Fcons (list3 (make_number (s), make_number (s + len),
+           result = Fcons (list3 (make_fixnum (s), make_fixnum (s + len),
                                   plist),
                            result);
 
@@ -2043,8 +2043,8 @@ add_text_properties_from_list (Lisp_Object object, 
Lisp_Object list, Lisp_Object
       Lisp_Object item, start, end, plist;
 
       item = XCAR (list);
-      start = make_number (XINT (XCAR (item)) + XINT (delta));
-      end = make_number (XINT (XCAR (XCDR (item))) + XINT (delta));
+      start = make_fixnum (XFIXNUM (XCAR (item)) + XFIXNUM (delta));
+      end = make_fixnum (XFIXNUM (XCAR (XCDR (item))) + XFIXNUM (delta));
       plist = XCAR (XCDR (XCDR (item)));
 
       Fadd_text_properties (start, end, plist, object);
@@ -2062,7 +2062,7 @@ Lisp_Object
 extend_property_ranges (Lisp_Object list, Lisp_Object old_end, Lisp_Object 
new_end)
 {
   Lisp_Object prev = Qnil, head = list;
-  ptrdiff_t max = XINT (new_end);
+  ptrdiff_t max = XFIXNUM (new_end);
 
   for (; CONSP (list); prev = list, list = XCDR (list))
     {
@@ -2071,9 +2071,9 @@ extend_property_ranges (Lisp_Object list, Lisp_Object 
old_end, Lisp_Object new_e
 
       item = XCAR (list);
       beg = XCAR (item);
-      end = XINT (XCAR (XCDR (item)));
+      end = XFIXNUM (XCAR (XCDR (item)));
 
-      if (XINT (beg) >= max)
+      if (XFIXNUM (beg) >= max)
        {
          /* The start-point is past the end of the new string.
             Discard this property.  */
@@ -2082,7 +2082,7 @@ extend_property_ranges (Lisp_Object list, Lisp_Object 
old_end, Lisp_Object new_e
          else
            XSETCDR (prev, XCDR (list));
        }
-      else if ((end == XINT (old_end) && end != max)
+      else if ((end == XFIXNUM (old_end) && end != max)
               || end > max)
        {
          /* Either the end-point is past the end of the new string,
@@ -2287,8 +2287,8 @@ verify_interval_modification (struct buffer *buf,
          hooks = Fnreverse (hooks);
          while (! NILP (hooks))
            {
-             call_mod_hooks (Fcar (hooks), make_number (start),
-                             make_number (end));
+             call_mod_hooks (Fcar (hooks), make_fixnum (start),
+                             make_fixnum (end));
              hooks = Fcdr (hooks);
            }
        }
diff --git a/src/undo.c b/src/undo.c
index c34faa4..1975e38 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -74,7 +74,7 @@ record_point (ptrdiff_t beg)
       && point_before_last_command_or_undo != beg
       && buffer_before_last_command_or_undo == current_buffer )
     bset_undo_list (current_buffer,
-                   Fcons (make_number (point_before_last_command_or_undo),
+                   Fcons (make_fixnum (point_before_last_command_or_undo),
                           BVAR (current_buffer, undo_list)));
 }
 
@@ -102,11 +102,11 @@ record_insert (ptrdiff_t beg, ptrdiff_t length)
       Lisp_Object elt;
       elt = XCAR (BVAR (current_buffer, undo_list));
       if (CONSP (elt)
-         && INTEGERP (XCAR (elt))
-         && INTEGERP (XCDR (elt))
-         && XINT (XCDR (elt)) == beg)
+         && FIXNUMP (XCAR (elt))
+         && FIXNUMP (XCDR (elt))
+         && XFIXNUM (XCDR (elt)) == beg)
        {
-         XSETCDR (elt, make_number (beg + length));
+         XSETCDR (elt, make_fixnum (beg + length));
          return;
        }
     }
@@ -126,15 +126,11 @@ record_insert (ptrdiff_t beg, ptrdiff_t length)
 static void
 record_marker_adjustments (ptrdiff_t from, ptrdiff_t to)
 {
-  Lisp_Object marker;
-  register struct Lisp_Marker *m;
-  register ptrdiff_t charpos, adjustment;
-
-  prepare_record();
+  prepare_record ();
 
-  for (m = BUF_MARKERS (current_buffer); m; m = m->next)
+  for (struct Lisp_Marker *m = BUF_MARKERS (current_buffer); m; m = m->next)
     {
-      charpos = m->charpos;
+      ptrdiff_t charpos = m->charpos;
       eassert (charpos <= Z);
 
       if (from <= charpos && charpos <= to)
@@ -146,14 +142,14 @@ record_marker_adjustments (ptrdiff_t from, ptrdiff_t to)
              insertion_type t markers will automatically move forward
              upon re-inserting the deleted text, so we have to arrange
              for them to move backward to the correct position.  */
-          adjustment = (m->insertion_type ? to : from) - charpos;
+         ptrdiff_t adjustment = (m->insertion_type ? to : from) - charpos;
 
           if (adjustment)
             {
-              XSETMISC (marker, m);
+             Lisp_Object marker = make_lisp_ptr (m, Lisp_Vectorlike);
               bset_undo_list
                 (current_buffer,
-                 Fcons (Fcons (marker, make_number (adjustment)),
+                 Fcons (Fcons (marker, make_fixnum (adjustment)),
                         BVAR (current_buffer, undo_list)));
             }
         }
@@ -352,14 +348,14 @@ truncate_undo_list (struct buffer *b)
 
   /* If by the first boundary we have already passed undo_outer_limit,
      we're heading for memory full, so offer to clear out the list.  */
-  if (INTEGERP (Vundo_outer_limit)
-      && size_so_far > XINT (Vundo_outer_limit)
+  if (FIXNUMP (Vundo_outer_limit)
+      && size_so_far > XFIXNUM (Vundo_outer_limit)
       && !NILP (Vundo_outer_limit_function))
     {
       Lisp_Object tem;
 
       /* Normally the function this calls is undo-outer-limit-truncate.  */
-      tem = call1 (Vundo_outer_limit_function, make_number (size_so_far));
+      tem = call1 (Vundo_outer_limit_function, make_fixnum (size_so_far));
       if (! NILP (tem))
        {
          /* The function is responsible for making
@@ -472,7 +468,7 @@ In fact, this calls the function which is the value of
 `undo-outer-limit-function' with one argument, the size.
 The text above describes the behavior of the function
 that variable usually specifies.  */);
-  Vundo_outer_limit = make_number (12000000);
+  Vundo_outer_limit = make_fixnum (12000000);
 
   DEFVAR_LISP ("undo-outer-limit-function", Vundo_outer_limit_function,
               doc: /* Function to call when an undo list exceeds 
`undo-outer-limit'.
diff --git a/src/unexcw.c b/src/unexcw.c
index 762b996..dea9f6a 100644
--- a/src/unexcw.c
+++ b/src/unexcw.c
@@ -48,7 +48,7 @@ static exe_header_t *
 read_exe_header (int fd, exe_header_t * exe_header_buffer)
 {
   int i;
-  int ret;
+  int ret ATTRIBUTE_UNUSED;
 
   assert (fd >= 0);
   assert (exe_header_buffer != 0);
@@ -111,7 +111,7 @@ fixup_executable (int fd)
   exe_header_t exe_header_buffer;
   exe_header_t *exe_header;
   int i;
-  int ret;
+  int ret ATTRIBUTE_UNUSED;
   int found_data = 0;
   int found_bss = 0;
 
@@ -269,7 +269,7 @@ unexec (const char *outfile, const char *infile)
   int fd_in;
   int fd_out;
   int ret;
-  int ret2;
+  int ret2 ATTRIBUTE_UNUSED;
 
   infile = add_exe_suffix_if_necessary (infile, infile_buffer);
   outfile = add_exe_suffix_if_necessary (outfile, outfile_buffer);
diff --git a/src/w16select.c b/src/w16select.c
index 5a80d1c..a5f0757 100644
--- a/src/w16select.c
+++ b/src/w16select.c
@@ -536,7 +536,7 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, 
Sw16_set_clipboard_dat
            message3 (make_unibyte_string (system_error_msg, sizeof 
(system_error_msg) - 1));
            break;
        }
-      sit_for (make_number (2), 0, 2);
+      sit_for (make_fixnum (2), 0, 2);
     }
 
  done:
diff --git a/src/w32.c b/src/w32.c
index c848b33..ef60475 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -7042,8 +7042,8 @@ system_process_attributes (Lisp_Object pid)
   double pcpu;
   BOOL result = FALSE;
 
-  CHECK_NUMBER_OR_FLOAT (pid);
-  proc_id = FLOATP (pid) ? XFLOAT_DATA (pid) : XINT (pid);
+  CHECK_FIXNUM_OR_FLOAT (pid);
+  proc_id = FLOATP (pid) ? XFLOAT_DATA (pid) : XFIXNUM (pid);
 
   h_snapshot = create_toolhelp32_snapshot (TH32CS_SNAPPROCESS, 0);
 
@@ -7074,7 +7074,7 @@ system_process_attributes (Lisp_Object pid)
              attrs = Fcons (Fcons (Qppid,
                                    make_fixnum_or_float 
(pe.th32ParentProcessID)),
                             attrs);
-             attrs = Fcons (Fcons (Qpri, make_number (pe.pcPriClassBase)),
+             attrs = Fcons (Fcons (Qpri, make_fixnum (pe.pcPriClassBase)),
                             attrs);
              attrs = Fcons (Fcons (Qthcount,
                                    make_fixnum_or_float (pe.cntThreads)),
@@ -9214,7 +9214,7 @@ network_interface_get_info (Lisp_Object ifname)
                         res);
          else if (strcmp (namebuf, SSDATA (ifname)) == 0)
            {
-             Lisp_Object hwaddr = Fmake_vector (make_number (6), Qnil);
+             Lisp_Object hwaddr = Fmake_vector (make_fixnum (6), Qnil);
              register struct Lisp_Vector *p = XVECTOR (hwaddr);
              Lisp_Object flags = Qnil;
              int n;
@@ -9243,11 +9243,11 @@ network_interface_get_info (Lisp_Object ifname)
 
              /* Hardware address and its family.  */
              for (n = 0; n < adapter->AddressLength; n++)
-               p->contents[n] = make_number ((int) adapter->Address[n]);
+               p->contents[n] = make_fixnum ((int) adapter->Address[n]);
              /* Windows does not support AF_LINK or AF_PACKET family
                 of addresses.  Use an arbitrary family number that is
                 identical to what GNU/Linux returns.  */
-             res = Fcons (Fcons (make_number (1), hwaddr), res);
+             res = Fcons (Fcons (make_fixnum (1), hwaddr), res);
 
              /* Network mask.  */
              sa.sin_family = AF_INET;
@@ -9309,9 +9309,9 @@ network_interface_get_info (Lisp_Object ifname)
                                         Fcons (intern ("up"), Qnil))), Qnil);
              /* 772 is what 3 different GNU/Linux systems report for
                 the loopback interface.  */
-             res = Fcons (Fcons (make_number (772),
-                                 Fmake_vector (make_number (6),
-                                               make_number (0))),
+             res = Fcons (Fcons (make_fixnum (772),
+                                 Fmake_vector (make_fixnum (6),
+                                               make_fixnum (0))),
                           res);
              sa.sin_addr.s_addr = sys_inet_addr ("255.0.0.0");
              res = Fcons (conv_sockaddr_to_lisp ((struct sockaddr *) &sa,
@@ -9358,7 +9358,7 @@ w32_read_registry (HKEY rootkey, Lisp_Object lkey, 
Lisp_Object lname)
   DWORD vsize, vtype;
   LPBYTE pvalue;
   Lisp_Object val, retval;
-  const char *key, *value_name;
+  const char *key, *value_name = NULL;
   /* The following sizes are according to size limitations
      documented in MSDN.  */
   wchar_t key_w[255+1];
@@ -9456,7 +9456,7 @@ w32_read_registry (HKEY rootkey, Lisp_Object lkey, 
Lisp_Object lname)
 
          val = make_uninit_vector (vsize);
          for (i = 0; i < vsize; i++)
-           ASET (val, i, make_number (dbuf[i]));
+           ASET (val, i, make_fixnum (dbuf[i]));
 
          retval = val;
          break;
@@ -10106,8 +10106,8 @@ serial_configure (struct Lisp_Process *p, Lisp_Object 
contact)
     tem = Fplist_get (contact, QCspeed);
   else
     tem = Fplist_get (p->childp, QCspeed);
-  CHECK_NUMBER (tem);
-  dcb.BaudRate = XINT (tem);
+  CHECK_FIXNUM (tem);
+  dcb.BaudRate = XFIXNUM (tem);
   childp2 = Fplist_put (childp2, QCspeed, tem);
 
   /* Configure bytesize.  */
@@ -10116,12 +10116,12 @@ serial_configure (struct Lisp_Process *p, Lisp_Object 
contact)
   else
     tem = Fplist_get (p->childp, QCbytesize);
   if (NILP (tem))
-    tem = make_number (8);
-  CHECK_NUMBER (tem);
-  if (XINT (tem) != 7 && XINT (tem) != 8)
+    tem = make_fixnum (8);
+  CHECK_FIXNUM (tem);
+  if (XFIXNUM (tem) != 7 && XFIXNUM (tem) != 8)
     error (":bytesize must be nil (8), 7, or 8");
-  dcb.ByteSize = XINT (tem);
-  summary[0] = XINT (tem) + '0';
+  dcb.ByteSize = XFIXNUM (tem);
+  summary[0] = XFIXNUM (tem) + '0';
   childp2 = Fplist_put (childp2, QCbytesize, tem);
 
   /* Configure parity.  */
@@ -10160,14 +10160,14 @@ serial_configure (struct Lisp_Process *p, Lisp_Object 
contact)
   else
     tem = Fplist_get (p->childp, QCstopbits);
   if (NILP (tem))
-    tem = make_number (1);
-  CHECK_NUMBER (tem);
-  if (XINT (tem) != 1 && XINT (tem) != 2)
+    tem = make_fixnum (1);
+  CHECK_FIXNUM (tem);
+  if (XFIXNUM (tem) != 1 && XFIXNUM (tem) != 2)
     error (":stopbits must be nil (1 stopbit), 1, or 2");
-  summary[2] = XINT (tem) + '0';
-  if (XINT (tem) == 1)
+  summary[2] = XFIXNUM (tem) + '0';
+  if (XFIXNUM (tem) == 1)
     dcb.StopBits = ONESTOPBIT;
-  else if (XINT (tem) == 2)
+  else if (XFIXNUM (tem) == 2)
     dcb.StopBits = TWOSTOPBITS;
   childp2 = Fplist_put (childp2, QCstopbits, tem);
 
diff --git a/src/w32console.c b/src/w32console.c
index 330aef5..6c3cf06 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -493,7 +493,7 @@ w32con_set_terminal_modes (struct terminal *t)
 
   /* Initialize input mode: interrupt_input off, no flow control, allow
      8 bit character input, standard quit char.  */
-  Fset_input_mode (Qnil, Qnil, make_number (2), Qnil);
+  Fset_input_mode (Qnil, Qnil, make_fixnum (2), Qnil);
 }
 
 /* hmmm... perhaps these let us bracket screen changes so that we can flush
@@ -791,7 +791,7 @@ DEFUN ("set-screen-color", Fset_screen_color, 
Sset_screen_color, 2, 2, 0,
 Arguments should be indices between 0 and 15, see w32console.el.  */)
   (Lisp_Object foreground, Lisp_Object background)
 {
-  char_attr_normal = XFASTINT (foreground) + (XFASTINT (background) << 4);
+  char_attr_normal = XFIXNAT (foreground) + (XFIXNAT (background) << 4);
 
   Frecenter (Qnil, Qt);
   return Qt;
@@ -805,8 +805,8 @@ See w32console.el and `tty-defined-color-alist' for mapping 
of indices
 to colors.  */)
   (void)
 {
-  return Fcons (make_number (char_attr_normal & 0x000f),
-               Fcons (make_number ((char_attr_normal >> 4) & 0x000f), Qnil));
+  return Fcons (make_fixnum (char_attr_normal & 0x000f),
+               Fcons (make_fixnum ((char_attr_normal >> 4) & 0x000f), Qnil));
 }
 
 DEFUN ("set-cursor-size", Fset_cursor_size, Sset_cursor_size, 1, 1, 0,
@@ -814,7 +814,7 @@ DEFUN ("set-cursor-size", Fset_cursor_size, 
Sset_cursor_size, 1, 1, 0,
   (Lisp_Object size)
 {
   CONSOLE_CURSOR_INFO cci;
-  cci.dwSize = XFASTINT (size);
+  cci.dwSize = XFIXNAT (size);
   cci.bVisible = TRUE;
   (void) SetConsoleCursorInfo (cur_screen, &cci);
 
diff --git a/src/w32cygwinx.c b/src/w32cygwinx.c
index 5d48c3a..bc40123 100644
--- a/src/w32cygwinx.c
+++ b/src/w32cygwinx.c
@@ -116,14 +116,14 @@ The following %-sequences are provided:
        }
 
       status = listn (CONSTYPE_HEAP, 8,
-                     Fcons (make_number ('L'), line_status),
-                     Fcons (make_number ('B'), battery_status),
-                     Fcons (make_number ('b'), battery_status_symbol),
-                     Fcons (make_number ('p'), load_percentage),
-                     Fcons (make_number ('s'), seconds),
-                     Fcons (make_number ('m'), minutes),
-                     Fcons (make_number ('h'), hours),
-                     Fcons (make_number ('t'), remain));
+                     Fcons (make_fixnum ('L'), line_status),
+                     Fcons (make_fixnum ('B'), battery_status),
+                     Fcons (make_fixnum ('b'), battery_status_symbol),
+                     Fcons (make_fixnum ('p'), load_percentage),
+                     Fcons (make_fixnum ('s'), seconds),
+                     Fcons (make_fixnum ('m'), minutes),
+                     Fcons (make_fixnum ('h'), hours),
+                     Fcons (make_fixnum ('t'), remain));
     }
   return status;
 }
diff --git a/src/w32fns.c b/src/w32fns.c
index 760801c..8d5293c 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -457,12 +457,12 @@ if the entry is new.  */)
   Lisp_Object oldrgb = Qnil;
   Lisp_Object entry;
 
-  CHECK_NUMBER (red);
-  CHECK_NUMBER (green);
-  CHECK_NUMBER (blue);
+  CHECK_FIXNUM (red);
+  CHECK_FIXNUM (green);
+  CHECK_FIXNUM (blue);
   CHECK_STRING (name);
 
-  XSETINT (rgb, RGB (XUINT (red), XUINT (green), XUINT (blue)));
+  XSETINT (rgb, RGB (XUFIXNUM (red), XUFIXNUM (green), XUFIXNUM (blue)));
 
   block_input ();
 
@@ -748,7 +748,7 @@ w32_default_color_map (void)
 
   for (i = 0; i < ARRAYELTS (w32_color_map); pc++, i++)
     cmap = Fcons (Fcons (build_string (pc->name),
-                        make_number (pc->colorref)),
+                        make_fixnum (pc->colorref)),
                  cmap);
 
   unblock_input ();
@@ -828,7 +828,7 @@ add_system_logical_colors_to_map (Lisp_Object 
*system_colors)
          unsigned r, g, b;
          if (sscanf (color_buffer, " %u %u %u", &r, &g, &b) == 3)
            *system_colors = Fcons (Fcons (build_string (full_name_buffer),
-                                          make_number (RGB (r, g, b))),
+                                          make_fixnum (RGB (r, g, b))),
                                    *system_colors);
 
          name_size = sizeof (full_name_buffer) - SYSTEM_COLOR_PREFIX_LEN;
@@ -1182,7 +1182,7 @@ w32_defined_color (struct frame *f, const char *color, 
XColor *color_def,
       if (f)
        {
          /* Apply gamma correction.  */
-         w32_color_ref = XUINT (tem);
+         w32_color_ref = XUFIXNUM (tem);
          gamma_correct (f, &w32_color_ref);
          XSETINT (tem, w32_color_ref);
        }
@@ -1198,7 +1198,7 @@ w32_defined_color (struct frame *f, const char *color, 
XColor *color_def,
          /* check if color is already mapped */
          while (entry)
            {
-             if (W32_COLOR (entry->entry) == XUINT (tem))
+             if (W32_COLOR (entry->entry) == XUFIXNUM (tem))
                break;
              prev = &entry->next;
              entry = entry->next;
@@ -1208,7 +1208,7 @@ w32_defined_color (struct frame *f, const char *color, 
XColor *color_def,
            {
              /* not already mapped, so add to list */
              entry = xmalloc (sizeof (struct w32_palette_entry));
-             SET_W32_COLOR (entry->entry, XUINT (tem));
+             SET_W32_COLOR (entry->entry, XUFIXNUM (tem));
              entry->next = NULL;
              *prev = entry;
              one_w32_display_info.num_colors++;
@@ -1220,7 +1220,7 @@ w32_defined_color (struct frame *f, const char *color, 
XColor *color_def,
       /* Ensure COLORREF value is snapped to nearest color in (default)
         palette by simulating the PALETTERGB macro.  This works whether
         or not the display device has a palette. */
-      w32_color_ref = XUINT (tem) | 0x2000000;
+      w32_color_ref = XUFIXNUM (tem) | 0x2000000;
 
       color_def->pixel = w32_color_ref;
       color_def->red = GetRValue (w32_color_ref) * 256;
@@ -1343,8 +1343,8 @@ x_set_mouse_color (struct frame *f, Lisp_Object arg, 
Lisp_Object oldval)
 
   if (!EQ (Qnil, Vx_pointer_shape))
     {
-      CHECK_NUMBER (Vx_pointer_shape);
-      cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XINT 
(Vx_pointer_shape));
+      CHECK_FIXNUM (Vx_pointer_shape);
+      cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XFIXNUM 
(Vx_pointer_shape));
     }
   else
     cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_xterm);
@@ -1352,9 +1352,9 @@ x_set_mouse_color (struct frame *f, Lisp_Object arg, 
Lisp_Object oldval)
 
   if (!EQ (Qnil, Vx_nontext_pointer_shape))
     {
-      CHECK_NUMBER (Vx_nontext_pointer_shape);
+      CHECK_FIXNUM (Vx_nontext_pointer_shape);
       nontext_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f),
-                                         XINT (Vx_nontext_pointer_shape));
+                                         XFIXNUM (Vx_nontext_pointer_shape));
     }
   else
     nontext_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_left_ptr);
@@ -1362,9 +1362,9 @@ x_set_mouse_color (struct frame *f, Lisp_Object arg, 
Lisp_Object oldval)
 
   if (!EQ (Qnil, Vx_hourglass_pointer_shape))
     {
-      CHECK_NUMBER (Vx_hourglass_pointer_shape);
+      CHECK_FIXNUM (Vx_hourglass_pointer_shape);
       hourglass_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f),
-                                           XINT (Vx_hourglass_pointer_shape));
+                                           XFIXNUM 
(Vx_hourglass_pointer_shape));
     }
   else
     hourglass_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_watch);
@@ -1373,9 +1373,9 @@ x_set_mouse_color (struct frame *f, Lisp_Object arg, 
Lisp_Object oldval)
   x_check_errors (FRAME_W32_DISPLAY (f), "bad nontext pointer cursor: %s");
   if (!EQ (Qnil, Vx_mode_pointer_shape))
     {
-      CHECK_NUMBER (Vx_mode_pointer_shape);
+      CHECK_FIXNUM (Vx_mode_pointer_shape);
       mode_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f),
-                                      XINT (Vx_mode_pointer_shape));
+                                      XFIXNUM (Vx_mode_pointer_shape));
     }
   else
     mode_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_xterm);
@@ -1383,20 +1383,20 @@ x_set_mouse_color (struct frame *f, Lisp_Object arg, 
Lisp_Object oldval)
 
   if (!EQ (Qnil, Vx_sensitive_text_pointer_shape))
     {
-      CHECK_NUMBER (Vx_sensitive_text_pointer_shape);
+      CHECK_FIXNUM (Vx_sensitive_text_pointer_shape);
       hand_cursor
        = XCreateFontCursor (FRAME_W32_DISPLAY (f),
-                            XINT (Vx_sensitive_text_pointer_shape));
+                            XFIXNUM (Vx_sensitive_text_pointer_shape));
     }
   else
     hand_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_crosshair);
 
   if (!NILP (Vx_window_horizontal_drag_shape))
     {
-      CHECK_NUMBER (Vx_window_horizontal_drag_shape);
+      CHECK_FIXNUM (Vx_window_horizontal_drag_shape);
       horizontal_drag_cursor
        = XCreateFontCursor (FRAME_W32_DISPLAY (f),
-                            XINT (Vx_window_horizontal_drag_shape));
+                            XFIXNUM (Vx_window_horizontal_drag_shape));
     }
   else
     horizontal_drag_cursor
@@ -1404,10 +1404,10 @@ x_set_mouse_color (struct frame *f, Lisp_Object arg, 
Lisp_Object oldval)
 
   if (!NILP (Vx_window_vertical_drag_shape))
     {
-      CHECK_NUMBER (Vx_window_vertical_drag_shape);
+      CHECK_FIXNUM (Vx_window_vertical_drag_shape);
       vertical_drag_cursor
        = XCreateFontCursor (FRAME_W32_DISPLAY (f),
-                            XINT (Vx_window_vertical_drag_shape));
+                            XFIXNUM (Vx_window_vertical_drag_shape));
     }
   else
     vertical_drag_cursor
@@ -1689,7 +1689,7 @@ x_set_internal_border_width (struct frame *f, Lisp_Object 
arg, Lisp_Object oldva
   int border;
 
   CHECK_TYPE_RANGED_INTEGER (int, arg);
-  border = max (XINT (arg), 0);
+  border = max (XFIXNUM (arg), 0);
 
   if (border != FRAME_INTERNAL_BORDER_WIDTH (f))
     {
@@ -1725,7 +1725,7 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, 
Lisp_Object oldval)
   if (!FRAME_MINIBUF_ONLY_P (f) && !FRAME_PARENT_FRAME (f))
     {
       boolean old = FRAME_EXTERNAL_MENU_BAR (f);
-      boolean new = (INTEGERP (value) && XINT (value) > 0) ? true : false;
+      boolean new = (FIXNUMP (value) && XFIXNUM (value) > 0) ? true : false;
 
       FRAME_MENU_BAR_LINES (f) = 0;
       FRAME_MENU_BAR_HEIGHT (f) = 0;
@@ -1757,7 +1757,7 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, 
Lisp_Object oldval)
            x_clear_under_internal_border (f);
 
          /* Don't store anything but 1 or 0 in the parameter.  */
-         store_frame_param (f, Qmenu_bar_lines, make_number (new ? 1 : 0));
+         store_frame_param (f, Qmenu_bar_lines, make_fixnum (new ? 1 : 0));
        }
     }
 }
@@ -1780,8 +1780,8 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, 
Lisp_Object oldval)
     return;
 
   /* Use VALUE only if an integer >= 0.  */
-  if (INTEGERP (value) && XINT (value) >= 0)
-    nlines = XFASTINT (value);
+  if (FIXNUMP (value) && XFIXNUM (value) >= 0)
+    nlines = XFIXNAT (value);
   else
     nlines = 0;
 
@@ -1805,8 +1805,8 @@ x_change_tool_bar_height (struct frame *f, int height)
   FRAME_TOOL_BAR_HEIGHT (f) = height;
   FRAME_TOOL_BAR_LINES (f) = lines;
   /* Store `tool-bar-lines' and `height' frame parameters.  */
-  store_frame_param (f, Qtool_bar_lines, make_number (lines));
-  store_frame_param (f, Qheight, make_number (FRAME_LINES (f)));
+  store_frame_param (f, Qtool_bar_lines, make_fixnum (lines));
+  store_frame_param (f, Qheight, make_fixnum (FRAME_LINES (f)));
 
   if (FRAME_W32_WINDOW (f) && FRAME_TOOL_BAR_HEIGHT (f) == 0)
     {
@@ -2027,7 +2027,7 @@ x_set_undecorated (struct frame *f, Lisp_Object 
new_value, Lisp_Object old_value
   if (!NILP (new_value) && !FRAME_UNDECORATED (f))
     {
       dwStyle = ((dwStyle & ~WS_THICKFRAME & ~WS_CAPTION)
-                | ((NUMBERP (border_width) && (XINT (border_width) > 0))
+                | ((FIXED_OR_FLOATP (border_width) && (XFIXNUM (border_width) 
> 0))
                    ? WS_BORDER : false));
       SetWindowLong (hwnd, GWL_STYLE, dwStyle);
       SetWindowPos (hwnd, HWND_TOP, 0, 0, 0, 0,
@@ -2334,7 +2334,7 @@ w32_createwindow (struct frame *f, int *coords)
       if (FRAME_UNDECORATED (f))
        {
          /* If we want a thin border, specify it here.  */
-         if (NUMBERP (border_width) && (XINT (border_width) > 0))
+         if (FIXED_OR_FLOATP (border_width) && (XFIXNUM (border_width) > 0))
            f->output_data.w32->dwStyle |= WS_BORDER;
        }
       else
@@ -2350,7 +2350,7 @@ w32_createwindow (struct frame *f, int *coords)
       f->output_data.w32->dwStyle = WS_POPUP;
 
       /* If we want a thin border, specify it here.  */
-      if (NUMBERP (border_width) && (XINT (border_width) > 0))
+      if (FIXED_OR_FLOATP (border_width) && (XFIXNUM (border_width) > 0))
        f->output_data.w32->dwStyle |= WS_BORDER;
     }
   else
@@ -3116,10 +3116,10 @@ map_keypad_keys (unsigned int virt_key, unsigned int 
extended)
    (Windows 2000 and later).  */
 static Lisp_Object w32_grabbed_keys;
 
-#define HOTKEY(vk, mods)      make_number (((vk) & 255) | ((mods) << 8))
-#define HOTKEY_ID(k)          (XFASTINT (k) & 0xbfff)
-#define HOTKEY_VK_CODE(k)     (XFASTINT (k) & 255)
-#define HOTKEY_MODIFIERS(k)   (XFASTINT (k) >> 8)
+#define HOTKEY(vk, mods)      make_fixnum (((vk) & 255) | ((mods) << 8))
+#define HOTKEY_ID(k)          (XFIXNAT (k) & 0xbfff)
+#define HOTKEY_VK_CODE(k)     (XFIXNAT (k) & 255)
+#define HOTKEY_MODIFIERS(k)   (XFIXNAT (k) >> 8)
 
 #define RAW_HOTKEY_ID(k)        ((k) & 0xbfff)
 #define RAW_HOTKEY_VK_CODE(k)   ((k) & 255)
@@ -3140,7 +3140,7 @@ register_hot_keys (HWND hwnd)
       Lisp_Object key = XCAR (keylist);
 
       /* Deleted entries get set to nil.  */
-      if (!INTEGERP (key))
+      if (!FIXNUMP (key))
        continue;
 
       RegisterHotKey (hwnd, HOTKEY_ID (key),
@@ -3157,7 +3157,7 @@ unregister_hot_keys (HWND hwnd)
     {
       Lisp_Object key = XCAR (keylist);
 
-      if (!INTEGERP (key))
+      if (!FIXNUMP (key))
        continue;
 
       UnregisterHotKey (hwnd, HOTKEY_ID (key));
@@ -4199,8 +4199,8 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM 
lParam)
                 press of Space which we will ignore.  */
              if (GetAsyncKeyState (wParam) & 1)
                {
-                 if (NUMBERP (Vw32_phantom_key_code))
-                   key = XUINT (Vw32_phantom_key_code) & 255;
+                 if (FIXED_OR_FLOATP (Vw32_phantom_key_code))
+                   key = XUFIXNUM (Vw32_phantom_key_code) & 255;
                  else
                    key = VK_SPACE;
                  dpyinfo->faked_key = key;
@@ -4215,8 +4215,8 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM 
lParam)
            {
              if (GetAsyncKeyState (wParam) & 1)
                {
-                 if (NUMBERP (Vw32_phantom_key_code))
-                   key = XUINT (Vw32_phantom_key_code) & 255;
+                 if (FIXED_OR_FLOATP (Vw32_phantom_key_code))
+                   key = XUFIXNUM (Vw32_phantom_key_code) & 255;
                  else
                    key = VK_SPACE;
                  dpyinfo->faked_key = key;
@@ -5413,11 +5413,11 @@ my_create_window (struct frame * f)
   if (EQ (left, Qunbound))
     coords[0] = CW_USEDEFAULT;
   else
-    coords[0] = XINT (left);
+    coords[0] = XFIXNUM (left);
   if (EQ (top, Qunbound))
     coords[1] = CW_USEDEFAULT;
   else
-    coords[1] = XINT (top);
+    coords[1] = XFIXNUM (top);
 
   if (!PostThreadMessage (dwWindowsThreadId, WM_EMACS_CREATEWINDOW,
                          (WPARAM)f, (LPARAM)coords))
@@ -5529,8 +5529,8 @@ x_icon (struct frame *f, Lisp_Object parms)
   icon_y = x_get_arg (dpyinfo, parms, Qicon_top, 0, 0, RES_TYPE_NUMBER);
   if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound))
     {
-      CHECK_NUMBER (icon_x);
-      CHECK_NUMBER (icon_y);
+      CHECK_FIXNUM (icon_x);
+      CHECK_FIXNUM (icon_y);
     }
   else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound))
     error ("Both left and top icon corners of icon must be specified");
@@ -5728,7 +5728,7 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
   if (EQ (parent, Qunbound))
     parent = Qnil;
   else if (!NILP (parent))
-    CHECK_NUMBER (parent);
+    CHECK_FIXNUM (parent);
 
   /* make_frame_without_minibuffer can run Lisp code and garbage collect.  */
   /* No need to protect DISPLAY because that's not used after passing
@@ -5809,7 +5809,7 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
     {
       /* Cast to UINT_PTR shuts up compiler warnings about cast to
         pointer from integer of different size.  */
-      f->output_data.w32->parent_desc = (Window) (UINT_PTR) XFASTINT (parent);
+      f->output_data.w32->parent_desc = (Window) (UINT_PTR) XFIXNAT (parent);
       f->output_data.w32->explicit_parent = true;
     }
   else
@@ -5845,7 +5845,7 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
   x_default_font_parameter (f, parameters);
 
   /* Default BorderWidth to 0 to match other platforms.  */
-  x_default_parameter (f, parameters, Qborder_width, make_number (0),
+  x_default_parameter (f, parameters, Qborder_width, make_fixnum (0),
                       "borderWidth", "BorderWidth", RES_TYPE_NUMBER);
 
   /* We recognize either internalBorderWidth or internalBorder
@@ -5861,11 +5861,11 @@ DEFUN ("x-create-frame", Fx_create_frame, 
Sx_create_frame,
                            parameters);
     }
 
-  x_default_parameter (f, parameters, Qinternal_border_width, make_number (0),
+  x_default_parameter (f, parameters, Qinternal_border_width, make_fixnum (0),
                       "internalBorderWidth", "InternalBorder", 
RES_TYPE_NUMBER);
-  x_default_parameter (f, parameters, Qright_divider_width, make_number (0),
+  x_default_parameter (f, parameters, Qright_divider_width, make_fixnum (0),
                       NULL, NULL, RES_TYPE_NUMBER);
-  x_default_parameter (f, parameters, Qbottom_divider_width, make_number (0),
+  x_default_parameter (f, parameters, Qbottom_divider_width, make_fixnum (0),
                       NULL, NULL, RES_TYPE_NUMBER);
   x_default_parameter (f, parameters, Qvertical_scroll_bars, Qright,
                       "verticalScrollBars", "ScrollBars", RES_TYPE_SYMBOL);
@@ -5921,11 +5921,11 @@ DEFUN ("x-create-frame", Fx_create_frame, 
Sx_create_frame,
      because `frame-windows-min-size' needs them.  */
   tem = x_get_arg (dpyinfo, parameters, Qmin_width, NULL, NULL,
                   RES_TYPE_NUMBER);
-  if (NUMBERP (tem))
+  if (FIXED_OR_FLOATP (tem))
     store_frame_param (f, Qmin_width, tem);
   tem = x_get_arg (dpyinfo, parameters, Qmin_height, NULL, NULL,
                   RES_TYPE_NUMBER);
-  if (NUMBERP (tem))
+  if (FIXED_OR_FLOATP (tem))
     store_frame_param (f, Qmin_height, tem);
   adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f),
                     FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 5, true,
@@ -5938,16 +5938,16 @@ DEFUN ("x-create-frame", Fx_create_frame, 
Sx_create_frame,
     {
       x_default_parameter (f, parameters, Qmenu_bar_lines,
                           NILP (Vmenu_bar_mode)
-                          ? make_number (0) : make_number (1),
+                          ? make_fixnum (0) : make_fixnum (1),
                           NULL, NULL, RES_TYPE_NUMBER);
     }
   else
     /* No menu bar for child frames.  */
-    store_frame_param (f, Qmenu_bar_lines, make_number (0));
+    store_frame_param (f, Qmenu_bar_lines, make_fixnum (0));
 
   x_default_parameter (f, parameters, Qtool_bar_lines,
                       NILP (Vtool_bar_mode)
-                      ? make_number (0) : make_number (1),
+                      ? make_fixnum (0) : make_fixnum (1),
                       NULL, NULL, RES_TYPE_NUMBER);
 
   x_default_parameter (f, parameters, Qbuffer_predicate, Qnil,
@@ -6157,7 +6157,7 @@ DEFUN ("x-display-pixel-width", Fx_display_pixel_width,
 {
   struct w32_display_info *dpyinfo = check_x_display_info (display);
 
-  return make_number (x_display_pixel_width (dpyinfo));
+  return make_fixnum (x_display_pixel_width (dpyinfo));
 }
 
 DEFUN ("x-display-pixel-height", Fx_display_pixel_height,
@@ -6167,7 +6167,7 @@ DEFUN ("x-display-pixel-height", Fx_display_pixel_height,
 {
   struct w32_display_info *dpyinfo = check_x_display_info (display);
 
-  return make_number (x_display_pixel_height (dpyinfo));
+  return make_fixnum (x_display_pixel_height (dpyinfo));
 }
 
 DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes,
@@ -6177,7 +6177,7 @@ DEFUN ("x-display-planes", Fx_display_planes, 
Sx_display_planes,
 {
   struct w32_display_info *dpyinfo = check_x_display_info (display);
 
-  return make_number (dpyinfo->n_planes * dpyinfo->n_cbits);
+  return make_fixnum (dpyinfo->n_planes * dpyinfo->n_cbits);
 }
 
 DEFUN ("x-display-color-cells", Fx_display_color_cells, Sx_display_color_cells,
@@ -6194,7 +6194,7 @@ DEFUN ("x-display-color-cells", Fx_display_color_cells, 
Sx_display_color_cells,
    * anyway.  */
 
   cap = 1 << min (dpyinfo->n_planes * dpyinfo->n_cbits, 24);
-  return make_number (cap);
+  return make_fixnum (cap);
 }
 
 DEFUN ("x-server-max-request-size", Fx_server_max_request_size,
@@ -6203,7 +6203,7 @@ DEFUN ("x-server-max-request-size", 
Fx_server_max_request_size,
        doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object display)
 {
-  return make_number (1);
+  return make_fixnum (1);
 }
 
 DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0,
@@ -6224,7 +6224,7 @@ DEFUN ("x-display-screens", Fx_display_screens, 
Sx_display_screens, 0, 1, 0,
        doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object display)
 {
-  return make_number (1);
+  return make_fixnum (1);
 }
 
 DEFUN ("x-display-mm-height", Fx_display_mm_height,
@@ -6241,7 +6241,7 @@ DEFUN ("x-display-mm-height", Fx_display_mm_height,
                  / GetDeviceCaps (hdc, VERTRES));
   ReleaseDC (NULL, hdc);
 
-  return make_number (x_display_pixel_height (dpyinfo) * mm_per_pixel + 0.5);
+  return make_fixnum (x_display_pixel_height (dpyinfo) * mm_per_pixel + 0.5);
 }
 
 DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0,
@@ -6257,7 +6257,7 @@ DEFUN ("x-display-mm-width", Fx_display_mm_width, 
Sx_display_mm_width, 0, 1, 0,
                  / GetDeviceCaps (hdc, HORZRES));
   ReleaseDC (NULL, hdc);
 
-  return make_number (x_display_pixel_width (dpyinfo) * mm_per_pixel + 0.5);
+  return make_fixnum (x_display_pixel_width (dpyinfo) * mm_per_pixel + 0.5);
 }
 
 DEFUN ("x-display-backing-store", Fx_display_backing_store,
@@ -6334,7 +6334,7 @@ w32_display_monitor_attributes_list (void)
       monitor_list = XCDR (monitor_list);
     }
 
-  monitor_frames = Fmake_vector (make_number (n_monitors), Qnil);
+  monitor_frames = Fmake_vector (make_fixnum (n_monitors), Qnil);
   FOR_EACH_FRAME (rest, frame)
     {
       struct frame *f = XFRAME (frame);
@@ -6912,7 +6912,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, 
Lisp_Object parms)
      that are needed to determine window geometry.  */
   x_default_font_parameter (f, parms);
 
-  x_default_parameter (f, parms, Qborder_width, make_number (2),
+  x_default_parameter (f, parms, Qborder_width, make_fixnum (2),
                       "borderWidth", "BorderWidth", RES_TYPE_NUMBER);
   /* This defaults to 2 in order to match xterm.  We recognize either
      internalBorderWidth or internalBorder (which is what xterm calls
@@ -6928,7 +6928,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, 
Lisp_Object parms)
                       parms);
     }
 
-  x_default_parameter (f, parms, Qinternal_border_width, make_number (1),
+  x_default_parameter (f, parms, Qinternal_border_width, make_fixnum (1),
                       "internalBorderWidth", "internalBorderWidth",
                       RES_TYPE_NUMBER);
   /* Also do the stuff which must be set before the window exists.  */
@@ -7064,8 +7064,8 @@ compute_tip_xy (struct frame *f,
 
   /* Move the tooltip window where the mouse pointer is.  Resize and
      show it.  */
-  if ((!INTEGERP (left) && !INTEGERP (right))
-      || (!INTEGERP (top) && !INTEGERP (bottom)))
+  if ((!FIXNUMP (left) && !FIXNUMP (right))
+      || (!FIXNUMP (top) && !FIXNUMP (bottom)))
     {
       POINT pt;
 
@@ -7104,34 +7104,34 @@ compute_tip_xy (struct frame *f,
        }
     }
 
-  if (INTEGERP (top))
-    *root_y = XINT (top);
-  else if (INTEGERP (bottom))
-    *root_y = XINT (bottom) - height;
-  else if (*root_y + XINT (dy) <= min_y)
+  if (FIXNUMP (top))
+    *root_y = XFIXNUM (top);
+  else if (FIXNUMP (bottom))
+    *root_y = XFIXNUM (bottom) - height;
+  else if (*root_y + XFIXNUM (dy) <= min_y)
     *root_y = min_y; /* Can happen for negative dy */
-  else if (*root_y + XINT (dy) + height <= max_y)
+  else if (*root_y + XFIXNUM (dy) + height <= max_y)
     /* It fits below the pointer */
-      *root_y += XINT (dy);
-  else if (height + XINT (dy) + min_y <= *root_y)
+      *root_y += XFIXNUM (dy);
+  else if (height + XFIXNUM (dy) + min_y <= *root_y)
     /* It fits above the pointer.  */
-    *root_y -= height + XINT (dy);
+    *root_y -= height + XFIXNUM (dy);
   else
     /* Put it on the top.  */
     *root_y = min_y;
 
-  if (INTEGERP (left))
-    *root_x = XINT (left);
-  else if (INTEGERP (right))
-    *root_x = XINT (right) - width;
-  else if (*root_x + XINT (dx) <= min_x)
+  if (FIXNUMP (left))
+    *root_x = XFIXNUM (left);
+  else if (FIXNUMP (right))
+    *root_x = XFIXNUM (right) - width;
+  else if (*root_x + XFIXNUM (dx) <= min_x)
     *root_x = 0; /* Can happen for negative dx */
-  else if (*root_x + XINT (dx) + width <= max_x)
+  else if (*root_x + XFIXNUM (dx) + width <= max_x)
     /* It fits to the right of the pointer.  */
-    *root_x += XINT (dx);
-  else if (width + XINT (dx) + min_x <= *root_x)
+    *root_x += XFIXNUM (dx);
+  else if (width + XFIXNUM (dx) + min_x <= *root_x)
     /* It fits to the left of the pointer.  */
-    *root_x -= width + XINT (dx);
+    *root_x -= width + XFIXNUM (dx);
   else
     /* Put it left justified on the screen -- it ought to fit that way.  */
     *root_x = min_x;
@@ -7221,19 +7221,19 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
   decode_window_system_frame (frame);
 
   if (NILP (timeout))
-    timeout = make_number (5);
+    timeout = make_fixnum (5);
   else
-    CHECK_NATNUM (timeout);
+    CHECK_FIXNAT (timeout);
 
   if (NILP (dx))
-    dx = make_number (5);
+    dx = make_fixnum (5);
   else
-    CHECK_NUMBER (dx);
+    CHECK_FIXNUM (dx);
 
   if (NILP (dy))
-    dy = make_number (-10);
+    dy = make_fixnum (-10);
   else
-    CHECK_NUMBER (dy);
+    CHECK_FIXNUM (dy);
 
   if (FRAMEP (tip_frame) && FRAME_LIVE_P (XFRAME (tip_frame)))
     {
@@ -7344,9 +7344,9 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
       if (NILP (Fassq (Qname, parms)))
        parms = Fcons (Fcons (Qname, build_string ("tooltip")), parms);
       if (NILP (Fassq (Qinternal_border_width, parms)))
-       parms = Fcons (Fcons (Qinternal_border_width, make_number (3)), parms);
+       parms = Fcons (Fcons (Qinternal_border_width, make_fixnum (3)), parms);
       if (NILP (Fassq (Qborder_width, parms)))
-       parms = Fcons (Fcons (Qborder_width, make_number (1)), parms);
+       parms = Fcons (Fcons (Qborder_width, make_fixnum (1)), parms);
       if (NILP (Fassq (Qborder_color, parms)))
        parms = Fcons (Fcons (Qborder_color, build_string ("lightyellow")),
                       parms);
@@ -7370,8 +7370,8 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
   tip_buf = Fget_buffer_create (tip);
   /* We will mark the tip window a "pseudo-window" below, and such
      windows cannot have display margins.  */
-  bset_left_margin_cols (XBUFFER (tip_buf), make_number (0));
-  bset_right_margin_cols (XBUFFER (tip_buf), make_number (0));
+  bset_left_margin_cols (XBUFFER (tip_buf), make_fixnum (0));
+  bset_right_margin_cols (XBUFFER (tip_buf), make_fixnum (0));
   set_window_buffer (window, tip_buf, false, false);
   w = XWINDOW (window);
   w->pseudo_window_p = true;
@@ -7386,11 +7386,11 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
   w->pixel_top = 0;
 
   if (CONSP (Vx_max_tooltip_size)
-      && RANGED_INTEGERP (1, XCAR (Vx_max_tooltip_size), INT_MAX)
-      && RANGED_INTEGERP (1, XCDR (Vx_max_tooltip_size), INT_MAX))
+      && RANGED_FIXNUMP (1, XCAR (Vx_max_tooltip_size), INT_MAX)
+      && RANGED_FIXNUMP (1, XCDR (Vx_max_tooltip_size), INT_MAX))
     {
-      w->total_cols = XFASTINT (XCAR (Vx_max_tooltip_size));
-      w->total_lines = XFASTINT (XCDR (Vx_max_tooltip_size));
+      w->total_cols = XFIXNAT (XCAR (Vx_max_tooltip_size));
+      w->total_lines = XFIXNAT (XCDR (Vx_max_tooltip_size));
     }
   else
     {
@@ -7420,18 +7420,18 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
   try_window (window, pos, TRY_WINDOW_IGNORE_FONTS_CHANGE);
   /* Calculate size of tooltip window.  */
   size = Fwindow_text_pixel_size (window, Qnil, Qnil, Qnil,
-                                 make_number (w->pixel_height), Qnil);
+                                 make_fixnum (w->pixel_height), Qnil);
   /* Add the frame's internal border to calculated size.  */
-  width = XINT (Fcar (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f);
-  height = XINT (Fcdr (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f);
+  width = XFIXNUM (Fcar (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f);
+  height = XFIXNUM (Fcdr (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f);
   /* Calculate position of tooltip frame.  */
   compute_tip_xy (tip_f, parms, dx, dy, width, height, &root_x, &root_y);
 
   /* Show tooltip frame.  */
   {
     RECT rect;
-    int pad = (NUMBERP (Vw32_tooltip_extra_pixels)
-              ? max (0, XINT (Vw32_tooltip_extra_pixels))
+    int pad = (FIXED_OR_FLOATP (Vw32_tooltip_extra_pixels)
+              ? max (0, XFIXNUM (Vw32_tooltip_extra_pixels))
               : FRAME_COLUMN_WIDTH (tip_f));
 
     rect.left = rect.top = 0;
@@ -8033,10 +8033,10 @@ If optional parameter FRAME is not specified, use 
selected frame.  */)
 {
   struct frame *f = decode_window_system_frame (frame);
 
-  CHECK_NUMBER (command);
+  CHECK_FIXNUM (command);
 
   if (FRAME_W32_P (f))
-    PostMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, XINT (command), 0);
+    PostMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, XFIXNUM (command), 0);
 
   return Qnil;
 }
@@ -8143,8 +8143,8 @@ a ShowWindow flag:
     }
   result = (intptr_t) ShellExecuteW (NULL, ops_w, doc_w, params_w,
                                     GUI_SDATA (current_dir),
-                                    (INTEGERP (show_flag)
-                                     ? XINT (show_flag) : SW_SHOWDEFAULT));
+                                    (FIXNUMP (show_flag)
+                                     ? XFIXNUM (show_flag) : SW_SHOWDEFAULT));
 
   if (result > 32)
     return Qt;
@@ -8209,7 +8209,7 @@ a ShowWindow flag:
 
       if (c_isalpha (*p) && p[1] == ':' && IS_DIRECTORY_SEP (p[2]))
        document = Fsubstring_no_properties (document,
-                                            make_number (file_url_len), Qnil);
+                                            make_fixnum (file_url_len), Qnil);
     }
   /* We have a situation here.  If DOCUMENT is a relative file name,
      but its name includes leading directories, i.e. it lives not in
@@ -8301,7 +8301,7 @@ a ShowWindow flag:
       shexinfo_w.lpParameters = params_w;
       shexinfo_w.lpDirectory = current_dir_w;
       shexinfo_w.nShow =
-       (INTEGERP (show_flag) ? XINT (show_flag) : SW_SHOWDEFAULT);
+       (FIXNUMP (show_flag) ? XFIXNUM (show_flag) : SW_SHOWDEFAULT);
       success = ShellExecuteExW (&shexinfo_w);
       xfree (doc_w);
     }
@@ -8336,7 +8336,7 @@ a ShowWindow flag:
       shexinfo_a.lpParameters = params_a;
       shexinfo_a.lpDirectory = current_dir_a;
       shexinfo_a.nShow =
-       (INTEGERP (show_flag) ? XINT (show_flag) : SW_SHOWDEFAULT);
+       (FIXNUMP (show_flag) ? XFIXNUM (show_flag) : SW_SHOWDEFAULT);
       success = ShellExecuteExA (&shexinfo_a);
       xfree (doc_w);
       xfree (doc_a);
@@ -8412,14 +8412,14 @@ w32_parse_and_hook_hot_key (Lisp_Object key, int hook)
   if (CONSP (c) && lucid_event_type_list_p (c))
     c = Fevent_convert_list (c);
 
-  if (! INTEGERP (c) && ! SYMBOLP (c))
+  if (! FIXNUMP (c) && ! SYMBOLP (c))
     error ("Key definition is invalid");
 
   /* Work out the base key and the modifiers.  */
   if (SYMBOLP (c))
     {
       c = parse_modifiers (c);
-      lisp_modifiers = XINT (Fcar (Fcdr (c)));
+      lisp_modifiers = XFIXNUM (Fcar (Fcdr (c)));
       c = Fcar (c);
       if (!SYMBOLP (c))
        emacs_abort ();
@@ -8430,11 +8430,11 @@ w32_parse_and_hook_hot_key (Lisp_Object key, int hook)
       else
         vk_code = lookup_vk_code (vkname);
     }
-  else if (INTEGERP (c))
+  else if (FIXNUMP (c))
     {
-      lisp_modifiers = XINT (c) & ~CHARACTERBITS;
+      lisp_modifiers = XFIXNUM (c) & ~CHARACTERBITS;
       /* Many ascii characters are their own virtual key code.  */
-      vk_code = XINT (c) & CHARACTERBITS;
+      vk_code = XFIXNUM (c) & CHARACTERBITS;
     }
 
   if (vk_code < 0 || vk_code > 255)
@@ -8534,7 +8534,7 @@ any key combinations, otherwise nil.  */)
       /* Notify input thread about new hot-key definition, so that it
         takes effect without needing to switch focus.  */
       PostThreadMessage (dwWindowsThreadId, WM_EMACS_REGISTER_HOT_KEY,
-                        (WPARAM) XINT (key), 0);
+                        (WPARAM) XFIXNUM (key), 0);
     }
 
   return key;
@@ -8547,7 +8547,7 @@ DEFUN ("w32-unregister-hot-key", Fw32_unregister_hot_key,
 {
   Lisp_Object item;
 
-  if (!INTEGERP (key))
+  if (!FIXNUMP (key))
     key = w32_parse_and_hook_hot_key (key, 0);
 
   if (w32_kbdhook_active)
@@ -8567,7 +8567,7 @@ DEFUN ("w32-unregister-hot-key", Fw32_unregister_hot_key,
       /* Notify input thread about hot-key definition being removed, so
         that it takes effect without needing focus switch.  */
       if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_UNREGISTER_HOT_KEY,
-                            (WPARAM) XINT (XCAR (item)), lparam))
+                            (WPARAM) XFIXNUM (XCAR (item)), lparam))
        {
          MSG msg;
          GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
@@ -8594,7 +8594,7 @@ usage: (w32-reconstruct-hot-key ID)  */)
   int vk_code, w32_modifiers;
   Lisp_Object key;
 
-  CHECK_NUMBER (hotkeyid);
+  CHECK_FIXNUM (hotkeyid);
 
   vk_code = HOTKEY_VK_CODE (hotkeyid);
   w32_modifiers = HOTKEY_MODIFIERS (hotkeyid);
@@ -8602,7 +8602,7 @@ usage: (w32-reconstruct-hot-key ID)  */)
   if (vk_code < 256 && lispy_function_keys[vk_code])
     key = intern (lispy_function_keys[vk_code]);
   else
-    key = make_number (vk_code);
+    key = make_fixnum (vk_code);
 
   key = Fcons (key, Qnil);
   if (w32_modifiers & MOD_SHIFT)
@@ -8642,18 +8642,18 @@ to change the state.  */)
     return Qnil;
 
   if (!dwWindowsThreadId)
-    return make_number (w32_console_toggle_lock_key (vk_code, new_state));
+    return make_fixnum (w32_console_toggle_lock_key (vk_code, new_state));
 
   if (NILP (new_state))
     lparam = -1;
   else
-    lparam = (XUINT (new_state)) & 1;
+    lparam = (XUFIXNUM (new_state)) & 1;
   if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_TOGGLE_LOCK_KEY,
                         (WPARAM) vk_code, lparam))
     {
       MSG msg;
       GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
-      return make_number (msg.wParam);
+      return make_fixnum (msg.wParam);
     }
   return Qnil;
 }
@@ -8787,32 +8787,32 @@ and width values are in pixels.
 
   return listn (CONSTYPE_HEAP, 10,
                Fcons (Qouter_position,
-                      Fcons (make_number (left), make_number (top))),
+                      Fcons (make_fixnum (left), make_fixnum (top))),
                Fcons (Qouter_size,
-                      Fcons (make_number (right - left),
-                             make_number (bottom - top))),
+                      Fcons (make_fixnum (right - left),
+                             make_fixnum (bottom - top))),
                Fcons (Qexternal_border_size,
-                      Fcons (make_number (external_border_width),
-                             make_number (external_border_height))),
+                      Fcons (make_fixnum (external_border_width),
+                             make_fixnum (external_border_height))),
                Fcons (Qtitle_bar_size,
-                      Fcons (make_number (title_bar_width),
-                             make_number (title_bar_height))),
+                      Fcons (make_fixnum (title_bar_width),
+                             make_fixnum (title_bar_height))),
                Fcons (Qmenu_bar_external, Qt),
                Fcons (Qmenu_bar_size,
-                      Fcons (make_number
+                      Fcons (make_fixnum
                              (menu_bar.rcBar.right - menu_bar.rcBar.left),
-                             make_number (menu_bar_height))),
+                             make_fixnum (menu_bar_height))),
                Fcons (Qtool_bar_external, Qnil),
                Fcons (Qtool_bar_position, tool_bar_height ? Qtop : Qnil),
                Fcons (Qtool_bar_size,
-                      Fcons (make_number
+                      Fcons (make_fixnum
                              (tool_bar_height
                               ? (right - left - 2 * external_border_width
                                  - 2 * internal_border_width)
                               : 0),
-                             make_number (tool_bar_height))),
+                             make_fixnum (tool_bar_height))),
                Fcons (Qinternal_border_width,
-                      make_number (internal_border_width)));
+                      make_fixnum (internal_border_width)));
 }
 
 DEFUN ("w32-frame-edges", Fw32_frame_edges, Sw32_frame_edges, 0, 2, 0,
@@ -8849,10 +8849,10 @@ menu bar or tool bar of FRAME.  */)
       unblock_input ();
 
       if (success)
-       return list4 (make_number (rectangle.left),
-                     make_number (rectangle.top),
-                     make_number (rectangle.right),
-                     make_number (rectangle.bottom));
+       return list4 (make_fixnum (rectangle.left),
+                     make_fixnum (rectangle.top),
+                     make_fixnum (rectangle.right),
+                     make_fixnum (rectangle.bottom));
       else
        return Qnil;
     }
@@ -8891,16 +8891,16 @@ menu bar or tool bar of FRAME.  */)
        {
          int internal_border_width = FRAME_INTERNAL_BORDER_WIDTH (f);
 
-         return list4 (make_number (left + internal_border_width),
-                       make_number (top
+         return list4 (make_fixnum (left + internal_border_width),
+                       make_fixnum (top
                                     + FRAME_TOOL_BAR_HEIGHT (f)
                                     + internal_border_width),
-                       make_number (right - internal_border_width),
-                       make_number (bottom - internal_border_width));
+                       make_fixnum (right - internal_border_width),
+                       make_fixnum (bottom - internal_border_width));
        }
       else
-       return list4 (make_number (left), make_number (top),
-                     make_number (right), make_number (bottom));
+       return list4 (make_fixnum (left), make_fixnum (top),
+                     make_fixnum (right), make_fixnum (bottom));
     }
 }
 
@@ -9048,7 +9048,7 @@ selected frame's display.  */)
   GetCursorPos (&pt);
   unblock_input ();
 
-  return Fcons (make_number (pt.x), make_number (pt.y));
+  return Fcons (make_fixnum (pt.x), make_fixnum (pt.y));
 }
 
 DEFUN ("w32-set-mouse-absolute-pixel-position", 
Fw32_set_mouse_absolute_pixel_position,
@@ -9071,7 +9071,7 @@ The coordinates X and Y are interpreted in pixels 
relative to a position
   if (os_subtype == OS_NT
       && w32_major_version + w32_minor_version >= 6)
     ret = SystemParametersInfo (SPI_GETMOUSETRAILS, 0, &trail_num, 0);
-  SetCursorPos (XINT (x), XINT (y));
+  SetCursorPos (XFIXNUM (x), XFIXNUM (y));
   if (ret)
     SystemParametersInfo (SPI_SETMOUSETRAILS, trail_num, NULL, 0);
   unblock_input ();
@@ -9431,8 +9431,8 @@ w32_console_toggle_lock_key (int vk_code, Lisp_Object 
new_state)
   int cur_state = (GetKeyState (vk_code) & 1);
 
   if (NILP (new_state)
-      || (NUMBERP (new_state)
-         && ((XUINT (new_state)) & 1) != cur_state))
+      || (FIXED_OR_FLOATP (new_state)
+         && ((XUFIXNUM (new_state)) & 1) != cur_state))
     {
 #ifdef WINDOWSNT
       faked_key = vk_code;
@@ -10059,7 +10059,7 @@ usage: (w32-notification-notify &rest PARAMS)  */)
 
   /* Do it!  */
   retval = add_tray_notification (f, icon, tip, severity, timeout, title, msg);
-  return (retval < 0 ? Qnil : make_number (retval));
+  return (retval < 0 ? Qnil : make_fixnum (retval));
 }
 
 DEFUN ("w32-notification-close",
@@ -10070,8 +10070,8 @@ DEFUN ("w32-notification-close",
 {
   struct frame *f = SELECTED_FRAME ();
 
-  if (INTEGERP (id))
-    delete_tray_notification (f, XINT (id));
+  if (FIXNUMP (id))
+    delete_tray_notification (f, XFIXNUM (id));
 
   return Qnil;
 }
@@ -10483,7 +10483,7 @@ bass-down, bass-boost, bass-up, treble-down, treble-up  
*/);
 
   DEFVAR_LISP ("x-max-tooltip-size", Vx_max_tooltip_size,
               doc: /* SKIP: real doc in xfns.c.  */);
-  Vx_max_tooltip_size = Fcons (make_number (80), make_number (40));
+  Vx_max_tooltip_size = Fcons (make_fixnum (80), make_fixnum (40));
 
   DEFVAR_LISP ("x-no-window-manager", Vx_no_window_manager,
               doc: /* SKIP: real doc in xfns.c.  */);
diff --git a/src/w32font.c b/src/w32font.c
index 65409b9..c2f5dc3 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -920,7 +920,7 @@ w32font_open_internal (struct frame *f, Lisp_Object 
font_entity,
   if (!EQ (val, Qraster))
     logfont.lfOutPrecision = OUT_TT_PRECIS;
 
-  size = XINT (AREF (font_entity, FONT_SIZE_INDEX));
+  size = XFIXNUM (AREF (font_entity, FONT_SIZE_INDEX));
   if (!size)
     size = pixel_size;
 
@@ -1096,9 +1096,9 @@ w32_enumfont_pattern_entity (Lisp_Object frame,
   ASET (entity, FONT_ADSTYLE_INDEX, tem);
 
   if (physical_font->ntmTm.tmPitchAndFamily & 0x01)
-    ASET (entity, FONT_SPACING_INDEX, make_number (FONT_SPACING_PROPORTIONAL));
+    ASET (entity, FONT_SPACING_INDEX, make_fixnum (FONT_SPACING_PROPORTIONAL));
   else
-    ASET (entity, FONT_SPACING_INDEX, make_number (FONT_SPACING_CHARCELL));
+    ASET (entity, FONT_SPACING_INDEX, make_fixnum (FONT_SPACING_CHARCELL));
 
   if (requested_font->lfQuality != DEFAULT_QUALITY)
     {
@@ -1109,19 +1109,19 @@ w32_enumfont_pattern_entity (Lisp_Object frame,
        intern_font_name (lf->lfFaceName));
 
   FONT_SET_STYLE (entity, FONT_WEIGHT_INDEX,
-                 make_number (w32_decode_weight (lf->lfWeight)));
+                 make_fixnum (w32_decode_weight (lf->lfWeight)));
   FONT_SET_STYLE (entity, FONT_SLANT_INDEX,
-                 make_number (lf->lfItalic ? 200 : 100));
+                 make_fixnum (lf->lfItalic ? 200 : 100));
   /* TODO: PANOSE struct has this info, but need to call GetOutlineTextMetrics
      to get it.  */
-  FONT_SET_STYLE (entity, FONT_WIDTH_INDEX, make_number (100));
+  FONT_SET_STYLE (entity, FONT_WIDTH_INDEX, make_fixnum (100));
 
   if (font_type & RASTER_FONTTYPE)
     ASET (entity, FONT_SIZE_INDEX,
-          make_number (physical_font->ntmTm.tmHeight
+          make_fixnum (physical_font->ntmTm.tmHeight
                        + physical_font->ntmTm.tmExternalLeading));
   else
-    ASET (entity, FONT_SIZE_INDEX, make_number (0));
+    ASET (entity, FONT_SIZE_INDEX, make_fixnum (0));
 
   /* Cache Unicode codepoints covered by this font, as there is no other way
      of getting this information easily.  */
@@ -1229,9 +1229,9 @@ font_matches_spec (DWORD type, NEWTEXTMETRICEX *font,
 
   /* Check spacing */
   val = AREF (spec, FONT_SPACING_INDEX);
-  if (INTEGERP (val))
+  if (FIXNUMP (val))
     {
-      int spacing = XINT (val);
+      int spacing = XFIXNUM (val);
       int proportional = (spacing < FONT_SPACING_MONO);
 
       if ((proportional && !(font->ntmTm.tmPitchAndFamily & 0x01))
@@ -1822,8 +1822,8 @@ w32_to_x_charset (int fncharset, char *matching)
         /* Look for Same charset and a valid codepage (or non-int
            which means ignore).  */
         if (EQ (w32_charset, charset_type)
-            && (!INTEGERP (codepage) || XINT (codepage) == CP_DEFAULT
-                || IsValidCodePage (XINT (codepage))))
+            && (!FIXNUMP (codepage) || XFIXNUM (codepage) == CP_DEFAULT
+                || IsValidCodePage (XFIXNUM (codepage))))
           {
             /* If we don't have a match already, then this is the
                best.  */
@@ -1955,9 +1955,9 @@ fill_in_logfont (struct frame *f, LOGFONT *logfont, 
Lisp_Object font_spec)
   int dpi = FRAME_RES_Y (f);
 
   tmp = AREF (font_spec, FONT_DPI_INDEX);
-  if (INTEGERP (tmp))
+  if (FIXNUMP (tmp))
     {
-      dpi = XINT (tmp);
+      dpi = XFIXNUM (tmp);
     }
   else if (FLOATP (tmp))
     {
@@ -1966,8 +1966,8 @@ fill_in_logfont (struct frame *f, LOGFONT *logfont, 
Lisp_Object font_spec)
 
   /* Height  */
   tmp = AREF (font_spec, FONT_SIZE_INDEX);
-  if (INTEGERP (tmp))
-    logfont->lfHeight = -1 * XINT (tmp);
+  if (FIXNUMP (tmp))
+    logfont->lfHeight = -1 * XFIXNUM (tmp);
   else if (FLOATP (tmp))
     logfont->lfHeight = (int) (-1.0 *  dpi * XFLOAT_DATA (tmp) / 72.27 + 0.5);
 
@@ -1977,12 +1977,12 @@ fill_in_logfont (struct frame *f, LOGFONT *logfont, 
Lisp_Object font_spec)
 
   /* Weight  */
   tmp = AREF (font_spec, FONT_WEIGHT_INDEX);
-  if (INTEGERP (tmp))
+  if (FIXNUMP (tmp))
     logfont->lfWeight = w32_encode_weight (FONT_WEIGHT_NUMERIC (font_spec));
 
   /* Italic  */
   tmp = AREF (font_spec, FONT_SLANT_INDEX);
-  if (INTEGERP (tmp))
+  if (FIXNUMP (tmp))
     {
       int slant = FONT_SLANT_NUMERIC (font_spec);
       logfont->lfItalic = slant > 150 ? 1 : 0;
@@ -2036,9 +2036,9 @@ fill_in_logfont (struct frame *f, LOGFONT *logfont, 
Lisp_Object font_spec)
 
   /* Set pitch based on the spacing property.  */
   tmp = AREF (font_spec, FONT_SPACING_INDEX);
-  if (INTEGERP (tmp))
+  if (FIXNUMP (tmp))
     {
-      int spacing = XINT (tmp);
+      int spacing = XFIXNUM (tmp);
       if (spacing < FONT_SPACING_MONO)
        logfont->lfPitchAndFamily
          = (logfont->lfPitchAndFamily & 0xF0) | VARIABLE_PITCH;
diff --git a/src/w32inevt.c b/src/w32inevt.c
index 907cc47..e8494c8 100644
--- a/src/w32inevt.c
+++ b/src/w32inevt.c
@@ -181,8 +181,8 @@ key_event (KEY_EVENT_RECORD *event, struct input_event 
*emacs_ev, int *isdead)
             Space which we will ignore.  */
          if ((mod_key_state & LEFT_WIN_PRESSED) == 0)
            {
-             if (NUMBERP (Vw32_phantom_key_code))
-               faked_key = XUINT (Vw32_phantom_key_code) & 255;
+             if (FIXED_OR_FLOATP (Vw32_phantom_key_code))
+               faked_key = XUFIXNUM (Vw32_phantom_key_code) & 255;
              else
                faked_key = VK_SPACE;
              keybd_event (faked_key, (BYTE) MapVirtualKey (faked_key, 0), 0, 
0);
@@ -198,8 +198,8 @@ key_event (KEY_EVENT_RECORD *event, struct input_event 
*emacs_ev, int *isdead)
        {
          if ((mod_key_state & RIGHT_WIN_PRESSED) == 0)
            {
-             if (NUMBERP (Vw32_phantom_key_code))
-               faked_key = XUINT (Vw32_phantom_key_code) & 255;
+             if (FIXED_OR_FLOATP (Vw32_phantom_key_code))
+               faked_key = XUFIXNUM (Vw32_phantom_key_code) & 255;
              else
                faked_key = VK_SPACE;
              keybd_event (faked_key, (BYTE) MapVirtualKey (faked_key, 0), 0, 
0);
diff --git a/src/w32proc.c b/src/w32proc.c
index 5934669..61ce157 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -1766,7 +1766,7 @@ sys_spawnve (int mode, char *cmdname, char **argv, char 
**envp)
     {
       program = build_string (cmdname);
       full = Qnil;
-      openp (Vexec_path, program, Vexec_suffixes, &full, make_number (X_OK), 
0);
+      openp (Vexec_path, program, Vexec_suffixes, &full, make_fixnum (X_OK), 
0);
       if (NILP (full))
        {
          errno = EINVAL;
@@ -1889,8 +1889,8 @@ sys_spawnve (int mode, char *cmdname, char **argv, char 
**envp)
       do_quoting = 1;
       /* Override escape char by binding w32-quote-process-args to
         desired character, or use t for auto-selection.  */
-      if (INTEGERP (Vw32_quote_process_args))
-       escape_char = XINT (Vw32_quote_process_args);
+      if (FIXNUMP (Vw32_quote_process_args))
+       escape_char = XFIXNUM (Vw32_quote_process_args);
       else
        escape_char = (is_cygnus_app || is_msys_app) ? '"' : '\\';
     }
@@ -3017,13 +3017,13 @@ If successful, the return value is t, otherwise nil.  
*/)
       DWORD pid;
       child_process *cp;
 
-      CHECK_NUMBER (process);
+      CHECK_FIXNUM (process);
 
       /* Allow pid to be an internally generated one, or one obtained
         externally.  This is necessary because real pids on Windows 95 are
         negative.  */
 
-      pid = XINT (process);
+      pid = XFIXNUM (process);
       cp = find_child_pid (pid);
       if (cp != NULL)
        pid = cp->procinfo.dwProcessId;
@@ -3186,14 +3186,14 @@ If LCID (a 16-bit number) is not a valid locale, the 
result is nil.  */)
   char abbrev_name[32] = { 0 };
   char full_name[256] = { 0 };
 
-  CHECK_NUMBER (lcid);
+  CHECK_FIXNUM (lcid);
 
-  if (!IsValidLocale (XINT (lcid), LCID_SUPPORTED))
+  if (!IsValidLocale (XFIXNUM (lcid), LCID_SUPPORTED))
     return Qnil;
 
   if (NILP (longform))
     {
-      got_abbrev = GetLocaleInfo (XINT (lcid),
+      got_abbrev = GetLocaleInfo (XFIXNUM (lcid),
                                  LOCALE_SABBREVLANGNAME | LOCALE_USE_CP_ACP,
                                  abbrev_name, sizeof (abbrev_name));
       if (got_abbrev)
@@ -3201,16 +3201,16 @@ If LCID (a 16-bit number) is not a valid locale, the 
result is nil.  */)
     }
   else if (EQ (longform, Qt))
     {
-      got_full = GetLocaleInfo (XINT (lcid),
+      got_full = GetLocaleInfo (XFIXNUM (lcid),
                                LOCALE_SLANGUAGE | LOCALE_USE_CP_ACP,
                                full_name, sizeof (full_name));
       if (got_full)
        return DECODE_SYSTEM (build_string (full_name));
     }
-  else if (NUMBERP (longform))
+  else if (FIXED_OR_FLOATP (longform))
     {
-      got_full = GetLocaleInfo (XINT (lcid),
-                               XINT (longform),
+      got_full = GetLocaleInfo (XFIXNUM (lcid),
+                               XFIXNUM (longform),
                                full_name, sizeof (full_name));
       /* GetLocaleInfo's return value includes the terminating null
         character, when the returned information is a string, whereas
@@ -3231,7 +3231,7 @@ This is a numerical value; use `w32-get-locale-info' to 
convert to a
 human-readable form.  */)
   (void)
 {
-  return make_number (GetThreadLocale ());
+  return make_fixnum (GetThreadLocale ());
 }
 
 static DWORD
@@ -3260,7 +3260,7 @@ static BOOL CALLBACK ALIGN_STACK
 enum_locale_fn (LPTSTR localeNum)
 {
   DWORD id = int_from_hex (localeNum);
-  Vw32_valid_locale_ids = Fcons (make_number (id), Vw32_valid_locale_ids);
+  Vw32_valid_locale_ids = Fcons (make_fixnum (id), Vw32_valid_locale_ids);
   return TRUE;
 }
 
@@ -3289,8 +3289,8 @@ human-readable form.  */)
   (Lisp_Object userp)
 {
   if (NILP (userp))
-    return make_number (GetSystemDefaultLCID ());
-  return make_number (GetUserDefaultLCID ());
+    return make_fixnum (GetSystemDefaultLCID ());
+  return make_fixnum (GetUserDefaultLCID ());
 }
 
 
@@ -3299,20 +3299,20 @@ DEFUN ("w32-set-current-locale", 
Fw32_set_current_locale, Sw32_set_current_local
 If successful, the new locale id is returned, otherwise nil.  */)
   (Lisp_Object lcid)
 {
-  CHECK_NUMBER (lcid);
+  CHECK_FIXNUM (lcid);
 
-  if (!IsValidLocale (XINT (lcid), LCID_SUPPORTED))
+  if (!IsValidLocale (XFIXNUM (lcid), LCID_SUPPORTED))
     return Qnil;
 
-  if (!SetThreadLocale (XINT (lcid)))
+  if (!SetThreadLocale (XFIXNUM (lcid)))
     return Qnil;
 
   /* Need to set input thread locale if present.  */
   if (dwWindowsThreadId)
     /* Reply is not needed.  */
-    PostThreadMessage (dwWindowsThreadId, WM_EMACS_SETLOCALE, XINT (lcid), 0);
+    PostThreadMessage (dwWindowsThreadId, WM_EMACS_SETLOCALE, XFIXNUM (lcid), 
0);
 
-  return make_number (GetThreadLocale ());
+  return make_fixnum (GetThreadLocale ());
 }
 
 
@@ -3324,7 +3324,7 @@ static BOOL CALLBACK ALIGN_STACK
 enum_codepage_fn (LPTSTR codepageNum)
 {
   DWORD id = atoi (codepageNum);
-  Vw32_valid_codepages = Fcons (make_number (id), Vw32_valid_codepages);
+  Vw32_valid_codepages = Fcons (make_fixnum (id), Vw32_valid_codepages);
   return TRUE;
 }
 
@@ -3347,7 +3347,7 @@ DEFUN ("w32-get-console-codepage", 
Fw32_get_console_codepage,
        doc: /* Return current Windows codepage for console input.  */)
   (void)
 {
-  return make_number (GetConsoleCP ());
+  return make_fixnum (GetConsoleCP ());
 }
 
 
@@ -3358,15 +3358,15 @@ This codepage setting affects keyboard input in tty 
mode.
 If successful, the new CP is returned, otherwise nil.  */)
   (Lisp_Object cp)
 {
-  CHECK_NUMBER (cp);
+  CHECK_FIXNUM (cp);
 
-  if (!IsValidCodePage (XINT (cp)))
+  if (!IsValidCodePage (XFIXNUM (cp)))
     return Qnil;
 
-  if (!SetConsoleCP (XINT (cp)))
+  if (!SetConsoleCP (XFIXNUM (cp)))
     return Qnil;
 
-  return make_number (GetConsoleCP ());
+  return make_fixnum (GetConsoleCP ());
 }
 
 
@@ -3375,7 +3375,7 @@ DEFUN ("w32-get-console-output-codepage", 
Fw32_get_console_output_codepage,
        doc: /* Return current Windows codepage for console output.  */)
   (void)
 {
-  return make_number (GetConsoleOutputCP ());
+  return make_fixnum (GetConsoleOutputCP ());
 }
 
 
@@ -3386,15 +3386,15 @@ This codepage setting affects display in tty mode.
 If successful, the new CP is returned, otherwise nil.  */)
   (Lisp_Object cp)
 {
-  CHECK_NUMBER (cp);
+  CHECK_FIXNUM (cp);
 
-  if (!IsValidCodePage (XINT (cp)))
+  if (!IsValidCodePage (XFIXNUM (cp)))
     return Qnil;
 
-  if (!SetConsoleOutputCP (XINT (cp)))
+  if (!SetConsoleOutputCP (XFIXNUM (cp)))
     return Qnil;
 
-  return make_number (GetConsoleOutputCP ());
+  return make_fixnum (GetConsoleOutputCP ());
 }
 
 
@@ -3412,17 +3412,17 @@ yield nil.  */)
   CHARSETINFO info;
   DWORD_PTR dwcp;
 
-  CHECK_NUMBER (cp);
+  CHECK_FIXNUM (cp);
 
-  if (!IsValidCodePage (XINT (cp)))
+  if (!IsValidCodePage (XFIXNUM (cp)))
     return Qnil;
 
   /* Going through a temporary DWORD_PTR variable avoids compiler warning
      about cast to pointer from integer of different size, when
      building --with-wide-int or building for 64bit.  */
-  dwcp = XINT (cp);
+  dwcp = XFIXNUM (cp);
   if (TranslateCharsetInfo ((DWORD *) dwcp, &info, TCI_SRCCODEPAGE))
-    return make_number (info.ciCharset);
+    return make_fixnum (info.ciCharset);
 
   return Qnil;
 }
@@ -3444,8 +3444,8 @@ The return value is a list of pairs of language id and 
layout id.  */)
        {
          HKL kl = layouts[num_layouts];
 
-         obj = Fcons (Fcons (make_number (LOWORD (kl)),
-                             make_number (HIWORD (kl))),
+         obj = Fcons (Fcons (make_fixnum (LOWORD (kl)),
+                             make_fixnum (HIWORD (kl))),
                       obj);
        }
     }
@@ -3462,8 +3462,8 @@ The return value is the cons of the language id and the 
layout id.  */)
 {
   HKL kl = GetKeyboardLayout (dwWindowsThreadId);
 
-  return Fcons (make_number (LOWORD (kl)),
-               make_number (HIWORD (kl)));
+  return Fcons (make_fixnum (LOWORD (kl)),
+               make_fixnum (HIWORD (kl)));
 }
 
 
@@ -3477,11 +3477,11 @@ If successful, the new layout id is returned, otherwise 
nil.  */)
   HKL kl;
 
   CHECK_CONS (layout);
-  CHECK_NUMBER_CAR (layout);
-  CHECK_NUMBER_CDR (layout);
+  CHECK_FIXNUM_CAR (layout);
+  CHECK_FIXNUM_CDR (layout);
 
-  kl = (HKL) (UINT_PTR) ((XINT (XCAR (layout)) & 0xffff)
-                        | (XINT (XCDR (layout)) << 16));
+  kl = (HKL) (UINT_PTR) ((XFIXNUM (XCAR (layout)) & 0xffff)
+                        | (XFIXNUM (XCDR (layout)) << 16));
 
   /* Synchronize layout with input thread.  */
   if (dwWindowsThreadId)
diff --git a/src/w32select.c b/src/w32select.c
index a9df3f7..dc568d4 100644
--- a/src/w32select.c
+++ b/src/w32select.c
@@ -241,7 +241,7 @@ static Lisp_Object
 render (Lisp_Object oformat)
 {
   HGLOBAL htext = NULL;
-  UINT format = XFASTINT (oformat);
+  UINT format = XFIXNAT (oformat);
 
   ONTRACE (fprintf (stderr, "render\n"));
 
@@ -371,8 +371,8 @@ render_all (Lisp_Object ignore)
   render_locale ();
 
   if (current_clipboard_type == CF_UNICODETEXT)
-    render (make_number (CF_TEXT));
-  render (make_number (current_clipboard_type));
+    render (make_fixnum (CF_TEXT));
+  render (make_fixnum (current_clipboard_type));
 
   CloseClipboard ();
 
@@ -419,7 +419,7 @@ owner_callback (HWND win, UINT msg, WPARAM wp, LPARAM lp)
     {
     case WM_RENDERFORMAT:
       ONTRACE (fprintf (stderr, "WM_RENDERFORMAT\n"));
-      run_protected (render, make_number (wp));
+      run_protected (render, make_fixnum (wp));
       return 0;
 
     case WM_RENDERALLFORMATS:
@@ -631,7 +631,7 @@ validate_coding_system (Lisp_Object coding_system)
   eol_type = Fcoding_system_eol_type (coding_system);
 
   /* Already a DOS coding system? */
-  if (EQ (eol_type, make_number (1)))
+  if (EQ (eol_type, make_fixnum (1)))
     return coding_system;
 
   /* Get EOL_TYPE vector of the base of CODING_SYSTEM.  */
@@ -742,7 +742,7 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data,
          /* If for some reason we don't have a clipboard_owner, we
             just set the text format as chosen by the configuration
             and than forget about the whole thing.  */
-         ok = !NILP (render (make_number (current_clipboard_type)));
+         ok = !NILP (render (make_fixnum (current_clipboard_type)));
          current_text = Qnil;
          current_coding_system = Qnil;
        }
@@ -1123,7 +1123,7 @@ representing a data format that is currently available in 
the clipboard.  */)
 
              /* We generate a vector because that's what xselect.c
                 does in this case.  */
-             val = Fmake_vector (make_number (fmtcount), Qnil);
+             val = Fmake_vector (make_fixnum (fmtcount), Qnil);
              /* Note: when stepping with GDB through this code, the
                 loop below terminates immediately because
                 EnumClipboardFormats for some reason returns with
diff --git a/src/w32term.c b/src/w32term.c
index 0ae173a..8d189ae 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -478,8 +478,8 @@ x_set_frame_alpha (struct frame *f)
 
   if (FLOATP (Vframe_alpha_lower_limit))
     alpha_min = XFLOAT_DATA (Vframe_alpha_lower_limit);
-  else if (INTEGERP (Vframe_alpha_lower_limit))
-    alpha_min = (XINT (Vframe_alpha_lower_limit)) / 100.0;
+  else if (FIXNUMP (Vframe_alpha_lower_limit))
+    alpha_min = (XFIXNUM (Vframe_alpha_lower_limit)) / 100.0;
 
   if (alpha < 0.0)
     return;
@@ -1979,14 +1979,14 @@ x_draw_image_relief (struct glyph_string *s)
   if (s->face->id == TOOL_BAR_FACE_ID)
     {
       if (CONSP (Vtool_bar_button_margin)
-         && INTEGERP (XCAR (Vtool_bar_button_margin))
-         && INTEGERP (XCDR (Vtool_bar_button_margin)))
+         && FIXNUMP (XCAR (Vtool_bar_button_margin))
+         && FIXNUMP (XCDR (Vtool_bar_button_margin)))
        {
-         extra_x = XINT (XCAR (Vtool_bar_button_margin));
-         extra_y = XINT (XCDR (Vtool_bar_button_margin));
+         extra_x = XFIXNUM (XCAR (Vtool_bar_button_margin));
+         extra_y = XFIXNUM (XCDR (Vtool_bar_button_margin));
        }
-      else if (INTEGERP (Vtool_bar_button_margin))
-       extra_x = extra_y = XINT (Vtool_bar_button_margin);
+      else if (FIXNUMP (Vtool_bar_button_margin))
+       extra_x = extra_y = XFIXNUM (Vtool_bar_button_margin);
     }
 
   top_p = bot_p = left_p = right_p = 0;
@@ -2481,8 +2481,8 @@ x_draw_glyph_string (struct glyph_string *s)
                  Lisp_Object val
                    = buffer_local_value (Qunderline_minimum_offset,
                                        s->w->contents);
-                 if (INTEGERP (val))
-                   minimum_offset = XFASTINT (val);
+                 if (FIXNUMP (val))
+                   minimum_offset = XFIXNAT (val);
                  else
                    minimum_offset = 1;
                  val = buffer_local_value (Qx_underline_at_descent_line,
@@ -3573,8 +3573,8 @@ w32_mouse_position (struct frame **fp, int insist, 
Lisp_Object *bar_window,
 static void
 w32_handle_tool_bar_click (struct frame *f, struct input_event *button_event)
 {
-  int x = XFASTINT (button_event->x);
-  int y = XFASTINT (button_event->y);
+  int x = XFIXNAT (button_event->x);
+  int y = XFIXNAT (button_event->y);
 
   if (button_event->modifiers & down_modifier)
     handle_tool_bar_click (f, x, y, 1, 0);
@@ -4769,7 +4769,7 @@ w32_read_socket (struct terminal *terminal,
 
          if (f && !FRAME_ICONIFIED_P (f))
            {
-             if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
+             if (!hlinfo->mouse_face_hidden && FIXNUMP (Vmouse_highlight)
                  && !EQ (f->tool_bar_window, hlinfo->mouse_face_window))
                {
                  clear_mouse_face (hlinfo);
@@ -4794,7 +4794,7 @@ w32_read_socket (struct terminal *terminal,
 
          if (f && !FRAME_ICONIFIED_P (f))
            {
-             if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
+             if (!hlinfo->mouse_face_hidden && FIXNUMP (Vmouse_highlight)
                  && !EQ (f->tool_bar_window, hlinfo->mouse_face_window))
                {
                  clear_mouse_face (hlinfo);
@@ -4872,7 +4872,7 @@ w32_read_socket (struct terminal *terminal,
 
          if (f && !FRAME_ICONIFIED_P (f))
            {
-             if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
+             if (!hlinfo->mouse_face_hidden && FIXNUMP (Vmouse_highlight)
                  && !EQ (f->tool_bar_window, hlinfo->mouse_face_window))
                {
                  clear_mouse_face (hlinfo);
@@ -4996,8 +4996,8 @@ w32_read_socket (struct terminal *terminal,
                     && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window)))
                   {
                     Lisp_Object window;
-                   int x = XFASTINT (inev.x);
-                   int y = XFASTINT (inev.y);
+                   int x = XFIXNAT (inev.x);
+                   int y = XFIXNAT (inev.y);
 
                     window = window_from_coordinates (f, x, y, 0, 1);
 
@@ -6142,11 +6142,11 @@ x_calc_absolute_position (struct frame *f)
           geometry = Fassoc (Qgeometry, attributes, Qnil);
           if (!NILP (geometry))
             {
-              monitor_left = Fnth (make_number (1), geometry);
-              monitor_top  = Fnth (make_number (2), geometry);
+              monitor_left = Fnth (make_fixnum (1), geometry);
+              monitor_top  = Fnth (make_fixnum (2), geometry);
 
-              display_left = min (display_left, XINT (monitor_left));
-              display_top  = min (display_top,  XINT (monitor_top));
+              display_left = min (display_left, XFIXNUM (monitor_left));
+              display_top  = min (display_top,  XFIXNUM (monitor_top));
             }
         }
     }
@@ -6432,10 +6432,10 @@ x_set_window_size (struct frame *f, bool change_gravity,
     {
       frame_size_history_add
        (f, Qx_set_window_size_1, width, height,
-        list2 (Fcons (make_number (pixelwidth),
-                      make_number (pixelheight)),
-               Fcons (make_number (rect.right - rect.left),
-                      make_number (rect.bottom - rect.top))));
+        list2 (Fcons (make_fixnum (pixelwidth),
+                      make_fixnum (pixelheight)),
+               Fcons (make_fixnum (rect.right - rect.left),
+                      make_fixnum (rect.bottom - rect.top))));
 
       if (!FRAME_PARENT_FRAME (f))
        my_set_window_pos (FRAME_W32_WINDOW (f), NULL,
@@ -7265,7 +7265,7 @@ w32_initialize (void)
 
   /* Initialize input mode: interrupt_input off, no flow control, allow
      8 bit character input, standard quit char.  */
-  Fset_input_mode (Qnil, Qnil, make_number (2), Qnil);
+  Fset_input_mode (Qnil, Qnil, make_fixnum (2), Qnil);
 
   {
     LCID input_locale_id = LOWORD (GetKeyboardLayout (0));
diff --git a/src/w32term.h b/src/w32term.h
index c69bebe..ebdab04 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -478,7 +478,7 @@ struct scroll_bar {
 
 #ifdef _WIN64
 /* Building a 64-bit C integer from two 32-bit lisp integers.  */
-#define SCROLL_BAR_PACK(low, high) (XINT (high) << 32 | XINT (low))
+#define SCROLL_BAR_PACK(low, high) (XFIXNUM (high) << 32 | XFIXNUM (low))
 
 /* Setting two lisp integers to the low and high words of a 64-bit C int.  */
 #define SCROLL_BAR_UNPACK(low, high, int64) \
@@ -486,7 +486,7 @@ struct scroll_bar {
    XSETINT ((high), ((DWORDLONG)(int64) >> 32) & 0xffffffff))
 #else  /* not _WIN64 */
 /* Building a 32-bit C unsigned integer from two 16-bit lisp integers.  */
-#define SCROLL_BAR_PACK(low, high) ((UINT_PTR)(XINT (high) << 16 | XINT (low)))
+#define SCROLL_BAR_PACK(low, high) ((UINT_PTR)(XFIXNUM (high) << 16 | XFIXNUM 
(low)))
 
 /* Setting two lisp integers to the low and high words of a 32-bit C int.  */
 #define SCROLL_BAR_UNPACK(low, high, int32) \
diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c
index 884b4cf..11bfa54 100644
--- a/src/w32uniscribe.c
+++ b/src/w32uniscribe.c
@@ -460,21 +460,21 @@ uniscribe_shape (Lisp_Object lgstring)
                             the direction, the Hebrew point HOLAM is
                             drawn above the right edge of the base
                             consonant, instead of above the left edge.  */
-                         ASET (vec, 0, make_number (-offsets[j].du
+                         ASET (vec, 0, make_fixnum (-offsets[j].du
                                                     + adj_offset));
                          /* Update the adjustment value for the width
                             advance of the glyph we just emitted.  */
                          adj_offset -= 2 * advances[j];
                        }
                      else
-                       ASET (vec, 0, make_number (offsets[j].du + adj_offset));
+                       ASET (vec, 0, make_fixnum (offsets[j].du + adj_offset));
                      /* In the font definition coordinate system, the
                         Y coordinate points up, while in our screen
                         coordinates Y grows downwards.  So we need to
                         reverse the sign of Y-OFFSET here.  */
-                     ASET (vec, 1, make_number (-offsets[j].dv));
+                     ASET (vec, 1, make_fixnum (-offsets[j].dv));
                      /* Based on what ftfont.c does... */
-                     ASET (vec, 2, make_number (advances[j]));
+                     ASET (vec, 2, make_fixnum (advances[j]));
                      LGLYPH_SET_ADJUSTMENT (lglyph, vec);
                    }
                  else
@@ -502,7 +502,7 @@ uniscribe_shape (Lisp_Object lgstring)
   if (NILP (lgstring))
     return Qnil;
   else
-    return make_number (done_glyphs);
+    return make_fixnum (done_glyphs);
 }
 
 /* Uniscribe implementation of encode_char for font backend.
@@ -879,7 +879,7 @@ uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec)
   int i, retval = 0;
 
   /* Check the spec is in the right format.  */
-  if (!CONSP (otf_spec) || XINT (Flength (otf_spec)) < 3)
+  if (!CONSP (otf_spec) || XFIXNUM (Flength (otf_spec)) < 3)
     return 0;
 
   /* Break otf_spec into its components.  */
diff --git a/src/widget.c b/src/widget.c
index 2d66c09..2e9295f 100644
--- a/src/widget.c
+++ b/src/widget.c
@@ -282,7 +282,7 @@ set_frame_size (EmacsFrame ew)
 
   frame_size_history_add
     (f, Qset_frame_size, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f),
-     list2 (make_number (ew->core.width), make_number (ew->core.height)));
+     list2 (make_fixnum (ew->core.width), make_fixnum (ew->core.height)));
 }
 
 static void
@@ -421,10 +421,10 @@ EmacsFrameResize (Widget widget)
 
   frame_size_history_add
     (f, QEmacsFrameResize, width, height,
-     list5 (make_number (ew->core.width), make_number (ew->core.height),
-           make_number (FRAME_TOP_MARGIN_HEIGHT (f)),
-           make_number (FRAME_SCROLL_BAR_AREA_HEIGHT (f)),
-           make_number (2 * FRAME_INTERNAL_BORDER_WIDTH (f))));
+     list5 (make_fixnum (ew->core.width), make_fixnum (ew->core.height),
+           make_fixnum (FRAME_TOP_MARGIN_HEIGHT (f)),
+           make_fixnum (FRAME_SCROLL_BAR_AREA_HEIGHT (f)),
+           make_fixnum (2 * FRAME_INTERNAL_BORDER_WIDTH (f))));
 
   change_frame_size (f, width, height, 0, 1, 0, 1);
 
diff --git a/src/window.c b/src/window.c
index 422b06a..67cfdc1 100644
--- a/src/window.c
+++ b/src/window.c
@@ -695,7 +695,7 @@ one.  The window with the lowest use time is the least 
recently
 selected one.  */)
   (Lisp_Object window)
 {
-  return make_number (decode_live_window (window)->use_time);
+  return make_fixnum (decode_live_window (window)->use_time);
 }
 
 DEFUN ("window-pixel-width", Fwindow_pixel_width, Swindow_pixel_width, 0, 1, 0,
@@ -708,7 +708,7 @@ an internal window, its pixel width is the width of the 
screen areas
 spanned by its children.  */)
      (Lisp_Object window)
 {
-  return make_number (decode_valid_window (window)->pixel_width);
+  return make_fixnum (decode_valid_window (window)->pixel_width);
 }
 
 DEFUN ("window-pixel-height", Fwindow_pixel_height, Swindow_pixel_height, 0, 
1, 0,
@@ -720,7 +720,7 @@ divider, if any.  If WINDOW is an internal window, its 
pixel height is
 the height of the screen areas spanned by its children.  */)
   (Lisp_Object window)
 {
-  return make_number (decode_valid_window (window)->pixel_height);
+  return make_fixnum (decode_valid_window (window)->pixel_height);
 }
 
 DEFUN ("window-pixel-width-before-size-change",
@@ -734,7 +734,7 @@ The return value is the pixel width of WINDOW at the last 
time
 after that.  */)
   (Lisp_Object window)
 {
-  return (make_number
+  return (make_fixnum
          (decode_valid_window (window)->pixel_width_before_size_change));
 }
 
@@ -749,7 +749,7 @@ The return value is the pixel height of WINDOW at the last 
time
 after that.  */)
   (Lisp_Object window)
 {
-  return (make_number
+  return (make_fixnum
          (decode_valid_window (window)->pixel_height_before_size_change));
 }
 
@@ -778,12 +778,12 @@ total height of WINDOW.  */)
   struct window *w = decode_valid_window (window);
 
   if (! EQ (round, Qfloor) && ! EQ (round, Qceiling))
-    return make_number (w->total_lines);
+    return make_fixnum (w->total_lines);
   else
     {
       int unit = FRAME_LINE_HEIGHT (WINDOW_XFRAME (w));
 
-      return make_number (EQ (round, Qceiling)
+      return make_fixnum (EQ (round, Qceiling)
                          ? ((w->pixel_height + unit - 1) /unit)
                          : (w->pixel_height / unit));
     }
@@ -815,12 +815,12 @@ total width of WINDOW.  */)
   struct window *w = decode_valid_window (window);
 
   if (! EQ (round, Qfloor) && ! EQ (round, Qceiling))
-    return make_number (w->total_cols);
+    return make_fixnum (w->total_cols);
   else
     {
       int unit = FRAME_COLUMN_WIDTH (WINDOW_XFRAME (w));
 
-      return make_number (EQ (round, Qceiling)
+      return make_fixnum (EQ (round, Qceiling)
                          ? ((w->pixel_width + unit - 1) /unit)
                          : (w->pixel_width / unit));
     }
@@ -898,7 +898,7 @@ DEFUN ("window-pixel-left", Fwindow_pixel_left, 
Swindow_pixel_left, 0, 1, 0,
 WINDOW must be a valid window and defaults to the selected one.  */)
   (Lisp_Object window)
 {
-  return make_number (decode_valid_window (window)->pixel_left);
+  return make_fixnum (decode_valid_window (window)->pixel_left);
 }
 
 DEFUN ("window-pixel-top", Fwindow_pixel_top, Swindow_pixel_top, 0, 1, 0,
@@ -906,7 +906,7 @@ DEFUN ("window-pixel-top", Fwindow_pixel_top, 
Swindow_pixel_top, 0, 1, 0,
 WINDOW must be a valid window and defaults to the selected one.  */)
   (Lisp_Object window)
 {
-  return make_number (decode_valid_window (window)->pixel_top);
+  return make_fixnum (decode_valid_window (window)->pixel_top);
 }
 
 DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0,
@@ -918,7 +918,7 @@ value is 0 if there is no window to the left of WINDOW.
 WINDOW must be a valid window and defaults to the selected one.  */)
   (Lisp_Object window)
 {
-  return make_number (decode_valid_window (window)->left_col);
+  return make_fixnum (decode_valid_window (window)->left_col);
 }
 
 DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0,
@@ -930,7 +930,7 @@ there is no window above WINDOW.
 WINDOW must be a valid window and defaults to the selected one.  */)
   (Lisp_Object window)
 {
-  return make_number (decode_valid_window (window)->top_line);
+  return make_fixnum (decode_valid_window (window)->top_line);
 }
 
 /* Return the number of lines/pixels of W's body.  Don't count any mode
@@ -997,7 +997,7 @@ means that if a line at the bottom of the text area is only 
partially
 visible, that line is not counted.  */)
   (Lisp_Object window, Lisp_Object pixelwise)
 {
-  return make_number (window_body_height (decode_live_window (window),
+  return make_fixnum (window_body_height (decode_live_window (window),
                                          !NILP (pixelwise)));
 }
 
@@ -1017,7 +1017,7 @@ Note that the returned value includes the column reserved 
for the
 continuation glyph.  */)
   (Lisp_Object window, Lisp_Object pixelwise)
 {
-  return make_number (window_body_width (decode_live_window (window),
+  return make_fixnum (window_body_width (decode_live_window (window),
                                         !NILP (pixelwise)));
 }
 
@@ -1027,7 +1027,7 @@ DEFUN ("window-mode-line-height", 
Fwindow_mode_line_height,
 WINDOW must be a live window and defaults to the selected one.  */)
   (Lisp_Object window)
 {
-  return (make_number (WINDOW_MODE_LINE_HEIGHT (decode_live_window (window))));
+  return (make_fixnum (WINDOW_MODE_LINE_HEIGHT (decode_live_window (window))));
 }
 
 DEFUN ("window-header-line-height", Fwindow_header_line_height,
@@ -1036,7 +1036,7 @@ DEFUN ("window-header-line-height", 
Fwindow_header_line_height,
 WINDOW must be a live window and defaults to the selected one.  */)
   (Lisp_Object window)
 {
-  return (make_number (WINDOW_HEADER_LINE_HEIGHT (decode_live_window 
(window))));
+  return (make_fixnum (WINDOW_HEADER_LINE_HEIGHT (decode_live_window 
(window))));
 }
 
 DEFUN ("window-right-divider-width", Fwindow_right_divider_width,
@@ -1045,7 +1045,7 @@ DEFUN ("window-right-divider-width", 
Fwindow_right_divider_width,
 WINDOW must be a live window and defaults to the selected one.  */)
   (Lisp_Object window)
 {
-  return (make_number (WINDOW_RIGHT_DIVIDER_WIDTH (decode_live_window 
(window))));
+  return (make_fixnum (WINDOW_RIGHT_DIVIDER_WIDTH (decode_live_window 
(window))));
 }
 
 DEFUN ("window-bottom-divider-width", Fwindow_bottom_divider_width,
@@ -1054,7 +1054,7 @@ DEFUN ("window-bottom-divider-width", 
Fwindow_bottom_divider_width,
 WINDOW must be a live window and defaults to the selected one.  */)
   (Lisp_Object window)
 {
-  return (make_number (WINDOW_BOTTOM_DIVIDER_WIDTH (decode_live_window 
(window))));
+  return (make_fixnum (WINDOW_BOTTOM_DIVIDER_WIDTH (decode_live_window 
(window))));
 }
 
 DEFUN ("window-scroll-bar-width", Fwindow_scroll_bar_width,
@@ -1063,7 +1063,7 @@ DEFUN ("window-scroll-bar-width", 
Fwindow_scroll_bar_width,
 WINDOW must be a live window and defaults to the selected one.  */)
   (Lisp_Object window)
 {
-  return (make_number (WINDOW_SCROLL_BAR_AREA_WIDTH (decode_live_window 
(window))));
+  return (make_fixnum (WINDOW_SCROLL_BAR_AREA_WIDTH (decode_live_window 
(window))));
 }
 
 DEFUN ("window-scroll-bar-height", Fwindow_scroll_bar_height,
@@ -1072,7 +1072,7 @@ DEFUN ("window-scroll-bar-height", 
Fwindow_scroll_bar_height,
 WINDOW must be a live window and defaults to the selected one.  */)
   (Lisp_Object window)
 {
-  return (make_number (WINDOW_SCROLL_BAR_AREA_HEIGHT (decode_live_window 
(window))));
+  return (make_fixnum (WINDOW_SCROLL_BAR_AREA_HEIGHT (decode_live_window 
(window))));
 }
 
 DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0,
@@ -1080,7 +1080,7 @@ DEFUN ("window-hscroll", Fwindow_hscroll, 
Swindow_hscroll, 0, 1, 0,
 WINDOW must be a live window and defaults to the selected one.  */)
   (Lisp_Object window)
 {
-  return make_number (decode_live_window (window)->hscroll);
+  return make_fixnum (decode_live_window (window)->hscroll);
 }
 
 /* Set W's horizontal scroll amount to HSCROLL clipped to a reasonable
@@ -1104,7 +1104,7 @@ set_window_hscroll (struct window *w, EMACS_INT hscroll)
   w->hscroll = new_hscroll;
   w->suspend_auto_hscroll = true;
 
-  return make_number (new_hscroll);
+  return make_fixnum (new_hscroll);
 }
 
 DEFUN ("set-window-hscroll", Fset_window_hscroll, Sset_window_hscroll, 2, 2, 0,
@@ -1117,8 +1117,8 @@ Note that if `automatic-hscrolling' is non-nil, you 
cannot scroll the
 window so that the location of point moves off-window.  */)
   (Lisp_Object window, Lisp_Object ncol)
 {
-  CHECK_NUMBER (ncol);
-  return set_window_hscroll (decode_live_window (window), XINT (ncol));
+  CHECK_FIXNUM (ncol);
+  return set_window_hscroll (decode_live_window (window), XFIXNUM (ncol));
 }
 
 DEFUN ("window-redisplay-end-trigger", Fwindow_redisplay_end_trigger,
@@ -1383,8 +1383,8 @@ If they are in the windows's left or right marginal 
areas, `left-margin'\n\
   CHECK_CONS (coordinates);
   lx = Fcar (coordinates);
   ly = Fcdr (coordinates);
-  CHECK_NUMBER_OR_FLOAT (lx);
-  CHECK_NUMBER_OR_FLOAT (ly);
+  CHECK_FIXNUM_OR_FLOAT (lx);
+  CHECK_FIXNUM_OR_FLOAT (ly);
   x = FRAME_PIXEL_X_FROM_CANON_X (f, lx) + FRAME_INTERNAL_BORDER_WIDTH (f);
   y = FRAME_PIXEL_Y_FROM_CANON_Y (f, ly) + FRAME_INTERNAL_BORDER_WIDTH (f);
 
@@ -1534,8 +1534,8 @@ column 0.  */)
   struct frame *f = decode_live_frame (frame);
 
   /* Check that arguments are integers or floats.  */
-  CHECK_NUMBER_OR_FLOAT (x);
-  CHECK_NUMBER_OR_FLOAT (y);
+  CHECK_FIXNUM_OR_FLOAT (x);
+  CHECK_FIXNUM_OR_FLOAT (y);
 
   return window_from_coordinates (f,
                                  (FRAME_PIXEL_X_FROM_CANON_X (f, x)
@@ -1561,7 +1561,7 @@ correct to return the top-level value of `point', outside 
of any
   register struct window *w = decode_live_window (window);
 
   if (w == XWINDOW (selected_window))
-    return make_number (BUF_PT (XBUFFER (w->contents)));
+    return make_fixnum (BUF_PT (XBUFFER (w->contents)));
   else
     return Fmarker_position (w->pointm);
 }
@@ -1652,7 +1652,7 @@ if it isn't already recorded.  */)
       move_it_vertically (&it, window_box_height (w));
       if (it.current_y < it.last_visible_y)
        move_it_past_eol (&it);
-      value = make_number (IT_CHARPOS (it));
+      value = make_fixnum (IT_CHARPOS (it));
       bidi_unshelve_cache (itdata, false);
 
       if (old_buffer)
@@ -1683,7 +1683,7 @@ Return POS.  */)
          struct buffer *old_buffer = current_buffer;
 
          /* ... but here we want to catch type error before buffer change.  */
-         CHECK_NUMBER_COERCE_MARKER (pos);
+         CHECK_FIXNUM_COERCE_MARKER (pos);
          set_buffer_internal (XBUFFER (w->contents));
          Fgoto_char (pos);
          set_buffer_internal (old_buffer);
@@ -1763,8 +1763,8 @@ POS, ROWH is the visible height of that row, and VPOS is 
the row number
     posint = -1;
   else if (!NILP (pos))
     {
-      CHECK_NUMBER_COERCE_MARKER (pos);
-      posint = XINT (pos);
+      CHECK_FIXNUM_COERCE_MARKER (pos);
+      posint = XFIXNUM (pos);
     }
   else if (w == XWINDOW (selected_window))
     posint = PT;
@@ -1789,8 +1789,8 @@ POS, ROWH is the visible height of that row, and VPOS is 
the row number
       Lisp_Object part = Qnil;
       if (!fully_p)
        part = list4i (rtop, rbot, rowh, vpos);
-      in_window = Fcons (make_number (x),
-                        Fcons (make_number (y), part));
+      in_window = Fcons (make_fixnum (x),
+                        Fcons (make_fixnum (y), part));
     }
 
   return in_window;
@@ -1869,8 +1869,8 @@ Return nil if window display is not up-to-date.  In that 
case, use
              : Qnil);
     }
 
-  CHECK_NUMBER (line);
-  n = XINT (line);
+  CHECK_FIXNUM (line);
+  n = XFIXNUM (line);
 
   row = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
   end_row = MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w);
@@ -1972,10 +1972,10 @@ though when run from an idle timer with a delay of zero 
seconds.  */)
     row = (NILP (body)
           ? MATRIX_ROW (w->current_matrix, 0)
           : MATRIX_FIRST_TEXT_ROW (w->current_matrix));
-  else if (NUMBERP (first))
+  else if (FIXED_OR_FLOATP (first))
     {
       CHECK_RANGED_INTEGER (first, 0, w->current_matrix->nrows);
-      row = MATRIX_ROW (w->current_matrix, XINT (first));
+      row = MATRIX_ROW (w->current_matrix, XFIXNUM (first));
     }
   else
     error ("Invalid specification of first line");
@@ -1985,10 +1985,10 @@ though when run from an idle timer with a delay of zero 
seconds.  */)
     end_row = (NILP (body)
               ? MATRIX_ROW (w->current_matrix, w->current_matrix->nrows)
               : MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w));
-  else if (NUMBERP (last))
+  else if (FIXED_OR_FLOATP (last))
     {
       CHECK_RANGED_INTEGER (last, 0, w->current_matrix->nrows);
-      end_row = MATRIX_ROW (w->current_matrix, XINT (last));
+      end_row = MATRIX_ROW (w->current_matrix, XFIXNUM (last));
     }
   else
     error ("Invalid specification of last line");
@@ -2001,19 +2001,19 @@ though when run from an idle timer with a delay of zero 
seconds.  */)
        {
          struct glyph *glyph = row->glyphs[TEXT_AREA];
 
-         rows = Fcons (Fcons (make_number
+         rows = Fcons (Fcons (make_fixnum
                               (invert
                                ? glyph->pixel_width
                                : window_width - glyph->pixel_width),
-                              make_number (row->y + row->height - subtract)),
+                              make_fixnum (row->y + row->height - subtract)),
                        rows);
        }
       else
-       rows = Fcons (Fcons (make_number
+       rows = Fcons (Fcons (make_fixnum
                             (invert
                              ? window_width - row->pixel_width
                              : row->pixel_width),
-                            make_number (row->y + row->height - subtract)),
+                            make_fixnum (row->y + row->height - subtract)),
                      rows);
       row++;
     }
@@ -2492,7 +2492,7 @@ candidate_window_p (Lisp_Object window, Lisp_Object 
owindow,
            == FRAME_TERMINAL (XFRAME (selected_frame)));
 
     }
-  else if (INTEGERP (all_frames) && XINT (all_frames) == 0)
+  else if (FIXNUMP (all_frames) && XFIXNUM (all_frames) == 0)
     {
       candidate_p = (FRAME_VISIBLE_P (f) || FRAME_ICONIFIED_P (f)
 #ifdef HAVE_X_WINDOWS
@@ -2551,7 +2551,7 @@ decode_next_window_args (Lisp_Object *window, Lisp_Object 
*minibuf, Lisp_Object
         : Qnil);
   else if (EQ (*all_frames, Qvisible))
     ;
-  else if (EQ (*all_frames, make_number (0)))
+  else if (EQ (*all_frames, make_fixnum (0)))
     ;
   else if (FRAMEP (*all_frames))
     ;
@@ -2834,7 +2834,7 @@ window_loop (enum window_loop type, Lisp_Object obj, bool 
mini,
 
   if (f)
     frame_arg = Qlambda;
-  else if (EQ (frames, make_number (0)))
+  else if (EQ (frames, make_fixnum (0)))
     frame_arg = frames;
   else if (EQ (frames, Qvisible))
     frame_arg = frames;
@@ -3494,8 +3494,8 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer,
   b->display_error_modiff = 0;
 
   /* Update time stamps of buffer display.  */
-  if (INTEGERP (BVAR (b, display_count)))
-    bset_display_count (b, make_number (XINT (BVAR (b, display_count)) + 1));
+  if (FIXNUMP (BVAR (b, display_count)))
+    bset_display_count (b, make_fixnum (XFIXNUM (BVAR (b, display_count)) + 
1));
   bset_display_time (b, Fcurrent_time ());
 
   w->window_end_pos = 0;
@@ -3513,7 +3513,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer,
       set_marker_both (w->pointm, buffer, BUF_PT (b), BUF_PT_BYTE (b));
       set_marker_both (w->old_pointm, buffer, BUF_PT (b), BUF_PT_BYTE (b));
       set_marker_restricted (w->start,
-                            make_number (b->last_window_start),
+                            make_fixnum (b->last_window_start),
                             buffer);
       w->start_at_line_beg = false;
       w->force_start = false;
@@ -3769,9 +3769,9 @@ make_window (void)
      Lisp data to nil, so do it only for slots which should not be nil.  */
   wset_normal_lines (w, make_float (1.0));
   wset_normal_cols (w, make_float (1.0));
-  wset_new_total (w, make_number (0));
-  wset_new_normal (w, make_number (0));
-  wset_new_pixel (w, make_number (0));
+  wset_new_total (w, make_fixnum (0));
+  wset_new_normal (w, make_fixnum (0));
+  wset_new_pixel (w, make_fixnum (0));
   wset_start (w, Fmake_marker ());
   wset_pointm (w, Fmake_marker ());
   wset_old_pointm (w, Fmake_marker ());
@@ -3820,14 +3820,14 @@ Note: This function does not operate on any child 
windows of WINDOW.  */)
   (Lisp_Object window, Lisp_Object size, Lisp_Object add)
 {
   struct window *w = decode_valid_window (window);
-  EMACS_INT size_min = NILP (add) ? 0 : - XINT (w->new_pixel);
+  EMACS_INT size_min = NILP (add) ? 0 : - XFIXNUM (w->new_pixel);
   EMACS_INT size_max = size_min + min (INT_MAX, MOST_POSITIVE_FIXNUM);
 
   CHECK_RANGED_INTEGER (size, size_min, size_max);
   if (NILP (add))
     wset_new_pixel (w, size);
   else
-    wset_new_pixel (w, make_number (XINT (w->new_pixel) + XINT (size)));
+    wset_new_pixel (w, make_fixnum (XFIXNUM (w->new_pixel) + XFIXNUM (size)));
 
   return w->new_pixel;
 }
@@ -3849,11 +3849,11 @@ Note: This function does not operate on any child 
windows of WINDOW.  */)
 {
   struct window *w = decode_valid_window (window);
 
-  CHECK_NUMBER (size);
+  CHECK_FIXNUM (size);
   if (NILP (add))
     wset_new_total (w, size);
   else
-    wset_new_total (w, make_number (XINT (w->new_total) + XINT (size)));
+    wset_new_total (w, make_fixnum (XFIXNUM (w->new_total) + XFIXNUM (size)));
 
   return w->new_total;
 }
@@ -3895,7 +3895,7 @@ window_resize_check (struct window *w, bool horflag)
        {
          while (c)
            {
-             if (XINT (c->new_pixel) != XINT (w->new_pixel)
+             if (XFIXNUM (c->new_pixel) != XFIXNUM (w->new_pixel)
                  || !window_resize_check (c, horflag))
                return false;
 
@@ -3908,14 +3908,14 @@ window_resize_check (struct window *w, bool horflag)
        /* The sum of the heights of the child windows of W must equal
           W's height.  */
        {
-         int remaining_pixels = XINT (w->new_pixel);
+         int remaining_pixels = XFIXNUM (w->new_pixel);
 
          while (c)
            {
              if (!window_resize_check (c, horflag))
                return false;
 
-             remaining_pixels -= XINT (c->new_pixel);
+             remaining_pixels -= XFIXNUM (c->new_pixel);
              if (remaining_pixels < 0)
                return false;
              c = NILP (c->next) ? 0 : XWINDOW (c->next);
@@ -3932,14 +3932,14 @@ window_resize_check (struct window *w, bool horflag)
        /* The sum of the widths of the child windows of W must equal W's
           width.  */
        {
-         int remaining_pixels = XINT (w->new_pixel);
+         int remaining_pixels = XFIXNUM (w->new_pixel);
 
          while (c)
            {
              if (!window_resize_check (c, horflag))
                return false;
 
-             remaining_pixels -= XINT (c->new_pixel);
+             remaining_pixels -= XFIXNUM (c->new_pixel);
              if (remaining_pixels < 0)
                return false;
              c = NILP (c->next) ? 0 : XWINDOW (c->next);
@@ -3952,7 +3952,7 @@ window_resize_check (struct window *w, bool horflag)
        {
          while (c)
            {
-             if (XINT (c->new_pixel) != XINT (w->new_pixel)
+             if (XFIXNUM (c->new_pixel) != XFIXNUM (w->new_pixel)
                  || !window_resize_check (c, horflag))
                return false;
 
@@ -3966,7 +3966,7 @@ window_resize_check (struct window *w, bool horflag)
     /* A leaf window.  Make sure it's not too small.  The following
        hardcodes the values of `window-safe-min-width' (2) and
        `window-safe-min-height' (1) which are defined in window.el.  */
-    return (XINT (w->new_pixel) >= (horflag
+    return (XFIXNUM (w->new_pixel) >= (horflag
                                    ? (2 * FRAME_COLUMN_WIDTH (f))
                                    : FRAME_LINE_HEIGHT (f)));
 }
@@ -3992,18 +3992,18 @@ window_resize_apply (struct window *w, bool horflag)
      parent window has been set *before*.  */
   if (horflag)
     {
-      w->pixel_width = XFASTINT (w->new_pixel);
+      w->pixel_width = XFIXNAT (w->new_pixel);
       w->total_cols = w->pixel_width / unit;
-      if (NUMBERP (w->new_normal))
+      if (FIXED_OR_FLOATP (w->new_normal))
        wset_normal_cols (w, w->new_normal);
 
       edge = w->pixel_left;
     }
   else
     {
-      w->pixel_height = XFASTINT (w->new_pixel);
+      w->pixel_height = XFIXNAT (w->new_pixel);
       w->total_lines = w->pixel_height / unit;
-      if (NUMBERP (w->new_normal))
+      if (FIXED_OR_FLOATP (w->new_normal))
        wset_normal_lines (w, w->new_normal);
 
       edge = w->pixel_top;
@@ -4076,12 +4076,12 @@ window_resize_apply_total (struct window *w, bool 
horflag)
      parent window has been set *before*.  */
   if (horflag)
     {
-      w->total_cols = XFASTINT (w->new_total);
+      w->total_cols = XFIXNAT (w->new_total);
       edge = w->left_col;
     }
   else
     {
-      w->total_lines = XFASTINT (w->new_total);
+      w->total_lines = XFIXNAT (w->new_total);
       edge = w->top_line;
     }
 
@@ -4149,7 +4149,7 @@ be applied on the Elisp level.  */)
   bool horflag = !NILP (horizontal);
 
   if (!window_resize_check (r, horflag)
-      || (XINT (r->new_pixel)
+      || (XFIXNUM (r->new_pixel)
          != (horflag ? r->pixel_width : r->pixel_height)))
     return Qnil;
 
@@ -4193,10 +4193,10 @@ values.  */)
       if (NILP (horizontal))
        {
          m->top_line = r->top_line + r->total_lines;
-         m->total_lines = XFASTINT (m->new_total);
+         m->total_lines = XFIXNAT (m->new_total);
        }
       else
-       m->total_cols = XFASTINT (m->new_total);
+       m->total_cols = XFIXNAT (m->new_total);
     }
 
   unblock_input ();
@@ -4286,7 +4286,7 @@ resize_frame_windows (struct frame *f, int size, bool 
horflag, bool pixelwise)
       resize_root_window (root, delta, horflag ? Qt : Qnil, Qnil,
                          pixelwise ? Qt : Qnil);
       if (window_resize_check (r, horflag)
-         && new_pixel_size == XINT (r->new_pixel))
+         && new_pixel_size == XFIXNUM (r->new_pixel))
        {
          window_resize_apply (r, horflag);
          window_pixel_to_total (r->frame, horflag ? Qt : Qnil);
@@ -4297,7 +4297,7 @@ resize_frame_windows (struct frame *f, int size, bool 
horflag, bool pixelwise)
          resize_root_window (root, delta, horflag ? Qt : Qnil, Qt,
                              pixelwise ? Qt : Qnil);
          if (window_resize_check (r, horflag)
-             && new_pixel_size == XINT (r->new_pixel))
+             && new_pixel_size == XFIXNUM (r->new_pixel))
            {
              window_resize_apply (r, horflag);
              window_pixel_to_total (r->frame, horflag ? Qt : Qnil);
@@ -4369,9 +4369,9 @@ set correctly.  See the code of `split-window' for how 
this is done.  */)
   frame = WINDOW_FRAME (o);
   f = XFRAME (frame);
 
-  CHECK_NUMBER (pixel_size);
+  CHECK_FIXNUM (pixel_size);
   EMACS_INT total_size
-    = XINT (pixel_size) / (horflag
+    = XFIXNUM (pixel_size) / (horflag
                           ? FRAME_COLUMN_WIDTH (f)
                           : FRAME_LINE_HEIGHT (f));
 
@@ -4406,19 +4406,19 @@ set correctly.  See the code of `split-window' for how 
this is done.  */)
       p = XWINDOW (o->parent);
       /* Temporarily pretend we split the parent window.  */
       wset_new_pixel
-       (p, make_number ((horflag ? p->pixel_width : p->pixel_height)
-                        - XINT (pixel_size)));
+       (p, make_fixnum ((horflag ? p->pixel_width : p->pixel_height)
+                        - XFIXNUM (pixel_size)));
       if (!window_resize_check (p, horflag))
        error ("Window sizes don't fit");
       else
        /* Undo the temporary pretension.  */
-       wset_new_pixel (p, make_number (horflag ? p->pixel_width : 
p->pixel_height));
+       wset_new_pixel (p, make_fixnum (horflag ? p->pixel_width : 
p->pixel_height));
     }
   else
     {
       if (!window_resize_check (o, horflag))
        error ("Resizing old window failed");
-      else if (XINT (pixel_size) + XINT (o->new_pixel)
+      else if (XFIXNUM (pixel_size) + XFIXNUM (o->new_pixel)
               != (horflag ? o->pixel_width : o->pixel_height))
        error ("Sum of sizes of old and new window don't fit");
     }
@@ -4440,9 +4440,9 @@ set correctly.  See the code of `split-window' for how 
this is done.  */)
        wset_combination_limit (p, Qt);
       /* These get applied below.  */
       wset_new_pixel
-       (p, make_number (horflag ? o->pixel_width : o->pixel_height));
+       (p, make_fixnum (horflag ? o->pixel_width : o->pixel_height));
       wset_new_total
-       (p, make_number (horflag ? o->total_cols : o->total_lines));
+       (p, make_fixnum (horflag ? o->total_cols : o->total_lines));
       wset_new_normal (p, new_normal);
     }
   else
@@ -4511,10 +4511,10 @@ set correctly.  See the code of `split-window' for how 
this is done.  */)
   while (c)
     {
       if (c != n)
-       sum = sum + XINT (c->new_total);
+       sum = sum + XFIXNUM (c->new_total);
       c = NILP (c->next) ? 0 : XWINDOW (c->next);
     }
-  wset_new_total (n, make_number ((horflag
+  wset_new_total (n, make_fixnum ((horflag
                                   ? p->total_cols
                                   : p->total_lines)
                                  - sum));
@@ -4596,7 +4596,7 @@ Signal an error when WINDOW is the only window on its 
frame.  */)
     }
 
   if (window_resize_check (r, horflag)
-      && (XINT (r->new_pixel)
+      && (XFIXNUM (r->new_pixel)
          == (horflag ? r->pixel_width : r->pixel_height)))
     /* We can delete WINDOW now.  */
     {
@@ -4727,20 +4727,20 @@ grow_mini_window (struct window *w, int delta, bool 
pixelwise)
       root = FRAME_ROOT_WINDOW (f);
       r = XWINDOW (root);
       height = call3 (Qwindow__resize_root_window_vertically,
-                     root, make_number (- delta), pixelwise ? Qt : Qnil);
-      if (INTEGERP (height) && window_resize_check (r, false))
+                     root, make_fixnum (- delta), pixelwise ? Qt : Qnil);
+      if (FIXNUMP (height) && window_resize_check (r, false))
        {
          block_input ();
          window_resize_apply (r, false);
 
          if (pixelwise)
            {
-             pixel_height = min (-XINT (height), INT_MAX - w->pixel_height);
+             pixel_height = min (-XFIXNUM (height), INT_MAX - w->pixel_height);
              line_height = pixel_height / FRAME_LINE_HEIGHT (f);
            }
          else
            {
-             line_height = min (-XINT (height),
+             line_height = min (-XFIXNUM (height),
                                 ((INT_MAX - w->pixel_height)
                                  / FRAME_LINE_HEIGHT (f)));
              pixel_height = line_height * FRAME_LINE_HEIGHT (f);
@@ -4784,9 +4784,9 @@ shrink_mini_window (struct window *w, bool pixelwise)
       root = FRAME_ROOT_WINDOW (f);
       r = XWINDOW (root);
       delta = call3 (Qwindow__resize_root_window_vertically,
-                    root, make_number (height - unit),
+                    root, make_fixnum (height - unit),
                     pixelwise ? Qt : Qnil);
-      if (INTEGERP (delta) && window_resize_check (r, false))
+      if (FIXNUMP (delta) && window_resize_check (r, false))
        {
          block_input ();
          window_resize_apply (r, false);
@@ -4831,13 +4831,13 @@ DEFUN ("resize-mini-window-internal", 
Fresize_mini_window_internal, Sresize_mini
   r = XWINDOW (FRAME_ROOT_WINDOW (f));
   height = r->pixel_height + w->pixel_height;
   if (window_resize_check (r, false)
-      && XINT (w->new_pixel) > 0
-      && height == XINT (r->new_pixel) + XINT (w->new_pixel))
+      && XFIXNUM (w->new_pixel) > 0
+      && height == XFIXNUM (r->new_pixel) + XFIXNUM (w->new_pixel))
     {
       block_input ();
       window_resize_apply (r, false);
 
-      w->pixel_height = XFASTINT (w->new_pixel);
+      w->pixel_height = XFIXNAT (w->new_pixel);
       w->total_lines = w->pixel_height / FRAME_LINE_HEIGHT (f);
       w->pixel_top = r->pixel_top + r->pixel_height;
       w->top_line = r->top_line + r->total_lines;
@@ -5105,7 +5105,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, 
bool whole, bool noerror)
              if (w->vscroll < 0 && rtop > 0)
                {
                  px = max (0, -w->vscroll - min (rtop, -dy));
-                 Fset_window_vscroll (window, make_number (px), Qt);
+                 Fset_window_vscroll (window, make_fixnum (px), Qt);
                  return;
                }
            }
@@ -5115,7 +5115,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, 
bool whole, bool noerror)
              if (rbot > 0 && (w->vscroll < 0 || vpos == 0))
                {
                  px = max (0, -w->vscroll + min (rbot, dy));
-                 Fset_window_vscroll (window, make_number (px), Qt);
+                 Fset_window_vscroll (window, make_fixnum (px), Qt);
                  return;
                }
 
@@ -5124,14 +5124,14 @@ window_scroll_pixel_based (Lisp_Object window, int n, 
bool whole, bool noerror)
                {
                  ptrdiff_t spos;
 
-                 Fset_window_vscroll (window, make_number (0), Qt);
+                 Fset_window_vscroll (window, make_fixnum (0), Qt);
                  /* If there are other text lines above the current row,
                     move window start to current row.  Else to next row. */
                  if (rbot > 0)
-                   spos = XINT (Fline_beginning_position (Qnil));
+                   spos = XFIXNUM (Fline_beginning_position (Qnil));
                  else
-                   spos = min (XINT (Fline_end_position (Qnil)) + 1, ZV);
-                 set_marker_restricted (w->start, make_number (spos),
+                   spos = min (XFIXNUM (Fline_end_position (Qnil)) + 1, ZV);
+                 set_marker_restricted (w->start, make_fixnum (spos),
                                         w->contents);
                  w->start_at_line_beg = true;
                  wset_update_mode_line (w);
@@ -5143,7 +5143,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, 
bool whole, bool noerror)
            }
        }
       /* Cancel previous vscroll.  */
-      Fset_window_vscroll (window, make_number (0), Qt);
+      Fset_window_vscroll (window, make_fixnum (0), Qt);
     }
 
   itdata = bidi_shelve_cache ();
@@ -5448,7 +5448,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, 
bool whole, bool noerror)
   if (adjust_old_pointm)
     Fset_marker (w->old_pointm,
                 ((w == XWINDOW (selected_window))
-                 ? make_number (BUF_PT (XBUFFER (w->contents)))
+                 ? make_fixnum (BUF_PT (XBUFFER (w->contents)))
                  : Fmarker_position (w->pointm)),
                 w->contents);
 }
@@ -5497,8 +5497,8 @@ window_scroll_line_based (Lisp_Object window, int n, bool 
whole, bool noerror)
          window_scroll_preserve_hpos = posit.hpos + w->hscroll;
        }
 
-      original_pos = Fcons (make_number (window_scroll_preserve_hpos),
-                           make_number (window_scroll_preserve_vpos));
+      original_pos = Fcons (make_fixnum (window_scroll_preserve_hpos),
+                           make_fixnum (window_scroll_preserve_vpos));
     }
 
   XSETFASTINT (tem, PT);
@@ -5506,14 +5506,14 @@ window_scroll_line_based (Lisp_Object window, int n, 
bool whole, bool noerror)
 
   if (NILP (tem))
     {
-      Fvertical_motion (make_number (- (ht / 2)), window, Qnil);
+      Fvertical_motion (make_fixnum (- (ht / 2)), window, Qnil);
       startpos = PT;
       startbyte = PT_BYTE;
     }
 
   SET_PT_BOTH (startpos, startbyte);
   lose = n < 0 && PT == BEGV;
-  Fvertical_motion (make_number (n), window, Qnil);
+  Fvertical_motion (make_fixnum (n), window, Qnil);
   pos = PT;
   pos_byte = PT_BYTE;
   bolp = Fbolp ();
@@ -5555,7 +5555,7 @@ window_scroll_line_based (Lisp_Object window, int n, bool 
whole, bool noerror)
          if (this_scroll_margin > 0)
            {
              SET_PT_BOTH (pos, pos_byte);
-             Fvertical_motion (make_number (this_scroll_margin), window, Qnil);
+             Fvertical_motion (make_fixnum (this_scroll_margin), window, Qnil);
              top_margin = PT;
            }
          else
@@ -5574,8 +5574,8 @@ window_scroll_line_based (Lisp_Object window, int n, bool 
whole, bool noerror)
              else if (window_scroll_preserve_vpos
                       >= w->total_lines - this_scroll_margin)
                nlines = w->total_lines - this_scroll_margin - 1;
-             Fvertical_motion (Fcons (make_number 
(window_scroll_preserve_hpos),
-                                      make_number (nlines)), window, Qnil);
+             Fvertical_motion (Fcons (make_fixnum 
(window_scroll_preserve_hpos),
+                                      make_fixnum (nlines)), window, Qnil);
            }
          else
            SET_PT (top_margin);
@@ -5587,9 +5587,9 @@ window_scroll_line_based (Lisp_Object window, int n, bool 
whole, bool noerror)
          /* If we scrolled backward, put point near the end of the window
             but not within the scroll margin.  */
          SET_PT_BOTH (pos, pos_byte);
-         tem = Fvertical_motion (make_number (ht - this_scroll_margin), window,
+         tem = Fvertical_motion (make_fixnum (ht - this_scroll_margin), window,
                                  Qnil);
-         if (XFASTINT (tem) == ht - this_scroll_margin)
+         if (XFIXNAT (tem) == ht - this_scroll_margin)
            bottom_margin = PT;
          else
            bottom_margin = PT + 1;
@@ -5609,11 +5609,11 @@ window_scroll_line_based (Lisp_Object window, int n, 
bool whole, bool noerror)
                  else if (window_scroll_preserve_vpos
                           >= ht - this_scroll_margin)
                    nlines = ht - this_scroll_margin - 1;
-                 Fvertical_motion (Fcons (make_number 
(window_scroll_preserve_hpos),
-                                          make_number (nlines)), window, Qnil);
+                 Fvertical_motion (Fcons (make_fixnum 
(window_scroll_preserve_hpos),
+                                          make_fixnum (nlines)), window, Qnil);
                }
              else
-               Fvertical_motion (make_number (-1), window, Qnil);
+               Fvertical_motion (make_fixnum (-1), window, Qnil);
            }
        }
     }
@@ -5628,7 +5628,7 @@ window_scroll_line_based (Lisp_Object window, int n, bool 
whole, bool noerror)
   if (adjust_old_pointm)
     Fset_marker (w->old_pointm,
                 ((w == XWINDOW (selected_window))
-                 ? make_number (BUF_PT (XBUFFER (w->contents)))
+                 ? make_fixnum (BUF_PT (XBUFFER (w->contents)))
                  : Fmarker_position (w->pointm)),
                 w->contents);
 }
@@ -5680,7 +5680,7 @@ scroll_command (Lisp_Object window, Lisp_Object n, int 
direction)
   else
     {
       n = Fprefix_numeric_value (n);
-      window_scroll (window, XINT (n) * direction, false, false);
+      window_scroll (window, XFIXNUM (n) * direction, false, false);
     }
 
   if (other_window)
@@ -5804,7 +5804,7 @@ by this function.  This happens in an interactive call.  
*/)
   struct window *w = XWINDOW (selected_window);
   EMACS_INT requested_arg = (NILP (arg)
                             ? window_body_width (w, 0) - 2
-                            : XINT (Fprefix_numeric_value (arg)));
+                            : XFIXNUM (Fprefix_numeric_value (arg)));
   Lisp_Object result = set_window_hscroll (w, w->hscroll + requested_arg);
 
   if (!NILP (set_minimum))
@@ -5829,7 +5829,7 @@ by this function.  This happens in an interactive call.  
*/)
   struct window *w = XWINDOW (selected_window);
   EMACS_INT requested_arg = (NILP (arg)
                             ? window_body_width (w, 0) - 2
-                            : XINT (Fprefix_numeric_value (arg)));
+                            : XFIXNUM (Fprefix_numeric_value (arg)));
   Lisp_Object result = set_window_hscroll (w, w->hscroll - requested_arg);
 
   if (!NILP (set_minimum))
@@ -5961,8 +5961,8 @@ and redisplay normally--don't erase and redraw the frame. 
 */)
   else
     {
       arg = Fprefix_numeric_value (arg);
-      CHECK_NUMBER (arg);
-      iarg = XINT (arg);
+      CHECK_FIXNUM (arg);
+      iarg = XFIXNUM (arg);
     }
 
   /* Do this after making BUF current
@@ -6139,10 +6139,10 @@ pixels.  */)
   struct window *w = decode_live_window (window);
 
   if (NILP (pixelwise))
-    return make_number (window_box_width (w, TEXT_AREA)
+    return make_fixnum (window_box_width (w, TEXT_AREA)
                        / FRAME_COLUMN_WIDTH (WINDOW_XFRAME (w)));
   else
-    return make_number (window_box_width (w, TEXT_AREA));
+    return make_fixnum (window_box_width (w, TEXT_AREA));
 }
 
 DEFUN ("window-text-height", Fwindow_text_height, Swindow_text_height,
@@ -6160,10 +6160,10 @@ pixels.  */)
   struct window *w = decode_live_window (window);
 
   if (NILP (pixelwise))
-    return make_number (window_box_height (w)
+    return make_fixnum (window_box_height (w)
                        / FRAME_LINE_HEIGHT (WINDOW_XFRAME (w)));
   else
-    return make_number (window_box_height (w));
+    return make_fixnum (window_box_height (w));
 }
 
 DEFUN ("move-to-window-line", Fmove_to_window_line, Smove_to_window_line,
@@ -6196,7 +6196,7 @@ from the top of the window.  */)
   if (start < BEGV || start > ZV)
     {
       int height = window_internal_height (w);
-      Fvertical_motion (make_number (- (height / 2)), window, Qnil);
+      Fvertical_motion (make_fixnum (- (height / 2)), window, Qnil);
       set_marker_both (w->start, w->contents, PT, PT_BYTE);
       w->start_at_line_beg = !NILP (Fbolp ());
       w->force_start = true;
@@ -6210,7 +6210,7 @@ from the top of the window.  */)
     XSETFASTINT (arg, lines / 2);
   else
     {
-      EMACS_INT iarg = XINT (Fprefix_numeric_value (arg));
+      EMACS_INT iarg = XFIXNUM (Fprefix_numeric_value (arg));
 
       if (iarg < 0)
        iarg = iarg + lines;
@@ -6228,12 +6228,12 @@ from the top of the window.  */)
       iarg = min (iarg, lines - this_scroll_margin - 1);
 #endif
 
-      arg = make_number (iarg);
+      arg = make_fixnum (iarg);
     }
 
   /* Skip past a partially visible first line.  */
   if (w->vscroll)
-    XSETINT (arg, XINT (arg) + 1);
+    XSETINT (arg, XFIXNUM (arg) + 1);
 
   return Fvertical_motion (arg, window, Qnil);
 }
@@ -6471,14 +6471,14 @@ the return value is nil.  Otherwise the value is t.  */)
 
          if (!NILP (p->parent))
            wset_parent
-             (w, SAVED_WINDOW_N (saved_windows, XFASTINT (p->parent))->window);
+             (w, SAVED_WINDOW_N (saved_windows, XFIXNAT (p->parent))->window);
          else
            wset_parent (w, Qnil);
 
          if (!NILP (p->prev))
            {
              wset_prev
-               (w, SAVED_WINDOW_N (saved_windows, XFASTINT (p->prev))->window);
+               (w, SAVED_WINDOW_N (saved_windows, XFIXNAT (p->prev))->window);
              wset_next (XWINDOW (w->prev), p->window);
            }
          else
@@ -6486,7 +6486,7 @@ the return value is nil.  Otherwise the value is t.  */)
              wset_prev (w, Qnil);
              if (!NILP (w->parent))
                wset_combination (XWINDOW (w->parent),
-                                 (XINT (p->total_cols)
+                                 (XFIXNUM (p->total_cols)
                                   != XWINDOW (w->parent)->total_cols),
                                  p->window);
            }
@@ -6494,32 +6494,32 @@ the return value is nil.  Otherwise the value is t.  */)
          /* If we squirreled away the buffer, restore it now.  */
          if (BUFFERP (w->combination_limit))
            wset_buffer (w, w->combination_limit);
-         w->pixel_left = XFASTINT (p->pixel_left);
-         w->pixel_top = XFASTINT (p->pixel_top);
-         w->pixel_width = XFASTINT (p->pixel_width);
-         w->pixel_height = XFASTINT (p->pixel_height);
+         w->pixel_left = XFIXNAT (p->pixel_left);
+         w->pixel_top = XFIXNAT (p->pixel_top);
+         w->pixel_width = XFIXNAT (p->pixel_width);
+         w->pixel_height = XFIXNAT (p->pixel_height);
          w->pixel_width_before_size_change
-           = XFASTINT (p->pixel_width_before_size_change);
+           = XFIXNAT (p->pixel_width_before_size_change);
          w->pixel_height_before_size_change
-           = XFASTINT (p->pixel_height_before_size_change);
-         w->left_col = XFASTINT (p->left_col);
-         w->top_line = XFASTINT (p->top_line);
-         w->total_cols = XFASTINT (p->total_cols);
-         w->total_lines = XFASTINT (p->total_lines);
+           = XFIXNAT (p->pixel_height_before_size_change);
+         w->left_col = XFIXNAT (p->left_col);
+         w->top_line = XFIXNAT (p->top_line);
+         w->total_cols = XFIXNAT (p->total_cols);
+         w->total_lines = XFIXNAT (p->total_lines);
          wset_normal_cols (w, p->normal_cols);
          wset_normal_lines (w, p->normal_lines);
-         w->hscroll = XFASTINT (p->hscroll);
+         w->hscroll = XFIXNAT (p->hscroll);
          w->suspend_auto_hscroll = !NILP (p->suspend_auto_hscroll);
-         w->min_hscroll = XFASTINT (p->min_hscroll);
-         w->hscroll_whole = XFASTINT (p->hscroll_whole);
+         w->min_hscroll = XFIXNAT (p->min_hscroll);
+         w->hscroll_whole = XFIXNAT (p->hscroll_whole);
          wset_display_table (w, p->display_table);
-         w->left_margin_cols = XINT (p->left_margin_cols);
-         w->right_margin_cols = XINT (p->right_margin_cols);
-         w->left_fringe_width = XINT (p->left_fringe_width);
-         w->right_fringe_width = XINT (p->right_fringe_width);
+         w->left_margin_cols = XFIXNUM (p->left_margin_cols);
+         w->right_margin_cols = XFIXNUM (p->right_margin_cols);
+         w->left_fringe_width = XFIXNUM (p->left_fringe_width);
+         w->right_fringe_width = XFIXNUM (p->right_fringe_width);
          w->fringes_outside_margins = !NILP (p->fringes_outside_margins);
-         w->scroll_bar_width = XINT (p->scroll_bar_width);
-         w->scroll_bar_height = XINT (p->scroll_bar_height);
+         w->scroll_bar_width = XFIXNUM (p->scroll_bar_width);
+         w->scroll_bar_height = XFIXNUM (p->scroll_bar_height);
          wset_vertical_scroll_bar_type (w, p->vertical_scroll_bar_type);
          wset_horizontal_scroll_bar_type (w, p->horizontal_scroll_bar_type);
          wset_dedicated (w, p->dedicated);
@@ -6611,7 +6611,7 @@ the return value is nil.  Otherwise the value is t.  */)
         current when the window configuration was saved.  */
       if (EQ (XWINDOW (data->current_window)->contents, new_current_buffer))
        set_marker_restricted (XWINDOW (data->current_window)->pointm,
-                              make_number (old_point),
+                              make_fixnum (old_point),
                               XWINDOW (data->current_window)->contents);
 
       /* In the following call to select_window, prevent "swapping out
@@ -6715,7 +6715,7 @@ the return value is nil.  Otherwise the value is t.  */)
         the "normal" frame's selected window and that window *does*
         show new_current_buffer.  */
       if (!EQ (XWINDOW (selected_window)->contents, new_current_buffer))
-       Fgoto_char (make_number (old_point));
+       Fgoto_char (make_fixnum (old_point));
     }
 
   Vminibuf_scroll_window = data->minibuf_scroll_window;
@@ -6850,21 +6850,21 @@ save_window_save (Lisp_Object window, struct 
Lisp_Vector *vector, ptrdiff_t i)
       p = SAVED_WINDOW_N (vector, i);
       w = XWINDOW (window);
 
-      wset_temslot (w, make_number (i)); i++;
+      wset_temslot (w, make_fixnum (i)); i++;
       p->window = window;
       p->buffer = (WINDOW_LEAF_P (w) ? w->contents : Qnil);
-      p->pixel_left = make_number (w->pixel_left);
-      p->pixel_top = make_number (w->pixel_top);
-      p->pixel_width = make_number (w->pixel_width);
-      p->pixel_height = make_number (w->pixel_height);
+      p->pixel_left = make_fixnum (w->pixel_left);
+      p->pixel_top = make_fixnum (w->pixel_top);
+      p->pixel_width = make_fixnum (w->pixel_width);
+      p->pixel_height = make_fixnum (w->pixel_height);
       p->pixel_width_before_size_change
-       = make_number (w->pixel_width_before_size_change);
+       = make_fixnum (w->pixel_width_before_size_change);
       p->pixel_height_before_size_change
-       = make_number (w->pixel_height_before_size_change);
-      p->left_col = make_number (w->left_col);
-      p->top_line = make_number (w->top_line);
-      p->total_cols = make_number (w->total_cols);
-      p->total_lines = make_number (w->total_lines);
+       = make_fixnum (w->pixel_height_before_size_change);
+      p->left_col = make_fixnum (w->left_col);
+      p->top_line = make_fixnum (w->top_line);
+      p->total_cols = make_fixnum (w->total_cols);
+      p->total_lines = make_fixnum (w->total_lines);
       p->normal_cols = w->normal_cols;
       p->normal_lines = w->normal_lines;
       XSETFASTINT (p->hscroll, w->hscroll);
@@ -6872,13 +6872,13 @@ save_window_save (Lisp_Object window, struct 
Lisp_Vector *vector, ptrdiff_t i)
       XSETFASTINT (p->min_hscroll, w->min_hscroll);
       XSETFASTINT (p->hscroll_whole, w->hscroll_whole);
       p->display_table = w->display_table;
-      p->left_margin_cols = make_number (w->left_margin_cols);
-      p->right_margin_cols = make_number (w->right_margin_cols);
-      p->left_fringe_width = make_number (w->left_fringe_width);
-      p->right_fringe_width = make_number (w->right_fringe_width);
+      p->left_margin_cols = make_fixnum (w->left_margin_cols);
+      p->right_margin_cols = make_fixnum (w->right_margin_cols);
+      p->left_fringe_width = make_fixnum (w->left_fringe_width);
+      p->right_fringe_width = make_fixnum (w->right_fringe_width);
       p->fringes_outside_margins = w->fringes_outside_margins ? Qt : Qnil;
-      p->scroll_bar_width = make_number (w->scroll_bar_width);
-      p->scroll_bar_height = make_number (w->scroll_bar_height);
+      p->scroll_bar_width = make_fixnum (w->scroll_bar_width);
+      p->scroll_bar_height = make_fixnum (w->scroll_bar_height);
       p->vertical_scroll_bar_type = w->vertical_scroll_bar_type;
       p->horizontal_scroll_bar_type = w->horizontal_scroll_bar_type;
       p->dedicated = w->dedicated;
@@ -7013,7 +7013,7 @@ saved by this function.  */)
   data->saved_windows = tem;
   for (i = 0; i < n_windows; i++)
     ASET (tem, i,
-         Fmake_vector (make_number (VECSIZE (struct saved_window)), Qnil));
+         Fmake_vector (make_fixnum (VECSIZE (struct saved_window)), Qnil));
   save_window_save (FRAME_ROOT_WINDOW (f), XVECTOR (tem), 0);
   XSETWINDOW_CONFIGURATION (tem, data);
   return (tem);
@@ -7042,7 +7042,7 @@ extract_dimension (Lisp_Object dimension)
   if (NILP (dimension))
     return -1;
   CHECK_RANGED_INTEGER (dimension, 0, INT_MAX);
-  return XINT (dimension);
+  return XFIXNUM (dimension);
 }
 
 static struct window *
@@ -7105,9 +7105,9 @@ as nil.  */)
 {
   struct window *w = decode_live_window (window);
   return Fcons (w->left_margin_cols
-               ? make_number (w->left_margin_cols) : Qnil,
+               ? make_fixnum (w->left_margin_cols) : Qnil,
                w->right_margin_cols
-               ? make_number (w->right_margin_cols) : Qnil);
+               ? make_fixnum (w->right_margin_cols) : Qnil);
 }
 
 
@@ -7186,8 +7186,8 @@ Value is a list of the form (LEFT-WIDTH RIGHT-WIDTH 
OUTSIDE-MARGINS).  */)
 {
   struct window *w = decode_live_window (window);
 
-  return list3 (make_number (WINDOW_LEFT_FRINGE_WIDTH (w)),
-               make_number (WINDOW_RIGHT_FRINGE_WIDTH (w)),
+  return list3 (make_fixnum (WINDOW_LEFT_FRINGE_WIDTH (w)),
+               make_fixnum (WINDOW_RIGHT_FRINGE_WIDTH (w)),
                WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) ? Qt : Qnil);
 }
 
@@ -7309,14 +7309,14 @@ value.  */)
   struct window *w = decode_live_window (window);
 
   return Fcons (((w->scroll_bar_width >= 0)
-                ? make_number (w->scroll_bar_width)
+                ? make_fixnum (w->scroll_bar_width)
                 : Qnil),
-               list5 (make_number (WINDOW_SCROLL_BAR_COLS (w)),
+               list5 (make_fixnum (WINDOW_SCROLL_BAR_COLS (w)),
                       w->vertical_scroll_bar_type,
                       ((w->scroll_bar_height >= 0)
-                       ? make_number (w->scroll_bar_height)
+                       ? make_fixnum (w->scroll_bar_height)
                        : Qnil),
-                      make_number (WINDOW_SCROLL_BAR_LINES (w)),
+                      make_fixnum (WINDOW_SCROLL_BAR_LINES (w)),
                       w->horizontal_scroll_bar_type));
 }
 
@@ -7338,9 +7338,9 @@ optional second arg PIXELS-P means value is measured in 
pixels.  */)
   if (FRAME_WINDOW_P (f))
     result = (NILP (pixels_p)
              ? FRAME_CANON_Y_FROM_PIXEL_Y (f, -w->vscroll)
-             : make_number (-w->vscroll));
+             : make_fixnum (-w->vscroll));
   else
-    result = make_number (0);
+    result = make_fixnum (0);
   return result;
 }
 
@@ -7360,7 +7360,7 @@ If PIXELS-P is non-nil, the return value is VSCROLL.  */)
   struct window *w = decode_live_window (window);
   struct frame *f = XFRAME (w->frame);
 
-  CHECK_NUMBER_OR_FLOAT (vscroll);
+  CHECK_FIXNUM_OR_FLOAT (vscroll);
 
   if (FRAME_WINDOW_P (f))
     {
diff --git a/src/xdisp.c b/src/xdisp.c
index 8f89ec5..0835cca 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -467,12 +467,12 @@ static bool message_enable_multibyte;
    looking for those `redisplay' bits (actually, there might be some such bits
    set, but then only on objects which aren't displayed anyway).
 
-   OTOH if it's non-zero we wil have to loop through all windows and then check
-   the `redisplay' bit of the corresponding window, frame, and buffer, in order
-   to decide whether that window needs attention or not.  Note that we can't
-   just look at the frame's redisplay bit to decide that the whole frame can be
-   skipped, since even if the frame's redisplay bit is unset, some of its
-   windows's redisplay bits may be set.
+   OTOH if it's non-zero we will have to loop through all windows and then
+   check the `redisplay' bit of the corresponding window, frame, and buffer, in
+   order to decide whether that window needs attention or not.  Note that we
+   can't just look at the frame's redisplay bit to decide that the whole frame
+   can be skipped, since even if the frame's redisplay bit is unset, some of
+   its windows's redisplay bits may be set.
 
    Mostly for historical reasons, windows_or_buffers_changed can also take
    other non-zero values.  In that case, the precise value doesn't matter (it
@@ -483,7 +483,7 @@ static bool message_enable_multibyte;
 int windows_or_buffers_changed;
 
 /* Nonzero if we should redraw the mode lines on the next redisplay.
-   Similarly to `windows_or_buffers_changed', If it has value REDISPLAY_SOME,
+   Similarly to `windows_or_buffers_changed', if it has value REDISPLAY_SOME,
    then only redisplay the mode lines in those buffers/windows/frames where the
    `redisplay' bit has been set.
    For any other value, redisplay all mode lines (the number used is then only
@@ -1214,7 +1214,7 @@ Value is the height in pixels of the line at point.  */)
   move_it_by_lines (&it, 0);
   it.vpos = it.current_y = 0;
   last_height = 0;
-  result = make_number (line_bottom_y (&it));
+  result = make_fixnum (line_bottom_y (&it));
   if (old_buffer)
     set_buffer_internal_1 (old_buffer);
 
@@ -1250,8 +1250,8 @@ default_line_pixel_height (struct window *w)
        val = BVAR (&buffer_defaults, extra_line_spacing);
       if (!NILP (val))
        {
-         if (RANGED_INTEGERP (0, val, INT_MAX))
-           height += XFASTINT (val);
+         if (RANGED_FIXNUMP (0, val, INT_MAX))
+           height += XFIXNAT (val);
          else if (FLOATP (val))
            {
              int addon = XFLOAT_DATA (val) * height + 0.5;
@@ -1507,7 +1507,7 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int 
*x, int *y,
            }
          else if (IT_CHARPOS (it) != charpos)
            {
-             Lisp_Object cpos = make_number (charpos);
+             Lisp_Object cpos = make_fixnum (charpos);
              Lisp_Object spec = Fget_char_property (cpos, Qdisplay, Qnil);
              Lisp_Object string = string_from_display_spec (spec);
              struct text_pos tpos;
@@ -1550,8 +1550,8 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int 
*x, int *y,
                  startpos =
                    Fprevious_single_char_property_change (endpos, Qdisplay,
                                                           Qnil, Qnil);
-                 start = XFASTINT (startpos);
-                 end = XFASTINT (endpos);
+                 start = XFIXNAT (startpos);
+                 end = XFIXNAT (endpos);
                  /* Move to the last buffer position before the
                     display property.  */
                  start_display (&it3, w, top);
@@ -2281,9 +2281,9 @@ get_phys_cursor_geometry (struct window *w, struct 
glyph_row *row,
   int x, y, wd, h, h0, y0, ascent;
 
   /* Compute the width of the rectangle to draw.  If on a stretch
-     glyph, and `x-stretch-block-cursor' is nil, don't draw a
-     rectangle as wide as the glyph, but use a canonical character
-     width instead.  */
+     glyph, and `x-stretch-cursor' is nil, don't draw a rectangle
+     as wide as the glyph, but use a canonical character width
+     instead.  */
   wd = glyph->pixel_width;
 
   x = w->phys_cursor.x;
@@ -2842,8 +2842,8 @@ init_iterator (struct it *it, struct window *w,
   if (base_face_id == DEFAULT_FACE_ID
       && FRAME_WINDOW_P (it->f))
     {
-      if (NATNUMP (BVAR (current_buffer, extra_line_spacing)))
-       it->extra_line_spacing = XFASTINT (BVAR (current_buffer, 
extra_line_spacing));
+      if (FIXNATP (BVAR (current_buffer, extra_line_spacing)))
+       it->extra_line_spacing = XFIXNAT (BVAR (current_buffer, 
extra_line_spacing));
       else if (FLOATP (BVAR (current_buffer, extra_line_spacing)))
        it->extra_line_spacing = (XFLOAT_DATA (BVAR (current_buffer, 
extra_line_spacing))
                                  * FRAME_LINE_HEIGHT (it->f));
@@ -2868,9 +2868,9 @@ init_iterator (struct it *it, struct window *w,
   /* -1 means everything between a CR and the following line end
      is invisible.  >0 means lines indented more than this value are
      invisible.  */
-  it->selective = (INTEGERP (BVAR (current_buffer, selective_display))
+  it->selective = (FIXNUMP (BVAR (current_buffer, selective_display))
                   ? (clip_to_bounds
-                     (-1, XINT (BVAR (current_buffer, selective_display)),
+                     (-1, XFIXNUM (BVAR (current_buffer, selective_display)),
                       PTRDIFF_MAX))
                   : (!NILP (BVAR (current_buffer, selective_display))
                      ? -1 : 0));
@@ -2889,9 +2889,9 @@ init_iterator (struct it *it, struct window *w,
       && XMARKER (w->redisplay_end_trigger)->buffer != 0)
     it->redisplay_end_trigger_charpos
       = marker_position (w->redisplay_end_trigger);
-  else if (INTEGERP (w->redisplay_end_trigger))
+  else if (FIXNUMP (w->redisplay_end_trigger))
     it->redisplay_end_trigger_charpos
-      = clip_to_bounds (PTRDIFF_MIN, XINT (w->redisplay_end_trigger),
+      = clip_to_bounds (PTRDIFF_MIN, XFIXNUM (w->redisplay_end_trigger),
                        PTRDIFF_MAX);
 
   it->tab_width = SANE_TAB_WIDTH (current_buffer);
@@ -2903,9 +2903,9 @@ init_iterator (struct it *it, struct window *w,
       && !it->w->hscroll
       && (WINDOW_FULL_WIDTH_P (it->w)
          || NILP (Vtruncate_partial_width_windows)
-         || (INTEGERP (Vtruncate_partial_width_windows)
+         || (FIXNUMP (Vtruncate_partial_width_windows)
              /* PXW: Shall we do something about this?  */
-             && (XINT (Vtruncate_partial_width_windows)
+             && (XFIXNUM (Vtruncate_partial_width_windows)
                  <= WINDOW_TOTAL_COLS (it->w))))
       && NILP (BVAR (current_buffer, truncate_lines)))
     it->line_wrap = NILP (BVAR (current_buffer, word_wrap))
@@ -3188,11 +3188,11 @@ in_ellipses_for_invisible_text_p (struct display_pos 
*pos, struct window *w)
       && CHARPOS (pos->string_pos) < 0
       && charpos > BEGV
       && (XSETWINDOW (window, w),
-         prop = Fget_char_property (make_number (charpos),
+         prop = Fget_char_property (make_fixnum (charpos),
                                     Qinvisible, window),
          TEXT_PROP_MEANS_INVISIBLE (prop) == 0))
     {
-      prop = Fget_char_property (make_number (charpos - 1), Qinvisible,
+      prop = Fget_char_property (make_fixnum (charpos - 1), Qinvisible,
                                 window);
       ellipses_p = 2 == TEXT_PROP_MEANS_INVISIBLE (prop);
     }
@@ -3577,12 +3577,12 @@ compute_stop_pos (struct it *it)
       /* Set up variables for computing the stop position from text
          property changes.  */
       XSETBUFFER (object, current_buffer);
-      limit = make_number (IT_CHARPOS (*it) + TEXT_PROP_DISTANCE_LIMIT);
+      limit = make_fixnum (IT_CHARPOS (*it) + TEXT_PROP_DISTANCE_LIMIT);
     }
 
   /* Get the interval containing IT's position.  Value is a null
      interval if there isn't such an interval.  */
-  position = make_number (charpos);
+  position = make_fixnum (charpos);
   iv = validate_interval_range (object, &position, &position, false);
   if (iv)
     {
@@ -3599,7 +3599,7 @@ compute_stop_pos (struct it *it)
       for (next_iv = next_interval (iv);
           (next_iv
            && (NILP (limit)
-               || XFASTINT (limit) > next_iv->position));
+               || XFIXNAT (limit) > next_iv->position));
           next_iv = next_interval (next_iv))
        {
          for (p = it_props; p->handler; ++p)
@@ -3616,10 +3616,10 @@ compute_stop_pos (struct it *it)
 
       if (next_iv)
        {
-         if (INTEGERP (limit)
-             && next_iv->position >= XFASTINT (limit))
+         if (FIXNUMP (limit)
+             && next_iv->position >= XFIXNAT (limit))
            /* No text property change up to limit.  */
-           it->stop_charpos = min (XFASTINT (limit), it->stop_charpos);
+           it->stop_charpos = min (XFIXNAT (limit), it->stop_charpos);
          else
            /* Text properties change in next_iv.  */
            it->stop_charpos = min (it->stop_charpos, next_iv->position);
@@ -3734,7 +3734,7 @@ compute_display_string_pos (struct text_pos *position,
 
   /* If the character at CHARPOS is where the display string begins,
      return CHARPOS.  */
-  pos = make_number (charpos);
+  pos = make_fixnum (charpos);
   if (STRINGP (object))
     bufpos = string->bufpos;
   else
@@ -3742,7 +3742,7 @@ compute_display_string_pos (struct text_pos *position,
   tpos = *position;
   if (!NILP (spec = Fget_char_property (pos, Qdisplay, object))
       && (charpos <= begb
-         || !EQ (Fget_char_property (make_number (charpos - 1), Qdisplay,
+         || !EQ (Fget_char_property (make_fixnum (charpos - 1), Qdisplay,
                                      object),
                  spec))
       && (rv = handle_display_spec (NULL, spec, object, Qnil, &tpos, bufpos,
@@ -3755,10 +3755,10 @@ compute_display_string_pos (struct text_pos *position,
 
   /* Look forward for the first character with a `display' property
      that will replace the underlying text when displayed.  */
-  limpos = make_number (lim);
+  limpos = make_fixnum (lim);
   do {
     pos = Fnext_single_char_property_change (pos, Qdisplay, object1, limpos);
-    CHARPOS (tpos) = XFASTINT (pos);
+    CHARPOS (tpos) = XFIXNAT (pos);
     if (CHARPOS (tpos) >= lim)
       {
        *disp_prop = 0;
@@ -3791,7 +3791,7 @@ compute_display_string_end (ptrdiff_t charpos, struct 
bidi_string_data *string)
   /* OBJECT = nil means current buffer.  */
   Lisp_Object object =
     (string && STRINGP (string->lstring)) ? string->lstring : Qnil;
-  Lisp_Object pos = make_number (charpos);
+  Lisp_Object pos = make_fixnum (charpos);
   ptrdiff_t eob =
     (STRINGP (object) || (string && string->s)) ? string->schars : ZV;
 
@@ -3819,7 +3819,7 @@ compute_display_string_end (ptrdiff_t charpos, struct 
bidi_string_data *string)
      changes.  */
   pos = Fnext_single_char_property_change (pos, Qdisplay, object, Qnil);
 
-  return XFASTINT (pos);
+  return XFIXNAT (pos);
 }
 
 
@@ -3849,7 +3849,7 @@ handle_fontified_prop (struct it *it)
       && it->s == NULL
       && !NILP (Vfontification_functions)
       && !NILP (Vrun_hooks)
-      && (pos = make_number (IT_CHARPOS (*it)),
+      && (pos = make_fixnum (IT_CHARPOS (*it)),
          prop = Fget_char_property (pos, Qfontified, Qnil),
          /* Ignore the special cased nil value always present at EOB since
             no amount of fontifying will be able to change it.  */
@@ -4349,7 +4349,7 @@ handle_invisible_prop (struct it *it)
       /* Get the value of the invisible text property at the
         current position.  Value will be nil if there is no such
         property.  */
-      end_charpos = make_number (IT_STRING_CHARPOS (*it));
+      end_charpos = make_fixnum (IT_STRING_CHARPOS (*it));
       prop = Fget_text_property (end_charpos, Qinvisible, it->string);
       invis = TEXT_PROP_MEANS_INVISIBLE (prop);
 
@@ -4373,10 +4373,10 @@ handle_invisible_prop (struct it *it)
                                                it->string, limit);
              /* Since LIMIT is always an integer, so should be the
                 value returned by Fnext_single_property_change.  */
-             eassert (INTEGERP (end_charpos));
-             if (INTEGERP (end_charpos))
+             eassert (FIXNUMP (end_charpos));
+             if (FIXNUMP (end_charpos))
                {
-                 endpos = XFASTINT (end_charpos);
+                 endpos = XFIXNAT (end_charpos);
                  prop = Fget_text_property (end_charpos, Qinvisible, 
it->string);
                  invis = TEXT_PROP_MEANS_INVISIBLE (prop);
                  if (invis == 2)
@@ -4452,7 +4452,7 @@ handle_invisible_prop (struct it *it)
 
       /* First of all, is there invisible text at this position?  */
       tem = start_charpos = IT_CHARPOS (*it);
-      pos = make_number (tem);
+      pos = make_fixnum (tem);
       prop = get_char_property_and_overlay (pos, Qinvisible, it->window,
                                            &overlay);
       invis = TEXT_PROP_MEANS_INVISIBLE (prop);
@@ -4490,7 +4490,7 @@ handle_invisible_prop (struct it *it)
                     the char before the given position, i.e. if we
                     get invis = 0, this means that the char at
                     newpos is visible.  */
-                 pos = make_number (newpos);
+                 pos = make_fixnum (newpos);
                  prop = Fget_char_property (pos, Qinvisible, it->window);
                  invis = TEXT_PROP_MEANS_INVISIBLE (prop);
                }
@@ -4745,7 +4745,7 @@ handle_display_prop (struct it *it)
   if (!it->string_from_display_prop_p)
     it->area = TEXT_AREA;
 
-  propval = get_char_property_and_overlay (make_number (position->charpos),
+  propval = get_char_property_and_overlay (make_fixnum (position->charpos),
                                           Qdisplay, object, &overlay);
   if (NILP (propval))
     return HANDLED_NORMALLY;
@@ -4861,13 +4861,13 @@ display_prop_end (struct it *it, Lisp_Object object, 
struct text_pos start_pos)
   Lisp_Object end;
   struct text_pos end_pos;
 
-  end = Fnext_single_char_property_change (make_number (CHARPOS (start_pos)),
+  end = Fnext_single_char_property_change (make_fixnum (CHARPOS (start_pos)),
                                           Qdisplay, object, Qnil);
-  CHARPOS (end_pos) = XFASTINT (end);
+  CHARPOS (end_pos) = XFIXNAT (end);
   if (STRINGP (object))
     compute_string_pos (&end_pos, start_pos, it->string);
   else
-    BYTEPOS (end_pos) = CHAR_TO_BYTE (XFASTINT (end));
+    BYTEPOS (end_pos) = CHAR_TO_BYTE (XFIXNAT (end));
 
   return end_pos;
 }
@@ -4934,8 +4934,8 @@ handle_single_display_spec (struct it *it, Lisp_Object 
spec, Lisp_Object object,
       if (NILP (object))
        XSETBUFFER (object, current_buffer);
       specbind (Qobject, object);
-      specbind (Qposition, make_number (CHARPOS (*position)));
-      specbind (Qbuffer_position, make_number (bufpos));
+      specbind (Qposition, make_fixnum (CHARPOS (*position)));
+      specbind (Qbuffer_position, make_fixnum (bufpos));
       form = safe_eval (form);
       form = unbind_to (count, form);
     }
@@ -4962,10 +4962,10 @@ handle_single_display_spec (struct it *it, Lisp_Object 
spec, Lisp_Object object,
                  && (EQ (XCAR (it->font_height), Qplus)
                      || EQ (XCAR (it->font_height), Qminus))
                  && CONSP (XCDR (it->font_height))
-                 && RANGED_INTEGERP (0, XCAR (XCDR (it->font_height)), 
INT_MAX))
+                 && RANGED_FIXNUMP (0, XCAR (XCDR (it->font_height)), INT_MAX))
                {
                  /* `(+ N)' or `(- N)' where N is an integer.  */
-                 int steps = XINT (XCAR (XCDR (it->font_height)));
+                 int steps = XFIXNUM (XCAR (XCDR (it->font_height)));
                  if (EQ (XCAR (it->font_height), Qplus))
                    steps = - steps;
                  it->face_id = smaller_face (it->f, it->face_id, steps);
@@ -4978,10 +4978,10 @@ handle_single_display_spec (struct it *it, Lisp_Object 
spec, Lisp_Object object,
                  Lisp_Object height;
                  height = safe_call1 (it->font_height,
                                       face->lface[LFACE_HEIGHT_INDEX]);
-                 if (NUMBERP (height))
+                 if (FIXED_OR_FLOATP (height))
                    new_height = XFLOATINT (height);
                }
-             else if (NUMBERP (it->font_height))
+             else if (FIXED_OR_FLOATP (it->font_height))
                {
                  /* Value is a multiple of the canonical char height.  */
                  struct face *f;
@@ -4989,7 +4989,7 @@ handle_single_display_spec (struct it *it, Lisp_Object 
spec, Lisp_Object object,
                  f = FACE_FROM_ID (it->f,
                                    lookup_basic_face (it->w, it->f, 
DEFAULT_FACE_ID));
                  new_height = (XFLOATINT (it->font_height)
-                               * XINT (f->lface[LFACE_HEIGHT_INDEX]));
+                               * XFIXNUM (f->lface[LFACE_HEIGHT_INDEX]));
                }
              else if (enable_eval_p)
                {
@@ -5002,7 +5002,7 @@ handle_single_display_spec (struct it *it, Lisp_Object 
spec, Lisp_Object object,
                  value = safe_eval (it->font_height);
                  value = unbind_to (count, value);
 
-                 if (NUMBERP (value))
+                 if (FIXED_OR_FLOATP (value))
                    new_height = XFLOATINT (value);
                }
 
@@ -5025,7 +5025,7 @@ handle_single_display_spec (struct it *it, Lisp_Object 
spec, Lisp_Object object,
            return 0;
 
          value = XCAR (XCDR (spec));
-         if (NUMBERP (value) && XFLOATINT (value) > 0)
+         if (FIXED_OR_FLOATP (value) && XFLOATINT (value) > 0)
            it->space_width = value;
        }
 
@@ -5074,7 +5074,7 @@ handle_single_display_spec (struct it *it, Lisp_Object 
spec, Lisp_Object object,
 
 #ifdef HAVE_WINDOW_SYSTEM
          value = XCAR (XCDR (spec));
-         if (NUMBERP (value))
+         if (FIXED_OR_FLOATP (value))
            {
              struct face *face = FACE_FROM_ID (it->f, it->face_id);
              it->voffset = - (XFLOATINT (value)
@@ -5488,11 +5488,11 @@ string_buffer_position_lim (Lisp_Object string,
   Lisp_Object limit, prop, pos;
   bool found = false;
 
-  pos = make_number (max (from, BEGV));
+  pos = make_fixnum (max (from, BEGV));
 
   if (!back_p) /* looking forward */
     {
-      limit = make_number (min (to, ZV));
+      limit = make_fixnum (min (to, ZV));
       while (!found && !EQ (pos, limit))
        {
          prop = Fget_char_property (pos, Qdisplay, Qnil);
@@ -5505,7 +5505,7 @@ string_buffer_position_lim (Lisp_Object string,
     }
   else         /* looking back */
     {
-      limit = make_number (max (to, BEGV));
+      limit = make_fixnum (max (to, BEGV));
       while (!found && !EQ (pos, limit))
        {
          prop = Fget_char_property (pos, Qdisplay, Qnil);
@@ -5517,7 +5517,7 @@ string_buffer_position_lim (Lisp_Object string,
        }
     }
 
-  return found ? XINT (pos) : 0;
+  return found ? XFIXNUM (pos) : 0;
 }
 
 /* Determine which buffer position in current buffer STRING comes from.
@@ -5819,11 +5819,7 @@ compare_overlay_entries (const void *e1, const void *e2)
 static void
 load_overlay_strings (struct it *it, ptrdiff_t charpos)
 {
-  Lisp_Object overlay, window, str, invisible;
-  struct Lisp_Overlay *ov;
-  ptrdiff_t start, end;
-  ptrdiff_t n = 0, i, j;
-  int invis;
+  ptrdiff_t n = 0;
   struct overlay_entry entriesbuf[20];
   ptrdiff_t size = ARRAYELTS (entriesbuf);
   struct overlay_entry *entries = entriesbuf;
@@ -5852,19 +5848,20 @@ load_overlay_strings (struct it *it, ptrdiff_t charpos)
       entries[n].string = (STRING);                                    \
       entries[n].overlay = (OVERLAY);                                  \
       priority = Foverlay_get ((OVERLAY), Qpriority);                  \
-      entries[n].priority = INTEGERP (priority) ? XINT (priority) : 0;  \
+      entries[n].priority = FIXNUMP (priority) ? XFIXNUM (priority) : 0;  \
       entries[n].after_string_p = (AFTER_P);                           \
       ++n;                                                             \
     }                                                                  \
   while (false)
 
   /* Process overlay before the overlay center.  */
-  for (ov = current_buffer->overlays_before; ov; ov = ov->next)
+  for (struct Lisp_Overlay *ov = current_buffer->overlays_before;
+       ov; ov = ov->next)
     {
-      XSETMISC (overlay, ov);
+      Lisp_Object overlay = make_lisp_ptr (ov, Lisp_Vectorlike);
       eassert (OVERLAYP (overlay));
-      start = OVERLAY_POSITION (OVERLAY_START (overlay));
-      end = OVERLAY_POSITION (OVERLAY_END (overlay));
+      ptrdiff_t start = OVERLAY_POSITION (OVERLAY_START (overlay));
+      ptrdiff_t end = OVERLAY_POSITION (OVERLAY_END (overlay));
 
       if (end < charpos)
        break;
@@ -5875,17 +5872,18 @@ load_overlay_strings (struct it *it, ptrdiff_t charpos)
        continue;
 
       /* Skip this overlay if it doesn't apply to IT->w.  */
-      window = Foverlay_get (overlay, Qwindow);
+      Lisp_Object window = Foverlay_get (overlay, Qwindow);
       if (WINDOWP (window) && XWINDOW (window) != it->w)
        continue;
 
       /* If the text ``under'' the overlay is invisible, both before-
         and after-strings from this overlay are visible; start and
         end position are indistinguishable.  */
-      invisible = Foverlay_get (overlay, Qinvisible);
-      invis = TEXT_PROP_MEANS_INVISIBLE (invisible);
+      Lisp_Object invisible = Foverlay_get (overlay, Qinvisible);
+      int invis = TEXT_PROP_MEANS_INVISIBLE (invisible);
 
       /* If overlay has a non-empty before-string, record it.  */
+      Lisp_Object str;
       if ((start == charpos || (end == charpos && invis != 0))
          && (str = Foverlay_get (overlay, Qbefore_string), STRINGP (str))
          && SCHARS (str))
@@ -5899,12 +5897,13 @@ load_overlay_strings (struct it *it, ptrdiff_t charpos)
     }
 
   /* Process overlays after the overlay center.  */
-  for (ov = current_buffer->overlays_after; ov; ov = ov->next)
+  for (struct Lisp_Overlay *ov = current_buffer->overlays_after;
+       ov; ov = ov->next)
     {
-      XSETMISC (overlay, ov);
+      Lisp_Object overlay = make_lisp_ptr (ov, Lisp_Vectorlike);
       eassert (OVERLAYP (overlay));
-      start = OVERLAY_POSITION (OVERLAY_START (overlay));
-      end = OVERLAY_POSITION (OVERLAY_END (overlay));
+      ptrdiff_t start = OVERLAY_POSITION (OVERLAY_START (overlay));
+      ptrdiff_t end = OVERLAY_POSITION (OVERLAY_END (overlay));
 
       if (start > charpos)
        break;
@@ -5915,16 +5914,17 @@ load_overlay_strings (struct it *it, ptrdiff_t charpos)
        continue;
 
       /* Skip this overlay if it doesn't apply to IT->w.  */
-      window = Foverlay_get (overlay, Qwindow);
+      Lisp_Object window = Foverlay_get (overlay, Qwindow);
       if (WINDOWP (window) && XWINDOW (window) != it->w)
        continue;
 
       /* If the text ``under'' the overlay is invisible, it has a zero
         dimension, and both before- and after-strings apply.  */
-      invisible = Foverlay_get (overlay, Qinvisible);
-      invis = TEXT_PROP_MEANS_INVISIBLE (invisible);
+      Lisp_Object invisible = Foverlay_get (overlay, Qinvisible);
+      int invis = TEXT_PROP_MEANS_INVISIBLE (invisible);
 
       /* If overlay has a non-empty before-string, record it.  */
+      Lisp_Object str;
       if ((start == charpos || (end == charpos && invis != 0))
          && (str = Foverlay_get (overlay, Qbefore_string), STRINGP (str))
          && SCHARS (str))
@@ -5950,12 +5950,11 @@ load_overlay_strings (struct it *it, ptrdiff_t charpos)
   /* IT->current.overlay_string_index is the number of overlay strings
      that have already been consumed by IT.  Copy some of the
      remaining overlay strings to IT->overlay_strings.  */
-  i = 0;
-  j = it->current.overlay_string_index;
-  while (i < OVERLAY_STRING_CHUNK_SIZE && j < n)
+  ptrdiff_t j = it->current.overlay_string_index;
+  for (ptrdiff_t i = 0; i < OVERLAY_STRING_CHUNK_SIZE && j < n; i++, j++)
     {
       it->overlay_strings[i] = entries[j].string;
-      it->string_overlays[i++] = entries[j++].overlay;
+      it->string_overlays[i] = entries[j].overlay;
     }
 
   CHECK_IT (it);
@@ -6385,9 +6384,9 @@ forward_to_next_line_start (struct it *it, bool 
*skipped_p,
         overlays, we can just use the position of the newline in
         buffer text.  */
       if (it->stop_charpos >= limit
-         || ((pos = Fnext_single_property_change (make_number (start),
+         || ((pos = Fnext_single_property_change (make_fixnum (start),
                                                   Qdisplay, Qnil,
-                                                  make_number (limit)),
+                                                  make_fixnum (limit)),
               NILP (pos))
              && next_overlay_change (start) == ZV))
        {
@@ -6463,7 +6462,7 @@ back_to_previous_visible_line_start (struct it *it)
       /* Check the newline before point for invisibility.  */
       {
        Lisp_Object prop;
-       prop = Fget_char_property (make_number (IT_CHARPOS (*it) - 1),
+       prop = Fget_char_property (make_fixnum (IT_CHARPOS (*it) - 1),
                                   Qinvisible, it->window);
        if (TEXT_PROP_MEANS_INVISIBLE (prop) != 0)
          continue;
@@ -6496,7 +6495,7 @@ back_to_previous_visible_line_start (struct it *it)
        it2.from_disp_prop_p = false;
        if (handle_display_prop (&it2) == HANDLED_RETURN
            && !NILP (val = get_char_property_and_overlay
-                     (make_number (pos), Qdisplay, Qnil, &overlay))
+                     (make_fixnum (pos), Qdisplay, Qnil, &overlay))
            && (OVERLAYP (overlay)
                ? (beg = OVERLAY_POSITION (OVERLAY_START (overlay)))
                : get_property_and_range (pos, Qdisplay, &val, &beg, &end, 
Qnil)))
@@ -8188,7 +8187,7 @@ next_element_from_c_string (struct it *it)
   eassert (!it->bidi_p || it->s == it->bidi_it.string.s);
   it->what = IT_CHARACTER;
   BYTEPOS (it->position) = CHARPOS (it->position) = 0;
-  it->object = make_number (0);
+  it->object = make_fixnum (0);
 
   /* With bidi reordering, the character to display might not be the
      character at IT_CHARPOS.  BIDI_IT.FIRST_ELT means that
@@ -8570,7 +8569,7 @@ run_redisplay_end_trigger_hook (struct it *it)
      them again, even if they get an error.  */
   wset_redisplay_end_trigger (it->w, Qnil);
   CALLN (Frun_hook_with_args, Qredisplay_end_trigger_functions, it->window,
-        make_number (charpos));
+        make_fixnum (charpos));
 
   /* Notice if it changed the face of the character we are on.  */
   handle_face_prop (it);
@@ -10143,8 +10142,8 @@ include the height of both, if present, in the return 
value.  */)
     }
   else
     {
-      CHECK_NUMBER_COERCE_MARKER (from);
-      start = min (max (XINT (from), BEGV), ZV);
+      CHECK_FIXNUM_COERCE_MARKER (from);
+      start = min (max (XFIXNUM (from), BEGV), ZV);
     }
 
   if (NILP (to))
@@ -10160,17 +10159,17 @@ include the height of both, if present, in the return 
value.  */)
     }
   else
     {
-      CHECK_NUMBER_COERCE_MARKER (to);
-      end = max (start, min (XINT (to), ZV));
+      CHECK_FIXNUM_COERCE_MARKER (to);
+      end = max (start, min (XFIXNUM (to), ZV));
     }
 
-  if (!NILP (x_limit) && RANGED_INTEGERP (0, x_limit, INT_MAX))
-    max_x = XINT (x_limit);
+  if (!NILP (x_limit) && RANGED_FIXNUMP (0, x_limit, INT_MAX))
+    max_x = XFIXNUM (x_limit);
 
   if (NILP (y_limit))
     max_y = INT_MAX;
-  else if (RANGED_INTEGERP (0, y_limit, INT_MAX))
-    max_y = XINT (y_limit);
+  else if (RANGED_FIXNUMP (0, y_limit, INT_MAX))
+    max_y = XFIXNUM (y_limit);
 
   itdata = bidi_shelve_cache ();
   SET_TEXT_POS (startp, start, CHAR_TO_BYTE (start));
@@ -10250,7 +10249,7 @@ include the height of both, if present, in the return 
value.  */)
   if (old_b)
     set_buffer_internal (old_b);
 
-  return Fcons (make_number (x), make_number (y));
+  return Fcons (make_fixnum (x), make_fixnum (y));
 }
 
 /***********************************************************************
@@ -10457,10 +10456,10 @@ message_dolog (const char *m, ptrdiff_t nbytes, bool 
nlflag, bool multibyte)
             in the *Messages* buffer now, delete the oldest ones.
             This is safe because we don't have undo in this buffer.  */
 
-         if (NATNUMP (Vmessage_log_max))
+         if (FIXNATP (Vmessage_log_max))
            {
              scan_newline (Z, Z_BYTE, BEG, BEG_BYTE,
-                           -XFASTINT (Vmessage_log_max) - 1, false);
+                           -XFIXNAT (Vmessage_log_max) - 1, false);
              del_range_both (BEG, BEG_BYTE, PT, PT_BYTE, false);
            }
        }
@@ -10963,22 +10962,22 @@ with_echo_area_buffer_unwind_data (struct window *w)
   Vwith_echo_area_save_vector = Qnil;
 
   if (NILP (vector))
-    vector = Fmake_vector (make_number (11), Qnil);
+    vector = Fmake_vector (make_fixnum (11), Qnil);
 
   XSETBUFFER (tmp, current_buffer); ASET (vector, i, tmp); ++i;
   ASET (vector, i, Vdeactivate_mark); ++i;
-  ASET (vector, i, make_number (windows_or_buffers_changed)); ++i;
+  ASET (vector, i, make_fixnum (windows_or_buffers_changed)); ++i;
 
   if (w)
     {
       XSETWINDOW (tmp, w); ASET (vector, i, tmp); ++i;
       ASET (vector, i, w->contents); ++i;
-      ASET (vector, i, make_number (marker_position (w->pointm))); ++i;
-      ASET (vector, i, make_number (marker_byte_position (w->pointm))); ++i;
-      ASET (vector, i, make_number (marker_position (w->old_pointm))); ++i;
-      ASET (vector, i, make_number (marker_byte_position (w->old_pointm))); 
++i;
-      ASET (vector, i, make_number (marker_position (w->start))); ++i;
-      ASET (vector, i, make_number (marker_byte_position (w->start))); ++i;
+      ASET (vector, i, make_fixnum (marker_position (w->pointm))); ++i;
+      ASET (vector, i, make_fixnum (marker_byte_position (w->pointm))); ++i;
+      ASET (vector, i, make_fixnum (marker_position (w->old_pointm))); ++i;
+      ASET (vector, i, make_fixnum (marker_byte_position (w->old_pointm))); 
++i;
+      ASET (vector, i, make_fixnum (marker_position (w->start))); ++i;
+      ASET (vector, i, make_fixnum (marker_byte_position (w->start))); ++i;
     }
   else
     {
@@ -11000,7 +10999,7 @@ unwind_with_echo_area_buffer (Lisp_Object vector)
 {
   set_buffer_internal_1 (XBUFFER (AREF (vector, 0)));
   Vdeactivate_mark = AREF (vector, 1);
-  windows_or_buffers_changed = XFASTINT (AREF (vector, 2));
+  windows_or_buffers_changed = XFIXNAT (AREF (vector, 2));
 
   if (WINDOWP (AREF (vector, 3)))
     {
@@ -11012,14 +11011,14 @@ unwind_with_echo_area_buffer (Lisp_Object vector)
 
       wset_buffer (w, buffer);
       set_marker_both (w->pointm, buffer,
-                      XFASTINT (AREF (vector, 5)),
-                      XFASTINT (AREF (vector, 6)));
+                      XFIXNAT (AREF (vector, 5)),
+                      XFIXNAT (AREF (vector, 6)));
       set_marker_both (w->old_pointm, buffer,
-                      XFASTINT (AREF (vector, 7)),
-                      XFASTINT (AREF (vector, 8)));
+                      XFIXNAT (AREF (vector, 7)),
+                      XFIXNAT (AREF (vector, 8)));
       set_marker_both (w->start, buffer,
-                      XFASTINT (AREF (vector, 9)),
-                      XFASTINT (AREF (vector, 10)));
+                      XFIXNAT (AREF (vector, 9)),
+                      XFIXNAT (AREF (vector, 10)));
     }
 
   Vwith_echo_area_save_vector = vector;
@@ -11148,7 +11147,7 @@ display_echo_area (struct window *w)
 
 /* Helper for display_echo_area.  Display the current buffer which
    contains the current echo area message in window W, a mini-window,
-   a pointer to which is passed in A1.  A2..A4 are currently not used.
+   a pointer to which is passed in A1.  A2 is currently not used.
    Change the height of W so that all of the message is displayed.
    Value is true if height of W was changed.  */
 
@@ -11209,8 +11208,8 @@ resize_echo_area_exactly (void)
 /* Callback function for with_echo_area_buffer, when used from
    resize_echo_area_exactly.  A1 contains a pointer to the window to
    resize, EXACTLY non-nil means resize the mini-window exactly to the
-   size of the text displayed.  A3 and A4 are not used.  Value is what
-   resize_mini_window returns.  */
+   size of the text displayed.  Value is what resize_mini_window
+   returns.  */
 
 static bool
 resize_mini_window_1 (ptrdiff_t a1, Lisp_Object exactly)
@@ -11279,8 +11278,8 @@ resize_mini_window (struct window *w, bool exact_p)
       /* Compute the max. number of lines specified by the user.  */
       if (FLOATP (Vmax_mini_window_height))
        max_height = XFLOAT_DATA (Vmax_mini_window_height) * total_height;
-      else if (INTEGERP (Vmax_mini_window_height))
-       max_height = XINT (Vmax_mini_window_height) * unit;
+      else if (FIXNUMP (Vmax_mini_window_height))
+       max_height = XFIXNUM (Vmax_mini_window_height) * unit;
       else
        max_height = total_height / 4;
 
@@ -11836,10 +11835,10 @@ format_mode_line_unwind_data (struct frame 
*target_frame,
   Vmode_line_unwind_vector = Qnil;
 
   if (NILP (vector))
-    vector = Fmake_vector (make_number (10), Qnil);
+    vector = Fmake_vector (make_fixnum (10), Qnil);
 
-  ASET (vector, 0, make_number (mode_line_target));
-  ASET (vector, 1, make_number (MODE_LINE_NOPROP_LEN (0)));
+  ASET (vector, 0, make_fixnum (mode_line_target));
+  ASET (vector, 1, make_fixnum (MODE_LINE_NOPROP_LEN (0)));
   ASET (vector, 2, mode_line_string_list);
   ASET (vector, 3, save_proptrans ? mode_line_proptrans_alist : Qt);
   ASET (vector, 4, mode_line_string_face);
@@ -11871,8 +11870,8 @@ unwind_format_mode_line (Lisp_Object vector)
   Lisp_Object target_frame_window = AREF (vector, 8);
   Lisp_Object old_top_frame = AREF (vector, 9);
 
-  mode_line_target = XINT (AREF (vector, 0));
-  mode_line_noprop_ptr = mode_line_noprop_buf + XINT (AREF (vector, 1));
+  mode_line_target = XFIXNUM (AREF (vector, 0));
+  mode_line_noprop_ptr = mode_line_noprop_buf + XFIXNUM (AREF (vector, 1));
   mode_line_string_list = AREF (vector, 2);
   if (! EQ (AREF (vector, 3), Qt))
     mode_line_proptrans_alist = AREF (vector, 3);
@@ -12432,11 +12431,11 @@ build_desired_tool_bar_string (struct frame *f)
   /* Reuse f->desired_tool_bar_string, if possible.  */
   if (size < size_needed || NILP (f->desired_tool_bar_string))
     fset_desired_tool_bar_string
-      (f, Fmake_string (make_number (size_needed), make_number (' '), Qnil));
+      (f, Fmake_string (make_fixnum (size_needed), make_fixnum (' '), Qnil));
   else
     {
       AUTO_LIST4 (props, Qdisplay, Qnil, Qmenu_item, Qnil);
-      Fremove_text_properties (make_number (0), make_number (size),
+      Fremove_text_properties (make_fixnum (0), make_fixnum (size),
                               props, f->desired_tool_bar_string);
     }
 
@@ -12485,21 +12484,21 @@ build_desired_tool_bar_string (struct frame *f)
                : DEFAULT_TOOL_BAR_BUTTON_RELIEF);
       hmargin = vmargin = relief;
 
-      if (RANGED_INTEGERP (1, Vtool_bar_button_margin,
+      if (RANGED_FIXNUMP (1, Vtool_bar_button_margin,
                           INT_MAX - max (hmargin, vmargin)))
        {
-         hmargin += XFASTINT (Vtool_bar_button_margin);
-         vmargin += XFASTINT (Vtool_bar_button_margin);
+         hmargin += XFIXNAT (Vtool_bar_button_margin);
+         vmargin += XFIXNAT (Vtool_bar_button_margin);
        }
       else if (CONSP (Vtool_bar_button_margin))
        {
-         if (RANGED_INTEGERP (1, XCAR (Vtool_bar_button_margin),
+         if (RANGED_FIXNUMP (1, XCAR (Vtool_bar_button_margin),
                               INT_MAX - hmargin))
-           hmargin += XFASTINT (XCAR (Vtool_bar_button_margin));
+           hmargin += XFIXNAT (XCAR (Vtool_bar_button_margin));
 
-         if (RANGED_INTEGERP (1, XCDR (Vtool_bar_button_margin),
+         if (RANGED_FIXNUMP (1, XCDR (Vtool_bar_button_margin),
                               INT_MAX - vmargin))
-           vmargin += XFASTINT (XCDR (Vtool_bar_button_margin));
+           vmargin += XFIXNAT (XCDR (Vtool_bar_button_margin));
        }
 
       if (auto_raise_tool_bar_buttons_p)
@@ -12508,7 +12507,7 @@ build_desired_tool_bar_string (struct frame *f)
             selected.  */
          if (selected_p)
            {
-             plist = Fplist_put (plist, QCrelief, make_number (-relief));
+             plist = Fplist_put (plist, QCrelief, make_fixnum (-relief));
              hmargin -= relief;
              vmargin -= relief;
            }
@@ -12520,8 +12519,8 @@ build_desired_tool_bar_string (struct frame *f)
             raised relief.  */
          plist = Fplist_put (plist, QCrelief,
                              (selected_p
-                              ? make_number (-relief)
-                              : make_number (relief)));
+                              ? make_fixnum (-relief)
+                              : make_fixnum (relief)));
          hmargin -= relief;
          vmargin -= relief;
        }
@@ -12530,11 +12529,11 @@ build_desired_tool_bar_string (struct frame *f)
       if (hmargin || vmargin)
        {
          if (hmargin == vmargin)
-           plist = Fplist_put (plist, QCmargin, make_number (hmargin));
+           plist = Fplist_put (plist, QCmargin, make_fixnum (hmargin));
          else
            plist = Fplist_put (plist, QCmargin,
-                               Fcons (make_number (hmargin),
-                                      make_number (vmargin)));
+                               Fcons (make_fixnum (hmargin),
+                                      make_fixnum (vmargin)));
        }
 
       /* If button is not enabled, and we don't have special images
@@ -12549,7 +12548,7 @@ build_desired_tool_bar_string (struct frame *f)
         vector.  */
       image = Fcons (Qimage, plist);
       AUTO_LIST4 (props, Qdisplay, image, Qmenu_item,
-                 make_number (i * TOOL_BAR_ITEM_NSLOTS));
+                 make_fixnum (i * TOOL_BAR_ITEM_NSLOTS));
 
       /* Let the last image hide all remaining spaces in the tool bar
          string.  The string can be longer than needed when we reuse a
@@ -12558,7 +12557,7 @@ build_desired_tool_bar_string (struct frame *f)
        end = SCHARS (f->desired_tool_bar_string);
       else
        end = i + 1;
-      Fadd_text_properties (make_number (i), make_number (end),
+      Fadd_text_properties (make_fixnum (i), make_fixnum (end),
                            props, f->desired_tool_bar_string);
 #undef PROP
     }
@@ -12764,7 +12763,7 @@ PIXELWISE non-nil means return the height of the tool 
bar in pixels.  */)
     }
 #endif
 
-  return make_number (height);
+  return make_fixnum (height);
 }
 
 
@@ -12835,8 +12834,8 @@ redisplay_tool_bar (struct frame *f)
     {
       int border, rows, height, extra;
 
-      if (TYPE_RANGED_INTEGERP (int, Vtool_bar_border))
-       border = XINT (Vtool_bar_border);
+      if (TYPE_RANGED_FIXNUMP (int, Vtool_bar_border))
+       border = XFIXNUM (Vtool_bar_border);
       else if (EQ (Vtool_bar_border, Qinternal_border_width))
        border = FRAME_INTERNAL_BORDER_WIDTH (f);
       else if (EQ (Vtool_bar_border, Qborder_width))
@@ -12954,11 +12953,11 @@ tool_bar_item_info (struct frame *f, struct glyph 
*glyph, int *prop_idx)
   /* Get the text property `menu-item' at pos. The value of that
      property is the start index of this item's properties in
      F->tool_bar_items.  */
-  prop = Fget_text_property (make_number (charpos),
+  prop = Fget_text_property (make_fixnum (charpos),
                             Qmenu_item, f->current_tool_bar_string);
-  if (! INTEGERP (prop))
+  if (! FIXNUMP (prop))
     return false;
-  *prop_idx = XINT (prop);
+  *prop_idx = XFIXNUM (prop);
   return true;
 }
 
@@ -13203,9 +13202,9 @@ hscroll_window_tree (Lisp_Object window)
          hscroll_step_abs = 0;
        }
     }
-  else if (TYPE_RANGED_INTEGERP (int, Vhscroll_step))
+  else if (TYPE_RANGED_FIXNUMP (int, Vhscroll_step))
     {
-      hscroll_step_abs = XINT (Vhscroll_step);
+      hscroll_step_abs = XFIXNUM (Vhscroll_step);
       if (hscroll_step_abs < 0)
        hscroll_step_abs = 0;
     }
@@ -13304,7 +13303,7 @@ hscroll_window_tree (Lisp_Object window)
          /* Remember window point.  */
          Fset_marker (w->old_pointm,
                       ((w == XWINDOW (selected_window))
-                       ? make_number (BUF_PT (XBUFFER (w->contents)))
+                       ? make_fixnum (BUF_PT (XBUFFER (w->contents)))
                        : Fmarker_position (w->pointm)),
                       w->contents);
 
@@ -13561,8 +13560,8 @@ text_outside_line_unchanged_p (struct window *w,
       /* If selective display, can't optimize if changes start at the
         beginning of the line.  */
       if (unchanged_p
-         && INTEGERP (BVAR (current_buffer, selective_display))
-         && XINT (BVAR (current_buffer, selective_display)) > 0
+         && FIXNUMP (BVAR (current_buffer, selective_display))
+         && XFIXNUM (BVAR (current_buffer, selective_display)) > 0
          && (BEG_UNCHANGED < start || GPT <= start))
        unchanged_p = false;
 
@@ -13764,10 +13763,10 @@ overlay_arrow_at_row (struct it *it, struct glyph_row 
*row)
                {
                  int fringe_bitmap = lookup_fringe_bitmap (val);
                  if (fringe_bitmap != 0)
-                   return make_number (fringe_bitmap);
+                   return make_fixnum (fringe_bitmap);
                }
 #endif
-             return make_number (-1); /* Use default arrow bitmap.  */
+             return make_fixnum (-1); /* Use default arrow bitmap.  */
            }
          return overlay_arrow_string_or_property (var);
        }
@@ -14142,9 +14141,9 @@ redisplay_internal (void)
 
 #define AINC(a,i)                                                      \
   {                                                                    \
-    Lisp_Object entry = Fgethash (make_number (i), a, make_number (0));        
\
-    if (INTEGERP (entry))                                              \
-      Fputhash (make_number (i), make_number (1 + XINT (entry)), a);   \
+    Lisp_Object entry = Fgethash (make_fixnum (i), a, make_fixnum (0));        
\
+    if (FIXNUMP (entry))                                               \
+      Fputhash (make_fixnum (i), make_fixnum (1 + XFIXNUM (entry)), a);        
\
   }
 
   AINC (Vredisplay__all_windows_cause, windows_or_buffers_changed);
@@ -15113,7 +15112,7 @@ set_cursor_from_row (struct window *w, struct glyph_row 
*row,
            Lisp_Object chprop;
            ptrdiff_t glyph_pos = glyph->charpos;
 
-           chprop = Fget_char_property (make_number (glyph_pos), Qcursor,
+           chprop = Fget_char_property (make_fixnum (glyph_pos), Qcursor,
                                         glyph->object);
            if (!NILP (chprop))
              {
@@ -15134,9 +15133,9 @@ set_cursor_from_row (struct window *w, struct glyph_row 
*row,
                if (prop_pos >= pos_before)
                  bpos_max = prop_pos;
              }
-           if (INTEGERP (chprop))
+           if (FIXNUMP (chprop))
              {
-               bpos_covered = bpos_max + XINT (chprop);
+               bpos_covered = bpos_max + XFIXNUM (chprop);
                /* If the `cursor' property covers buffer positions up
                   to and including point, we should display cursor on
                   this glyph.  Note that, if a `cursor' property on one
@@ -15197,7 +15196,7 @@ set_cursor_from_row (struct window *w, struct glyph_row 
*row,
            Lisp_Object chprop;
            ptrdiff_t glyph_pos = glyph->charpos;
 
-           chprop = Fget_char_property (make_number (glyph_pos), Qcursor,
+           chprop = Fget_char_property (make_fixnum (glyph_pos), Qcursor,
                                         glyph->object);
            if (!NILP (chprop))
              {
@@ -15208,9 +15207,9 @@ set_cursor_from_row (struct window *w, struct glyph_row 
*row,
                if (prop_pos >= pos_before)
                  bpos_max = prop_pos;
              }
-           if (INTEGERP (chprop))
+           if (FIXNUMP (chprop))
              {
-               bpos_covered = bpos_max + XINT (chprop);
+               bpos_covered = bpos_max + XFIXNUM (chprop);
                /* If the `cursor' property covers buffer positions up
                   to and including point, we should display cursor on
                   this glyph.  */
@@ -15384,7 +15383,7 @@ set_cursor_from_row (struct window *w, struct glyph_row 
*row,
                              Lisp_Object cprop;
                              ptrdiff_t gpos = glyph->charpos;
 
-                             cprop = Fget_char_property (make_number (gpos),
+                             cprop = Fget_char_property (make_fixnum (gpos),
                                                          Qcursor,
                                                          glyph->object);
                              if (!NILP (cprop))
@@ -15515,7 +15514,7 @@ set_cursor_from_row (struct window *w, struct glyph_row 
*row,
              /* Previous candidate is a glyph from a string that has
                 a non-nil `cursor' property.  */
              || (STRINGP (g1->object)
-                 && (!NILP (Fget_char_property (make_number (g1->charpos),
+                 && (!NILP (Fget_char_property (make_fixnum (g1->charpos),
                                                Qcursor, g1->object))
                      /* Previous candidate is from the same display
                         string as this one, and the display string
@@ -15598,7 +15597,7 @@ run_window_scroll_functions (Lisp_Object window, struct 
text_pos startp)
   if (!NILP (Vwindow_scroll_functions))
     {
       run_hook_with_args_2 (Qwindow_scroll_functions, window,
-                           make_number (CHARPOS (startp)));
+                           make_fixnum (CHARPOS (startp)));
       SET_TEXT_POS_FROM_MARKER (startp, w->start);
       /* In case the hook functions switch buffers.  */
       set_buffer_internal (XBUFFER (w->contents));
@@ -15730,8 +15729,8 @@ try_scrolling (Lisp_Object window, bool just_this_one_p,
     scroll_max = (max (scroll_step,
                       max (arg_scroll_conservatively, temp_scroll_step))
                  * frame_line_height);
-  else if (NUMBERP (BVAR (current_buffer, scroll_down_aggressively))
-          || NUMBERP (BVAR (current_buffer, scroll_up_aggressively)))
+  else if (FIXED_OR_FLOATP (BVAR (current_buffer, scroll_down_aggressively))
+          || FIXED_OR_FLOATP (BVAR (current_buffer, scroll_up_aggressively)))
     /* We're trying to scroll because of aggressive scrolling but no
        scroll_step is set.  Choose an arbitrary one.  */
     scroll_max = 10 * frame_line_height;
@@ -15831,7 +15830,7 @@ try_scrolling (Lisp_Object window, bool just_this_one_p,
        {
          aggressive = BVAR (current_buffer, scroll_up_aggressively);
          height = WINDOW_BOX_TEXT_HEIGHT (w);
-         if (NUMBERP (aggressive))
+         if (FIXED_OR_FLOATP (aggressive))
            {
              double float_amount = XFLOATINT (aggressive) * height;
              int aggressive_scroll = float_amount;
@@ -15947,7 +15946,7 @@ try_scrolling (Lisp_Object window, bool just_this_one_p,
            {
              aggressive = BVAR (current_buffer, scroll_down_aggressively);
              height = WINDOW_BOX_TEXT_HEIGHT (w);
-             if (NUMBERP (aggressive))
+             if (FIXED_OR_FLOATP (aggressive))
                {
                  double float_amount = XFLOATINT (aggressive) * height;
                  int aggressive_scroll = float_amount;
@@ -16933,18 +16932,18 @@ redisplay_window (Lisp_Object window, bool 
just_this_one_p)
             position past that.  */
          struct glyph_row *r = NULL;
          Lisp_Object invprop =
-           get_char_property_and_overlay (make_number (PT), Qinvisible,
+           get_char_property_and_overlay (make_fixnum (PT), Qinvisible,
                                           Qnil, NULL);
 
          if (TEXT_PROP_MEANS_INVISIBLE (invprop) != 0)
            {
              ptrdiff_t alt_pt;
              Lisp_Object invprop_end =
-               Fnext_single_char_property_change (make_number (PT), Qinvisible,
+               Fnext_single_char_property_change (make_fixnum (PT), Qinvisible,
                                                   Qnil, Qnil);
 
-             if (NATNUMP (invprop_end))
-               alt_pt = XFASTINT (invprop_end);
+             if (FIXNATP (invprop_end))
+               alt_pt = XFIXNAT (invprop_end);
              else
                alt_pt = ZV;
              r = row_containing_pos (w, alt_pt, w->desired_matrix->rows,
@@ -17224,8 +17223,8 @@ redisplay_window (Lisp_Object window, bool 
just_this_one_p)
   if ((scroll_conservatively
        || emacs_scroll_step
        || temp_scroll_step
-       || NUMBERP (BVAR (current_buffer, scroll_up_aggressively))
-       || NUMBERP (BVAR (current_buffer, scroll_down_aggressively)))
+       || FIXED_OR_FLOATP (BVAR (current_buffer, scroll_up_aggressively))
+       || FIXED_OR_FLOATP (BVAR (current_buffer, scroll_down_aggressively)))
       && CHARPOS (startp) >= BEGV
       && CHARPOS (startp) <= ZV)
     {
@@ -17300,13 +17299,13 @@ redisplay_window (Lisp_Object window, bool 
just_this_one_p)
        : BVAR (current_buffer, scroll_down_aggressively);
 
       if (!MINI_WINDOW_P (w)
-         && (scroll_conservatively > SCROLL_LIMIT || NUMBERP (aggressive)))
+         && (scroll_conservatively > SCROLL_LIMIT || FIXED_OR_FLOATP 
(aggressive)))
        {
          int pt_offset = 0;
 
          /* Setting scroll-conservatively overrides
             scroll-*-aggressively.  */
-         if (!scroll_conservatively && NUMBERP (aggressive))
+         if (!scroll_conservatively && FIXED_OR_FLOATP (aggressive))
            {
              double float_amount = XFLOATINT (aggressive);
 
@@ -17465,18 +17464,18 @@ redisplay_window (Lisp_Object window, bool 
just_this_one_p)
       if (!row)
        {
          Lisp_Object val =
-           get_char_property_and_overlay (make_number (PT), Qinvisible,
+           get_char_property_and_overlay (make_fixnum (PT), Qinvisible,
                                           Qnil, NULL);
 
          if (TEXT_PROP_MEANS_INVISIBLE (val) != 0)
            {
              ptrdiff_t alt_pos;
              Lisp_Object invis_end =
-               Fnext_single_char_property_change (make_number (PT), Qinvisible,
+               Fnext_single_char_property_change (make_fixnum (PT), Qinvisible,
                                                   Qnil, Qnil);
 
-             if (NATNUMP (invis_end))
-               alt_pos = XFASTINT (invis_end);
+             if (FIXNATP (invis_end))
+               alt_pos = XFIXNAT (invis_end);
              else
                alt_pos = ZV;
              row = row_containing_pos (w, alt_pos, matrix->rows, NULL, 0);
@@ -19585,7 +19584,7 @@ with numeric argument, its value is passed as the 
GLYPHS flag.  */)
           w->cursor.x, w->cursor.y, w->cursor.hpos, w->cursor.vpos);
   fprintf (stderr, "=============================================\n");
   dump_glyph_matrix (w->current_matrix,
-                    TYPE_RANGED_INTEGERP (int, glyphs) ? XINT (glyphs) : 0);
+                    TYPE_RANGED_FIXNUMP (int, glyphs) ? XFIXNUM (glyphs) : 0);
   return Qnil;
 }
 
@@ -19629,14 +19628,14 @@ GLYPHS > 1 or omitted means dump glyphs in long form. 
 */)
     }
   else
     {
-      CHECK_NUMBER (row);
-      vpos = XINT (row);
+      CHECK_FIXNUM (row);
+      vpos = XFIXNUM (row);
     }
   matrix = XWINDOW (selected_window)->current_matrix;
   if (vpos >= 0 && vpos < matrix->nrows)
     dump_glyph_row (MATRIX_ROW (matrix, vpos),
                    vpos,
-                   TYPE_RANGED_INTEGERP (int, glyphs) ? XINT (glyphs) : 2);
+                   TYPE_RANGED_FIXNUMP (int, glyphs) ? XFIXNUM (glyphs) : 2);
   return Qnil;
 }
 
@@ -19661,12 +19660,12 @@ do nothing.  */)
     vpos = 0;
   else
     {
-      CHECK_NUMBER (row);
-      vpos = XINT (row);
+      CHECK_FIXNUM (row);
+      vpos = XFIXNUM (row);
     }
   if (vpos >= 0 && vpos < m->nrows)
     dump_glyph_row (MATRIX_ROW (m, vpos), vpos,
-                   TYPE_RANGED_INTEGERP (int, glyphs) ? XINT (glyphs) : 2);
+                   TYPE_RANGED_FIXNUMP (int, glyphs) ? XFIXNUM (glyphs) : 2);
 #endif
   return Qnil;
 }
@@ -19682,7 +19681,7 @@ With ARG, turn tracing on if and only if ARG is 
positive.  */)
   else
     {
       arg = Fprefix_numeric_value (arg);
-      trace_redisplay_p = XINT (arg) > 0;
+      trace_redisplay_p = XFIXNUM (arg) > 0;
     }
 
   return Qnil;
@@ -19748,7 +19747,7 @@ get_overlay_arrow_glyph_row (struct window *w, 
Lisp_Object overlay_arrow_string)
       p += it.len;
 
       /* Get its face.  */
-      ilisp = make_number (p - arrow_string);
+      ilisp = make_fixnum (p - arrow_string);
       face = Fget_text_property (ilisp, Qface, overlay_arrow_string);
       it.face_id = compute_char_face (f, it.char_to_display, face);
 
@@ -20148,8 +20147,8 @@ append_space_for_newline (struct it *it, bool 
default_face_p)
                  it->phys_ascent = it->ascent;
                  it->phys_descent = it->descent;
                  if (!NILP (height)
-                     && XINT (height) > it->ascent + it->descent)
-                   it->ascent = XINT (height) - it->descent;
+                     && XFIXNUM (height) > it->ascent + it->descent)
+                   it->ascent = XFIXNUM (height) - it->descent;
 
                  if (!NILP (total_height))
                    spacing = calc_line_height_property (it, total_height, font,
@@ -20160,9 +20159,9 @@ append_space_for_newline (struct it *it, bool 
default_face_p)
                      spacing = calc_line_height_property (it, spacing, font,
                                                           boff, false);
                    }
-                 if (INTEGERP (spacing))
+                 if (FIXNUMP (spacing))
                    {
-                     extra_line_spacing = XINT (spacing);
+                     extra_line_spacing = XFIXNUM (spacing);
                      if (!NILP (total_height))
                        extra_line_spacing -= (it->phys_ascent + 
it->phys_descent);
                    }
@@ -20598,7 +20597,7 @@ row_for_charpos_p (struct glyph_row *row, ptrdiff_t 
charpos)
                if (STRINGP (glyph->object))
                  {
                    Lisp_Object prop
-                     = Fget_char_property (make_number (charpos),
+                     = Fget_char_property (make_fixnum (charpos),
                                            Qdisplay, Qnil);
                    result =
                      (!NILP (prop)
@@ -20614,7 +20613,7 @@ row_for_charpos_p (struct glyph_row *row, ptrdiff_t 
charpos)
                          {
                            ptrdiff_t gpos = glyph->charpos;
 
-                           if (!NILP (Fget_char_property (make_number (gpos),
+                           if (!NILP (Fget_char_property (make_fixnum (gpos),
                                                           Qcursor, s)))
                              {
                                result = true;
@@ -20753,10 +20752,10 @@ get_it_property (struct it *it, Lisp_Object prop)
   Lisp_Object position, object = it->object;
 
   if (STRINGP (object))
-    position = make_number (IT_STRING_CHARPOS (*it));
+    position = make_fixnum (IT_STRING_CHARPOS (*it));
   else if (BUFFERP (object))
     {
-      position = make_number (IT_CHARPOS (*it));
+      position = make_fixnum (IT_CHARPOS (*it));
       object = it->window;
     }
   else
@@ -21129,8 +21128,8 @@ maybe_produce_line_number (struct it *it)
   /* Compute the required width if needed.  */
   if (!it->lnum_width)
     {
-      if (NATNUMP (Vdisplay_line_numbers_width))
-       it->lnum_width = XFASTINT (Vdisplay_line_numbers_width);
+      if (FIXNATP (Vdisplay_line_numbers_width))
+       it->lnum_width = XFIXNAT (Vdisplay_line_numbers_width);
 
       /* Max line number to be displayed cannot be more than the one
         corresponding to the last row of the desired matrix.  */
@@ -21297,7 +21296,7 @@ should_produce_line_number (struct it *it)
      property, disable line numbers for this row.  This is for
      packages such as company-mode, which need this for their tricky
      layout, where line numbers get in the way.  */
-  Lisp_Object val = Fget_char_property (make_number (IT_CHARPOS (*it)),
+  Lisp_Object val = Fget_char_property (make_fixnum (IT_CHARPOS (*it)),
                                        Qdisplay_line_numbers_disable,
                                        it->window);
   /* For ZV, we need to also look in empty overlays at that point,
@@ -22186,8 +22185,8 @@ display_line (struct it *it, int cursor_vpos)
        }
       else
        {
-         eassert (INTEGERP (overlay_arrow_string));
-         row->overlay_arrow_bitmap = XINT (overlay_arrow_string);
+         eassert (FIXNUMP (overlay_arrow_string));
+         row->overlay_arrow_bitmap = XFIXNUM (overlay_arrow_string);
        }
       overlay_arrow_seen = true;
     }
@@ -22450,8 +22449,8 @@ the `bidi-class' property of a character.  */)
 
       set_buffer_temp (buf);
       validate_region (&from, &to);
-      from_pos = XINT (from);
-      to_pos = XINT (to);
+      from_pos = XFIXNUM (from);
+      to_pos = XFIXNUM (to);
       if (from_pos >= ZV)
        return Qnil;
 
@@ -22493,7 +22492,7 @@ the `bidi-class' property of a character.  */)
   bidi_unshelve_cache (itb_data, false);
   set_buffer_temp (old);
 
-  return (from_pos <= found && found < to_pos) ? make_number (found) : Qnil;
+  return (from_pos <= found && found < to_pos) ? make_fixnum (found) : Qnil;
 }
 
 DEFUN ("move-point-visually", Fmove_point_visually,
@@ -22519,8 +22518,8 @@ Value is the new character position of point.  */)
    && (GLYPH)->charpos >= 0                    \
    && !(GLYPH)->avoid_cursor_p)
 
-  CHECK_NUMBER (direction);
-  dir = XINT (direction);
+  CHECK_FIXNUM (direction);
+  dir = XFIXNUM (direction);
   if (dir > 0)
     dir = 1;
   else
@@ -22553,7 +22552,7 @@ Value is the new character position of point.  */)
            {
              SET_PT (g->charpos);
              w->cursor.vpos = -1;
-             return make_number (PT);
+             return make_fixnum (PT);
            }
          else if (!NILP (g->object) && !EQ (g->object, gpt->object))
            {
@@ -22578,7 +22577,7 @@ Value is the new character position of point.  */)
                break;
              SET_PT (new_pos);
              w->cursor.vpos = -1;
-             return make_number (PT);
+             return make_fixnum (PT);
            }
          else if (ROW_GLYPH_NEWLINE_P (row, g))
            {
@@ -22594,7 +22593,7 @@ Value is the new character position of point.  */)
              else
                break;
              w->cursor.vpos = -1;
-             return make_number (PT);
+             return make_fixnum (PT);
            }
        }
       if (g == e || NILP (g->object))
@@ -22615,7 +22614,7 @@ Value is the new character position of point.  */)
                {
                  SET_PT (MATRIX_ROW_END_CHARPOS (row) - 1);
                  w->cursor.vpos = -1;
-                 return make_number (PT);
+                 return make_fixnum (PT);
                }
              g = row->glyphs[TEXT_AREA];
              e = g + row->used[TEXT_AREA];
@@ -22643,7 +22642,7 @@ Value is the new character position of point.  */)
                      else
                        continue;
                      w->cursor.vpos = -1;
-                     return make_number (PT);
+                     return make_fixnum (PT);
                    }
                }
            }
@@ -22653,7 +22652,7 @@ Value is the new character position of point.  */)
                {
                  SET_PT (MATRIX_ROW_END_CHARPOS (row) - 1);
                  w->cursor.vpos = -1;
-                 return make_number (PT);
+                 return make_fixnum (PT);
                }
              e = row->glyphs[TEXT_AREA];
              g = e + row->used[TEXT_AREA] - 1;
@@ -22681,7 +22680,7 @@ Value is the new character position of point.  */)
                      else
                        continue;
                      w->cursor.vpos = -1;
-                     return make_number (PT);
+                     return make_fixnum (PT);
                    }
                }
            }
@@ -22941,7 +22940,7 @@ Value is the new character position of point.  */)
       SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
     }
 
-  return make_number (PT);
+  return make_fixnum (PT);
 
 #undef ROW_GLYPH_NEWLINE_P
 }
@@ -22990,8 +22989,8 @@ Emacs UBA implementation, in particular with the test 
suite.  */)
     }
   else
     {
-      CHECK_NUMBER_COERCE_MARKER (vpos);
-      nrow = XINT (vpos);
+      CHECK_FIXNUM_COERCE_MARKER (vpos);
+      nrow = XFIXNUM (vpos);
     }
 
   /* We require up-to-date glyph matrix for this window.  */
@@ -23030,7 +23029,7 @@ Emacs UBA implementation, in particular with the test 
suite.  */)
          /* Create and fill the array.  */
          levels = make_uninit_vector (nglyphs);
          for (i = 0; g1 < g; i++, g1++)
-           ASET (levels, i, make_number (g1->resolved_level));
+           ASET (levels, i, make_fixnum (g1->resolved_level));
        }
       else                     /* Right-to-left glyph row.  */
        {
@@ -23045,7 +23044,7 @@ Emacs UBA implementation, in particular with the test 
suite.  */)
            nglyphs++;
          levels = make_uninit_vector (nglyphs);
          for (i = 0; g1 > g; i++, g1--)
-           ASET (levels, i, make_number (g1->resolved_level));
+           ASET (levels, i, make_fixnum (g1->resolved_level));
        }
       return levels;
     }
@@ -23147,7 +23146,7 @@ display_menu_bar (struct window *w)
        break;
 
       /* Remember where item was displayed.  */
-      ASET (items, i + 3, make_number (it.hpos));
+      ASET (items, i + 3, make_fixnum (it.hpos));
 
       /* Display the item, pad with one space.  */
       if (it.current_x < it.last_visible_x)
@@ -23577,7 +23576,7 @@ display_mode_element (struct it *it, int depth, int 
field_width, int precision,
            && (!NILP (props) || risky))
          {
            Lisp_Object oprops, aelt;
-           oprops = Ftext_properties_at (make_number (0), elt);
+           oprops = Ftext_properties_at (make_fixnum (0), elt);
 
            /* If the starting string's properties are not what
               we want, translate the string.  Also, if the string
@@ -23628,7 +23627,7 @@ display_mode_element (struct it *it, int depth, int 
field_width, int precision,
                    internal_condition_case_n (safe_set_text_properties,
                                               4,
                                               ((Lisp_Object [])
-                                              {make_number (0),
+                                              {make_fixnum (0),
                                                   Flength (elt),
                                                   props,
                                                   elt}),
@@ -23639,7 +23638,7 @@ display_mode_element (struct it *it, int depth, int 
field_width, int precision,
                               mode_line_proptrans_alist);
                    /* Truncate mode_line_proptrans_alist
                       to at most 50 elements.  */
-                   tem = Fnthcdr (make_number (50),
+                   tem = Fnthcdr (make_fixnum (50),
                                   mode_line_proptrans_alist);
                    if (! NILP (tem))
                      XSETCDR (tem, Qnil);
@@ -23710,8 +23709,8 @@ display_mode_element (struct it *it, int depth, int 
field_width, int precision,
                                          ? string_byte_to_char (elt, offset)
                                          : charpos + nchars);
                      Lisp_Object mode_string
-                       = Fsubstring (elt, make_number (charpos),
-                                     make_number (endpos));
+                       = Fsubstring (elt, make_fixnum (charpos),
+                                     make_fixnum (endpos));
                      n += store_mode_line_string (NULL, mode_string, false,
                                                   0, 0, Qnil);
                    }
@@ -23774,7 +23773,7 @@ display_mode_element (struct it *it, int depth, int 
field_width, int precision,
                      case MODE_LINE_STRING:
                        {
                          Lisp_Object tem = build_string (spec);
-                         props = Ftext_properties_at (make_number (charpos), 
elt);
+                         props = Ftext_properties_at (make_fixnum (charpos), 
elt);
                          /* Should only keep face property in props */
                          n += store_mode_line_string (NULL, tem, false,
                                                       field, prec, props);
@@ -23931,9 +23930,9 @@ display_mode_element (struct it *it, int depth, int 
field_width, int precision,
            elt = XCAR (elt);
            goto tail_recurse;
          }
-       else if (INTEGERP (car))
+       else if (FIXNUMP (car))
          {
-           register int lim = XINT (car);
+           register int lim = XFIXNUM (car);
            elt = XCDR (elt);
            if (lim < 0)
              {
@@ -24048,23 +24047,23 @@ store_mode_line_string (const char *string, 
Lisp_Object lisp_string,
            face = list2 (face, mode_line_string_face);
          props = Fplist_put (props, Qface, face);
        }
-      Fadd_text_properties (make_number (0), make_number (len),
+      Fadd_text_properties (make_fixnum (0), make_fixnum (len),
                            props, lisp_string);
     }
   else
     {
-      len = XFASTINT (Flength (lisp_string));
+      len = XFIXNAT (Flength (lisp_string));
       if (precision > 0 && len > precision)
        {
          len = precision;
-         lisp_string = Fsubstring (lisp_string, make_number (0), make_number 
(len));
+         lisp_string = Fsubstring (lisp_string, make_fixnum (0), make_fixnum 
(len));
          precision = -1;
        }
       if (!NILP (mode_line_string_face))
        {
          Lisp_Object face;
          if (NILP (props))
-           props = Ftext_properties_at (make_number (0), lisp_string);
+           props = Ftext_properties_at (make_fixnum (0), lisp_string);
          face = Fplist_get (props, Qface);
          if (NILP (face))
            face = mode_line_string_face;
@@ -24075,7 +24074,7 @@ store_mode_line_string (const char *string, Lisp_Object 
lisp_string,
            lisp_string = Fcopy_sequence (lisp_string);
        }
       if (!NILP (props))
-       Fadd_text_properties (make_number (0), make_number (len),
+       Fadd_text_properties (make_fixnum (0), make_fixnum (len),
                              props, lisp_string);
     }
 
@@ -24088,10 +24087,10 @@ store_mode_line_string (const char *string, 
Lisp_Object lisp_string,
   if (field_width > len)
     {
       field_width -= len;
-      lisp_string = Fmake_string (make_number (field_width), make_number (' '),
+      lisp_string = Fmake_string (make_fixnum (field_width), make_fixnum (' '),
                                  Qnil);
       if (!NILP (props))
-       Fadd_text_properties (make_number (0), make_number (field_width),
+       Fadd_text_properties (make_fixnum (0), make_fixnum (field_width),
                              props, lisp_string);
       mode_line_string_list = Fcons (lisp_string, mode_line_string_list);
       n += field_width;
@@ -24128,7 +24127,7 @@ are the selected window and the WINDOW's buffer).  */)
   struct window *w;
   struct buffer *old_buffer = NULL;
   int face_id;
-  bool no_props = INTEGERP (face);
+  bool no_props = FIXNUMP (face);
   ptrdiff_t count = SPECPDL_INDEX ();
   Lisp_Object str;
   int string_start = 0;
@@ -24383,7 +24382,7 @@ decode_mode_spec_coding (Lisp_Object coding_system, 
char *buf, bool eol_flag)
       eolvalue = AREF (val, 2);
 
       *buf++ = multibyte
-       ? XFASTINT (CODING_ATTR_MNEMONIC (attrs))
+       ? XFIXNAT (CODING_ATTR_MNEMONIC (attrs))
        : ' ';
 
       if (eol_flag)
@@ -24412,7 +24411,7 @@ decode_mode_spec_coding (Lisp_Object coding_system, 
char *buf, bool eol_flag)
        }
       else if (CHARACTERP (eoltype))
        {
-         int c = XFASTINT (eoltype);
+         int c = XFIXNAT (eoltype);
          return buf + CHAR_STRING (c, (unsigned char *) buf);
        }
       else
@@ -24618,8 +24617,8 @@ decode_mode_spec (struct window *w, register int c, int 
field_width,
          goto no_value;
 
        /* If the buffer is very big, don't waste time.  */
-       if (INTEGERP (Vline_number_display_limit)
-           && BUF_ZV (b) - BUF_BEGV (b) > XINT (Vline_number_display_limit))
+       if (FIXNUMP (Vline_number_display_limit)
+           && BUF_ZV (b) - BUF_BEGV (b) > XFIXNUM (Vline_number_display_limit))
          {
            w->base_line_pos = 0;
            w->base_line_number = 0;
@@ -24907,7 +24906,7 @@ display_count_lines (ptrdiff_t start_byte,
      check only for newlines.  */
   bool selective_display
     = (!NILP (BVAR (current_buffer, selective_display))
-       && !INTEGERP (BVAR (current_buffer, selective_display)));
+       && !FIXNUMP (BVAR (current_buffer, selective_display)));
 
   if (count > 0)
     {
@@ -25306,13 +25305,13 @@ display may depend on `buffer-invisibility-spec', 
which see.  */)
   (Lisp_Object pos)
 {
   Lisp_Object prop
-    = (NATNUMP (pos) || MARKERP (pos)
+    = (FIXNATP (pos) || MARKERP (pos)
        ? Fget_char_property (pos, Qinvisible, Qnil)
        : pos);
   int invis = TEXT_PROP_MEANS_INVISIBLE (prop);
   return (invis == 0 ? Qnil
          : invis == 1 ? Qt
-         : make_number (invis));
+         : make_fixnum (invis));
 }
 
 /* Calculate a width or height in pixels from a specification using
@@ -25521,7 +25520,7 @@ calc_pixel_width_or_height (double *res, struct it *it, 
Lisp_Object prop,
        prop = Qnil;
     }
 
-  if (NUMBERP (prop))
+  if (FIXED_OR_FLOATP (prop))
     {
       int base_unit = (width_p
                       ? FRAME_COLUMN_WIDTH (it->f)
@@ -25585,7 +25584,7 @@ calc_pixel_width_or_height (double *res, struct it *it, 
Lisp_Object prop,
        }
 
       /* '(NUM)': absolute number of pixels.  */
-      if (NUMBERP (car))
+      if (FIXED_OR_FLOATP (car))
        {
          double fact;
          int offset =
@@ -27211,23 +27210,23 @@ produce_image_glyph (struct it *it)
   slice.width = img->width;
   slice.height = img->height;
 
-  if (INTEGERP (it->slice.x))
-    slice.x = XINT (it->slice.x);
+  if (FIXNUMP (it->slice.x))
+    slice.x = XFIXNUM (it->slice.x);
   else if (FLOATP (it->slice.x))
     slice.x = XFLOAT_DATA (it->slice.x) * img->width;
 
-  if (INTEGERP (it->slice.y))
-    slice.y = XINT (it->slice.y);
+  if (FIXNUMP (it->slice.y))
+    slice.y = XFIXNUM (it->slice.y);
   else if (FLOATP (it->slice.y))
     slice.y = XFLOAT_DATA (it->slice.y) * img->height;
 
-  if (INTEGERP (it->slice.width))
-    slice.width = XINT (it->slice.width);
+  if (FIXNUMP (it->slice.width))
+    slice.width = XFIXNUM (it->slice.width);
   else if (FLOATP (it->slice.width))
     slice.width = XFLOAT_DATA (it->slice.width) * img->width;
 
-  if (INTEGERP (it->slice.height))
-    slice.height = XINT (it->slice.height);
+  if (FIXNUMP (it->slice.height))
+    slice.height = XFIXNUM (it->slice.height);
   else if (FLOATP (it->slice.height))
     slice.height = XFLOAT_DATA (it->slice.height) * img->height;
 
@@ -27853,15 +27852,15 @@ calc_line_height_property (struct it *it, Lisp_Object 
val, struct font *font,
   Lisp_Object face_name = Qnil;
   int ascent, descent, height;
 
-  if (NILP (val) || INTEGERP (val) || (override && EQ (val, Qt)))
+  if (NILP (val) || FIXNUMP (val) || (override && EQ (val, Qt)))
     return val;
 
   if (CONSP (val))
     {
       face_name = XCAR (val);
       val = XCDR (val);
-      if (!NUMBERP (val))
-       val = make_number (1);
+      if (!FIXED_OR_FLOATP (val))
+       val = make_fixnum (1);
       if (NILP (face_name))
        {
          height = it->ascent + it->descent;
@@ -27886,7 +27885,7 @@ calc_line_height_property (struct it *it, Lisp_Object 
val, struct font *font,
       face_id = lookup_named_face (it->w, it->f, face_name, false);
       face = FACE_FROM_ID_OR_NULL (it->f, face_id);
       if (face == NULL || ((font = face->font) == NULL))
-       return make_number (-1);
+       return make_fixnum (-1);
       boff = font->baseline_offset;
       if (font->vertical_centering)
        boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff;
@@ -27906,10 +27905,10 @@ calc_line_height_property (struct it *it, Lisp_Object 
val, struct font *font,
  scale:
   if (FLOATP (val))
     height = (int)(XFLOAT_DATA (val) * height);
-  else if (INTEGERP (val))
-    height *= XINT (val);
+  else if (FIXNUMP (val))
+    height *= XFIXNUM (val);
 
-  return make_number (height);
+  return make_fixnum (height);
 }
 
 
@@ -28397,8 +28396,8 @@ x_produce_glyphs (struct it *it)
                  it->descent += face->box_line_width;
                }
              if (!NILP (height)
-                 && XINT (height) > it->ascent + it->descent)
-               it->ascent = XINT (height) - it->descent;
+                 && XFIXNUM (height) > it->ascent + it->descent)
+               it->ascent = XFIXNUM (height) - it->descent;
 
              if (!NILP (total_height))
                spacing = calc_line_height_property (it, total_height, font,
@@ -28409,9 +28408,9 @@ x_produce_glyphs (struct it *it)
                  spacing = calc_line_height_property (it, spacing, font,
                                                       boff, false);
                }
-             if (INTEGERP (spacing))
+             if (FIXNUMP (spacing))
                {
-                 extra_line_spacing = XINT (spacing);
+                 extra_line_spacing = XFIXNUM (spacing);
                  if (!NILP (total_height))
                    extra_line_spacing -= (it->phys_ascent + it->phys_descent);
                }
@@ -28628,7 +28627,7 @@ x_produce_glyphs (struct it *it)
              && font->default_ascent
              && CHAR_TABLE_P (Vuse_default_ascent)
              && !NILP (Faref (Vuse_default_ascent,
-                              make_number (it->char_to_display))))
+                              make_fixnum (it->char_to_display))))
            highest = font->default_ascent + boff;
 
          /* Draw the first glyph at the normal position.  It may be
@@ -28679,7 +28678,7 @@ x_produce_glyphs (struct it *it)
                      if (font->relative_compose
                          && (! CHAR_TABLE_P (Vignore_relative_composition)
                              || NILP (Faref (Vignore_relative_composition,
-                                             make_number (ch)))))
+                                             make_fixnum (ch)))))
                        {
 
                          if (- descent >= font->relative_compose)
@@ -29115,9 +29114,9 @@ get_specified_cursor_type (Lisp_Object arg, int *width)
 
   if (CONSP (arg)
       && EQ (XCAR (arg), Qbar)
-      && RANGED_INTEGERP (0, XCDR (arg), INT_MAX))
+      && RANGED_FIXNUMP (0, XCDR (arg), INT_MAX))
     {
-      *width = XINT (XCDR (arg));
+      *width = XFIXNUM (XCDR (arg));
       return BAR_CURSOR;
     }
 
@@ -29129,9 +29128,9 @@ get_specified_cursor_type (Lisp_Object arg, int *width)
 
   if (CONSP (arg)
       && EQ (XCAR (arg), Qhbar)
-      && RANGED_INTEGERP (0, XCDR (arg), INT_MAX))
+      && RANGED_FIXNUMP (0, XCDR (arg), INT_MAX))
     {
-      *width = XINT (XCDR (arg));
+      *width = XFIXNUM (XCDR (arg));
       return HBAR_CURSOR;
     }
 
@@ -30754,13 +30753,13 @@ on_hot_spot_p (Lisp_Object hot_spot, int x, int y)
        return false;
       if (!CONSP (XCDR (rect)))
        return false;
-      if (!(tem = XCAR (XCAR (rect)), INTEGERP (tem) && x >= XINT (tem)))
+      if (!(tem = XCAR (XCAR (rect)), FIXNUMP (tem) && x >= XFIXNUM (tem)))
        return false;
-      if (!(tem = XCDR (XCAR (rect)), INTEGERP (tem) && y >= XINT (tem)))
+      if (!(tem = XCDR (XCAR (rect)), FIXNUMP (tem) && y >= XFIXNUM (tem)))
        return false;
-      if (!(tem = XCAR (XCDR (rect)), INTEGERP (tem) && x <= XINT (tem)))
+      if (!(tem = XCAR (XCDR (rect)), FIXNUMP (tem) && x <= XFIXNUM (tem)))
        return false;
-      if (!(tem = XCDR (XCDR (rect)), INTEGERP (tem) && y <= XINT (tem)))
+      if (!(tem = XCDR (XCDR (rect)), FIXNUMP (tem) && y <= XFIXNUM (tem)))
        return false;
       return true;
     }
@@ -30771,13 +30770,13 @@ on_hot_spot_p (Lisp_Object hot_spot, int x, int y)
       Lisp_Object lr, lx0, ly0;
       if (CONSP (circ)
          && CONSP (XCAR (circ))
-         && (lr = XCDR (circ), NUMBERP (lr))
-         && (lx0 = XCAR (XCAR (circ)), INTEGERP (lx0))
-         && (ly0 = XCDR (XCAR (circ)), INTEGERP (ly0)))
+         && (lr = XCDR (circ), FIXED_OR_FLOATP (lr))
+         && (lx0 = XCAR (XCAR (circ)), FIXNUMP (lx0))
+         && (ly0 = XCDR (XCAR (circ)), FIXNUMP (ly0)))
        {
          double r = XFLOATINT (lr);
-         double dx = XINT (lx0) - x;
-         double dy = XINT (ly0) - y;
+         double dx = XFIXNUM (lx0) - x;
+         double dy = XFIXNUM (ly0) - y;
          return (dx * dx + dy * dy <= r * r);
        }
     }
@@ -30802,17 +30801,17 @@ on_hot_spot_p (Lisp_Object hot_spot, int x, int y)
             If count is odd, we are inside polygon.  Pixels on edges
             may or may not be included depending on actual geometry of the
             polygon.  */
-         if ((lx = poly[n-2], !INTEGERP (lx))
-             || (ly = poly[n-1], !INTEGERP (lx)))
+         if ((lx = poly[n-2], !FIXNUMP (lx))
+             || (ly = poly[n-1], !FIXNUMP (lx)))
            return false;
-         x0 = XINT (lx), y0 = XINT (ly);
+         x0 = XFIXNUM (lx), y0 = XFIXNUM (ly);
          for (i = 0; i < n; i += 2)
            {
              int x1 = x0, y1 = y0;
-             if ((lx = poly[i], !INTEGERP (lx))
-                 || (ly = poly[i+1], !INTEGERP (ly)))
+             if ((lx = poly[i], !FIXNUMP (lx))
+                 || (ly = poly[i+1], !FIXNUMP (ly)))
                return false;
-             x0 = XINT (lx), y0 = XINT (ly);
+             x0 = XFIXNUM (lx), y0 = XFIXNUM (ly);
 
              /* Does this segment cross the X line?  */
              if (x0 >= x)
@@ -30864,12 +30863,12 @@ Returns the alist element for the first matching AREA 
in MAP.  */)
   if (NILP (map))
     return Qnil;
 
-  CHECK_NUMBER (x);
-  CHECK_NUMBER (y);
+  CHECK_FIXNUM (x);
+  CHECK_FIXNUM (y);
 
   return find_hot_spot (map,
-                       clip_to_bounds (INT_MIN, XINT (x), INT_MAX),
-                       clip_to_bounds (INT_MIN, XINT (y), INT_MAX));
+                       clip_to_bounds (INT_MIN, XFIXNUM (x), INT_MAX),
+                       clip_to_bounds (INT_MIN, XFIXNUM (y), INT_MAX));
 }
 #endif /* HAVE_WINDOW_SYSTEM */
 
@@ -31017,7 +31016,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, 
int x, int y,
 #endif /* HAVE_WINDOW_SYSTEM */
 
   if (STRINGP (string))
-    pos = make_number (charpos);
+    pos = make_fixnum (charpos);
 
   /* Set the help text and mouse pointer.  If the mouse is on a part
      of the mode line without any text (e.g. past the right edge of
@@ -31106,18 +31105,18 @@ note_mode_line_or_margin_highlight (Lisp_Object 
window, int x, int y,
 
          int vpos, hpos;
 
-         b = Fprevious_single_property_change (make_number (charpos + 1),
+         b = Fprevious_single_property_change (make_fixnum (charpos + 1),
                                                Qmouse_face, string, Qnil);
          if (NILP (b))
            begpos = 0;
          else
-           begpos = XINT (b);
+           begpos = XFIXNUM (b);
 
          e = Fnext_single_property_change (pos, Qmouse_face, string, Qnil);
          if (NILP (e))
            endpos = SCHARS (string);
          else
-           endpos = XINT (e);
+           endpos = XFIXNUM (e);
 
          /* Calculate the glyph position GPOS of GLYPH in the
             displayed string, relative to the beginning of the
@@ -31515,7 +31514,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
       ZV = Z;
 
       /* Is this char mouse-active or does it have help-echo?  */
-      position = make_number (pos);
+      position = make_fixnum (pos);
 
       USE_SAFE_ALLOCA;
 
@@ -31586,15 +31585,15 @@ note_mouse_highlight (struct frame *f, int x, int y)
              ptrdiff_t ignore;
 
              s = Fprevious_single_property_change
-               (make_number (pos + 1), Qmouse_face, object, Qnil);
+               (make_fixnum (pos + 1), Qmouse_face, object, Qnil);
              e = Fnext_single_property_change
                (position, Qmouse_face, object, Qnil);
              if (NILP (s))
-               s = make_number (0);
+               s = make_fixnum (0);
              if (NILP (e))
-               e = make_number (SCHARS (object));
+               e = make_fixnum (SCHARS (object));
              mouse_face_from_string_pos (w, hlinfo, object,
-                                         XINT (s), XINT (e));
+                                         XFIXNUM (s), XFIXNUM (e));
              hlinfo->mouse_face_past_end = false;
              hlinfo->mouse_face_window = window;
              hlinfo->mouse_face_face_id
@@ -31620,7 +31619,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
                  if (pos > 0)
                    {
                      mouse_face = get_char_property_and_overlay
-                       (make_number (pos), Qmouse_face, w->contents, &overlay);
+                       (make_fixnum (pos), Qmouse_face, w->contents, &overlay);
                      buffer = w->contents;
                      disp_string = object;
                    }
@@ -31651,7 +31650,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
                    : Qnil;
                  Lisp_Object lim2
                    = NILP (BVAR (XBUFFER (buffer), bidi_display_reordering))
-                   ? make_number (BUF_Z (XBUFFER (buffer))
+                   ? make_fixnum (BUF_Z (XBUFFER (buffer))
                                   - w->window_end_pos)
                    : Qnil;
 
@@ -31659,9 +31658,9 @@ note_mouse_highlight (struct frame *f, int x, int y)
                    {
                      /* Handle the text property case.  */
                      before = Fprevious_single_property_change
-                       (make_number (pos + 1), Qmouse_face, buffer, lim1);
+                       (make_fixnum (pos + 1), Qmouse_face, buffer, lim1);
                      after = Fnext_single_property_change
-                       (make_number (pos), Qmouse_face, buffer, lim2);
+                       (make_fixnum (pos), Qmouse_face, buffer, lim2);
                      before_string = after_string = Qnil;
                    }
                  else
@@ -31679,10 +31678,10 @@ note_mouse_highlight (struct frame *f, int x, int y)
                  mouse_face_from_buffer_pos (window, hlinfo, pos,
                                              NILP (before)
                                              ? 1
-                                             : XFASTINT (before),
+                                             : XFIXNAT (before),
                                              NILP (after)
                                              ? BUF_Z (XBUFFER (buffer))
-                                             : XFASTINT (after),
+                                             : XFIXNAT (after),
                                              before_string, after_string,
                                              disp_string);
                  cursor = No_Cursor;
@@ -31721,7 +31720,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
                && charpos >= 0
                && charpos < SCHARS (obj))
              {
-               help = Fget_text_property (make_number (charpos),
+               help = Fget_text_property (make_fixnum (charpos),
                                           Qhelp_echo, obj);
                if (NILP (help))
                  {
@@ -31733,7 +31732,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
                    ptrdiff_t p = string_buffer_position (obj, start);
                    if (p > 0)
                      {
-                       help = Fget_char_property (make_number (p),
+                       help = Fget_char_property (make_fixnum (p),
                                                   Qhelp_echo, w->contents);
                        if (!NILP (help))
                          {
@@ -31746,7 +31745,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
            else if (BUFFERP (obj)
                     && charpos >= BEGV
                     && charpos < ZV)
-             help = Fget_text_property (make_number (charpos), Qhelp_echo,
+             help = Fget_text_property (make_fixnum (charpos), Qhelp_echo,
                                         obj);
 
            if (!NILP (help))
@@ -31777,7 +31776,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
                  && charpos >= 0
                  && charpos < SCHARS (obj))
                {
-                 pointer = Fget_text_property (make_number (charpos),
+                 pointer = Fget_text_property (make_fixnum (charpos),
                                                Qpointer, obj);
                  if (NILP (pointer))
                    {
@@ -31788,14 +31787,14 @@ note_mouse_highlight (struct frame *f, int x, int y)
                      ptrdiff_t start = MATRIX_ROW_START_CHARPOS (r);
                      ptrdiff_t p = string_buffer_position (obj, start);
                      if (p > 0)
-                       pointer = Fget_char_property (make_number (p),
+                       pointer = Fget_char_property (make_fixnum (p),
                                                      Qpointer, w->contents);
                    }
                }
              else if (BUFFERP (obj)
                       && charpos >= BEGV
                       && charpos < ZV)
-               pointer = Fget_text_property (make_number (charpos),
+               pointer = Fget_text_property (make_fixnum (charpos),
                                              Qpointer, obj);
            }
        }
@@ -32772,7 +32771,7 @@ not span the full frame width.
 A value of nil means to respect the value of `truncate-lines'.
 
 If `word-wrap' is enabled, you might want to reduce this.  */);
-  Vtruncate_partial_width_windows = make_number (50);
+  Vtruncate_partial_width_windows = make_fixnum (50);
 
   DEFVAR_LISP ("line-number-display-limit", Vline_number_display_limit,
     doc: /* Maximum buffer size for which line number should be displayed.
@@ -32826,7 +32825,7 @@ and is used only on frames for which no explicit name 
has been set
     doc: /* Maximum number of lines to keep in the message log buffer.
 If nil, disable message logging.  If t, log messages but don't truncate
 the buffer when it becomes large.  */);
-  Vmessage_log_max = make_number (1000);
+  Vmessage_log_max = make_fixnum (1000);
 
   DEFVAR_LISP ("window-scroll-functions", Vwindow_scroll_functions,
     doc: /* List of functions to call before redisplaying a window with 
scrolling.
@@ -32904,7 +32903,7 @@ If an integer, use that for both horizontal and 
vertical margins.
 Otherwise, value should be a pair of integers `(HORZ . VERT)' with
 HORZ specifying the horizontal margin, and VERT specifying the
 vertical margin.  */);
-  Vtool_bar_button_margin = make_number (DEFAULT_TOOL_BAR_BUTTON_MARGIN);
+  Vtool_bar_button_margin = make_fixnum (DEFAULT_TOOL_BAR_BUTTON_MARGIN);
 
   DEFVAR_INT ("tool-bar-button-relief", tool_bar_button_relief,
     doc: /* Relief thickness of tool-bar buttons.  */);
@@ -33012,7 +33011,7 @@ scroll more than the value given by the scroll step.
 
 Note that the lower bound for automatic hscrolling specified by `scroll-left'
 and `scroll-right' overrides this variable's effect.  */);
-  Vhscroll_step = make_number (0);
+  Vhscroll_step = make_fixnum (0);
 
   DEFVAR_BOOL ("message-truncate-lines", message_truncate_lines,
     doc: /* If non-nil, messages are truncated instead of resizing the echo 
area.
@@ -33161,7 +33160,7 @@ cursor shapes.  */);
 
   DEFVAR_LISP ("hourglass-delay", Vhourglass_delay,
               doc: /* Seconds to wait before displaying an hourglass pointer 
when Emacs is busy.  */);
-  Vhourglass_delay = make_number (DEFAULT_HOURGLASS_DELAY);
+  Vhourglass_delay = make_fixnum (DEFAULT_HOURGLASS_DELAY);
 
 #ifdef HAVE_WINDOW_SYSTEM
   hourglass_atimer = NULL;
@@ -33186,7 +33185,7 @@ or t (meaning all windows).  */);
 
   /* Symbol for the purpose of Vglyphless_char_display.  */
   DEFSYM (Qglyphless_char_display, "glyphless-char-display");
-  Fput (Qglyphless_char_display, Qchar_table_extra_slots, make_number (1));
+  Fput (Qglyphless_char_display, Qchar_table_extra_slots, make_fixnum (1));
 
   DEFVAR_LISP ("glyphless-char-display", Vglyphless_char_display,
               doc: /* Char-table defining glyphless characters.
@@ -33209,7 +33208,7 @@ If a character has a non-nil entry in an active display 
table, the
 display table takes effect; in this case, Emacs does not consult
 `glyphless-char-display' at all.  */);
   Vglyphless_char_display = Fmake_char_table (Qglyphless_char_display, Qnil);
-  Fset_char_table_extra_slot (Vglyphless_char_display, make_number (0),
+  Fset_char_table_extra_slot (Vglyphless_char_display, make_fixnum (0),
                              Qempty_box);
 
   DEFVAR_LISP ("debug-on-message", Vdebug_on_message,
@@ -33277,7 +33276,7 @@ init_xdisp (void)
 
       /* The default ellipsis glyphs `...'.  */
       for (i = 0; i < 3; ++i)
-       default_invis_vector[i] = make_number ('.');
+       default_invis_vector[i] = make_fixnum ('.');
     }
 
   {
@@ -33336,9 +33335,9 @@ start_hourglass (void)
 
   cancel_hourglass ();
 
-  if (INTEGERP (Vhourglass_delay)
-      && XINT (Vhourglass_delay) > 0)
-    delay = make_timespec (min (XINT (Vhourglass_delay),
+  if (FIXNUMP (Vhourglass_delay)
+      && XFIXNUM (Vhourglass_delay) > 0)
+    delay = make_timespec (min (XFIXNUM (Vhourglass_delay),
                                  TYPE_MAXIMUM (time_t)),
                           0);
   else if (FLOATP (Vhourglass_delay)
diff --git a/src/xfaces.c b/src/xfaces.c
index 0f9a741..23822b1 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -736,11 +736,11 @@ the pixmap.  Bits are stored row by row, each row occupies
        }
 
       if (STRINGP (data)
-         && RANGED_INTEGERP (1, width, INT_MAX)
-         && RANGED_INTEGERP (1, height, INT_MAX))
+         && RANGED_FIXNUMP (1, width, INT_MAX)
+         && RANGED_FIXNUMP (1, height, INT_MAX))
        {
-         int bytes_per_row = (XINT (width) + CHAR_BIT - 1) / CHAR_BIT;
-         if (XINT (height) <= SBYTES (data) / bytes_per_row)
+         int bytes_per_row = (XFIXNUM (width) + CHAR_BIT - 1) / CHAR_BIT;
+         if (XFIXNUM (height) <= SBYTES (data) / bytes_per_row)
            pixmap_p = true;
        }
     }
@@ -773,8 +773,8 @@ load_pixmap (struct frame *f, Lisp_Object name)
       int h, w;
       Lisp_Object bits;
 
-      w = XINT (Fcar (name));
-      h = XINT (Fcar (Fcdr (name)));
+      w = XFIXNUM (Fcar (name));
+      h = XFIXNUM (Fcar (Fcdr (name)));
       bits = Fcar (Fcdr (Fcdr (name)));
 
       bitmap_id = x_create_bitmap_from_data (f, SSDATA (bits),
@@ -818,9 +818,9 @@ static bool
 parse_rgb_list (Lisp_Object rgb_list, XColor *color)
 {
 #define PARSE_RGB_LIST_FIELD(field)                                    \
-  if (CONSP (rgb_list) && INTEGERP (XCAR (rgb_list)))                  \
+  if (CONSP (rgb_list) && FIXNUMP (XCAR (rgb_list)))                   \
     {                                                                  \
-      color->field = XINT (XCAR (rgb_list));                           \
+      color->field = XFIXNUM (XCAR (rgb_list));                                
\
       rgb_list = XCDR (rgb_list);                                      \
     }                                                                  \
   else                                                                 \
@@ -855,10 +855,10 @@ tty_lookup_color (struct frame *f, Lisp_Object color, 
XColor *tty_color,
     {
       Lisp_Object rgb;
 
-      if (! INTEGERP (XCAR (XCDR (color_desc))))
+      if (! FIXNUMP (XCAR (XCDR (color_desc))))
        return false;
 
-      tty_color->pixel = XINT (XCAR (XCDR (color_desc)));
+      tty_color->pixel = XFIXNUM (XCAR (XCDR (color_desc)));
 
       rgb = XCDR (XCDR (color_desc));
       if (! parse_rgb_list (rgb, tty_color))
@@ -971,7 +971,7 @@ tty_color_name (struct frame *f, int idx)
       Lisp_Object coldesc;
 
       XSETFRAME (frame, f);
-      coldesc = call2 (Qtty_color_by_index, make_number (idx), frame);
+      coldesc = call2 (Qtty_color_by_index, make_fixnum (idx), frame);
 
       if (!NILP (coldesc))
        return XCAR (coldesc);
@@ -1390,12 +1390,12 @@ compare_fonts_by_sort_order (const void *v1, const void 
*v2)
        }
       else
        {
-         if (INTEGERP (val1))
-           result = (INTEGERP (val2) && XINT (val1) >= XINT (val2)
-                     ? XINT (val1) > XINT (val2)
+         if (FIXNUMP (val1))
+           result = (FIXNUMP (val2) && XFIXNUM (val1) >= XFIXNUM (val2)
+                     ? XFIXNUM (val1) > XFIXNUM (val2)
                      : -1);
          else
-           result = INTEGERP (val2) ? 1 : 0;
+           result = FIXNUMP (val2) ? 1 : 0;
        }
       if (result)
        return result;
@@ -1457,7 +1457,7 @@ the face font sort order.  */)
   font_props_for_sorting[i++] = FONT_ADSTYLE_INDEX;
   font_props_for_sorting[i++] = FONT_REGISTRY_INDEX;
 
-  ndrivers = XINT (Flength (list));
+  ndrivers = XFIXNUM (Flength (list));
   SAFE_ALLOCA_LISP (drivers, ndrivers);
   for (i = 0; i < ndrivers; i++, list = XCDR (list))
     drivers[i] = XCAR (list);
@@ -1477,9 +1477,9 @@ the face font sort order.  */)
 
       ASET (v, 0, AREF (font, FONT_FAMILY_INDEX));
       ASET (v, 1, FONT_WIDTH_SYMBOLIC (font));
-      point = PIXEL_TO_POINT (XINT (AREF (font, FONT_SIZE_INDEX)) * 10,
+      point = PIXEL_TO_POINT (XFIXNUM (AREF (font, FONT_SIZE_INDEX)) * 10,
                              FRAME_RES_Y (f));
-      ASET (v, 2, make_number (point));
+      ASET (v, 2, make_fixnum (point));
       ASET (v, 3, FONT_WEIGHT_SYMBOLIC (font));
       ASET (v, 4, FONT_SLANT_SYMBOLIC (font));
       spacing = Ffont_get (font, QCspacing);
@@ -1526,10 +1526,10 @@ the WIDTH times as wide as FACE on FRAME.  */)
   CHECK_STRING (pattern);
 
   if (! NILP (maximum))
-    CHECK_NATNUM (maximum);
+    CHECK_FIXNAT (maximum);
 
   if (!NILP (width))
-    CHECK_NUMBER (width);
+    CHECK_FIXNUM (width);
 
   /* We can't simply call decode_window_system_frame because
      this function may be called before any frame is created.  */
@@ -1566,7 +1566,7 @@ the WIDTH times as wide as FACE on FRAME.  */)
          avgwidth = FRAME_FONT (f)->average_width;
        }
       if (!NILP (width))
-       avgwidth *= XINT (width);
+       avgwidth *= XFIXNUM (width);
     }
 
   Lisp_Object font_spec = font_spec_from_name (pattern);
@@ -1575,8 +1575,8 @@ the WIDTH times as wide as FACE on FRAME.  */)
 
   if (size)
     {
-      Ffont_put (font_spec, QCsize, make_number (size));
-      Ffont_put (font_spec, QCavgwidth, make_number (avgwidth));
+      Ffont_put (font_spec, QCsize, make_fixnum (size));
+      Ffont_put (font_spec, QCavgwidth, make_fixnum (avgwidth));
     }
   Lisp_Object fonts = Flist_fonts (font_spec, frame, maximum, font_spec);
   for (Lisp_Object tail = fonts; CONSP (tail); tail = XCDR (tail))
@@ -1585,7 +1585,7 @@ the WIDTH times as wide as FACE on FRAME.  */)
 
       font_entity = XCAR (tail);
       if ((NILP (AREF (font_entity, FONT_SIZE_INDEX))
-          || XINT (AREF (font_entity, FONT_SIZE_INDEX)) == 0)
+          || XFIXNUM (AREF (font_entity, FONT_SIZE_INDEX)) == 0)
          && ! NILP (AREF (font_spec, FONT_SIZE_INDEX)))
        {
          /* This is a scalable font.  For backward compatibility,
@@ -1659,7 +1659,7 @@ check_lface_attrs (Lisp_Object attrs[LFACE_VECTOR_SIZE])
           || SYMBOLP (attrs[LFACE_SWIDTH_INDEX]));
   eassert (UNSPECIFIEDP (attrs[LFACE_HEIGHT_INDEX])
           || IGNORE_DEFFACE_P (attrs[LFACE_HEIGHT_INDEX])
-          || NUMBERP (attrs[LFACE_HEIGHT_INDEX])
+          || FIXED_OR_FLOATP (attrs[LFACE_HEIGHT_INDEX])
           || FUNCTIONP (attrs[LFACE_HEIGHT_INDEX]));
   eassert (UNSPECIFIEDP (attrs[LFACE_WEIGHT_INDEX])
           || IGNORE_DEFFACE_P (attrs[LFACE_WEIGHT_INDEX])
@@ -1684,7 +1684,7 @@ check_lface_attrs (Lisp_Object attrs[LFACE_VECTOR_SIZE])
           || IGNORE_DEFFACE_P (attrs[LFACE_BOX_INDEX])
           || SYMBOLP (attrs[LFACE_BOX_INDEX])
           || STRINGP (attrs[LFACE_BOX_INDEX])
-          || INTEGERP (attrs[LFACE_BOX_INDEX])
+          || FIXNUMP (attrs[LFACE_BOX_INDEX])
           || CONSP (attrs[LFACE_BOX_INDEX]));
   eassert (UNSPECIFIEDP (attrs[LFACE_INVERSE_INDEX])
           || IGNORE_DEFFACE_P (attrs[LFACE_INVERSE_INDEX])
@@ -2007,7 +2007,7 @@ set_lface_from_font (struct frame *f, Lisp_Object lface,
       int pt = PIXEL_TO_POINT (font->pixel_size * 10, FRAME_RES_Y (f));
 
       eassert (pt > 0);
-      ASET (lface, LFACE_HEIGHT_INDEX, make_number (pt));
+      ASET (lface, LFACE_HEIGHT_INDEX, make_fixnum (pt));
     }
 
   if (force_p || UNSPECIFIEDP (LFACE_WEIGHT (lface)))
@@ -2043,15 +2043,15 @@ merge_face_heights (Lisp_Object from, Lisp_Object to, 
Lisp_Object invalid)
 {
   Lisp_Object result = invalid;
 
-  if (INTEGERP (from))
+  if (FIXNUMP (from))
     /* FROM is absolute, just use it as is.  */
     result = from;
   else if (FLOATP (from))
     /* FROM is a scale, use it to adjust TO.  */
     {
-      if (INTEGERP (to))
+      if (FIXNUMP (to))
        /* relative X absolute => absolute */
-       result = make_number (XFLOAT_DATA (from) * XINT (to));
+       result = make_fixnum (XFLOAT_DATA (from) * XFIXNUM (to));
       else if (FLOATP (to))
        /* relative X relative => relative */
        result = make_float (XFLOAT_DATA (from) * XFLOAT_DATA (to));
@@ -2066,7 +2066,7 @@ merge_face_heights (Lisp_Object from, Lisp_Object to, 
Lisp_Object invalid)
       result = safe_call1 (from, to);
 
       /* Ensure that if TO was absolute, so is the result.  */
-      if (INTEGERP (to) && !INTEGERP (result))
+      if (FIXNUMP (to) && !FIXNUMP (result))
        result = invalid;
     }
 
@@ -2113,7 +2113,7 @@ merge_face_vectors (struct window *w,
   for (i = 1; i < LFACE_VECTOR_SIZE; ++i)
     if (!UNSPECIFIEDP (from[i]))
       {
-       if (i == LFACE_HEIGHT_INDEX && !INTEGERP (from[i]))
+       if (i == LFACE_HEIGHT_INDEX && !FIXNUMP (from[i]))
          {
            to[i] = merge_face_heights (from[i], to[i], to[i]);
            font_clear_prop (to, FONT_SIZE_INDEX);
@@ -2476,8 +2476,8 @@ merge_face_ref (struct window *w,
              else if (EQ (keyword, QCbox))
                {
                  if (EQ (value, Qt))
-                   value = make_number (1);
-                 if (INTEGERP (value)
+                   value = make_fixnum (1);
+                 if (FIXNUMP (value)
                      || STRINGP (value)
                      || CONSP (value)
                      || NILP (value))
@@ -2615,7 +2615,7 @@ Value is a vector of face attributes.  */)
   /* Add a global definition if there is none.  */
   if (NILP (global_lface))
     {
-      global_lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE),
+      global_lface = Fmake_vector (make_fixnum (LFACE_VECTOR_SIZE),
                                   Qunspecified);
       ASET (global_lface, 0, Qface);
       Vface_new_frame_defaults = Fcons (Fcons (face, global_lface),
@@ -2631,7 +2631,7 @@ Value is a vector of face attributes.  */)
                   sizeof *lface_id_to_name);
 
       lface_id_to_name[next_lface_id] = face;
-      Fput (face, Qface, make_number (next_lface_id));
+      Fput (face, Qface, make_fixnum (next_lface_id));
       ++next_lface_id;
     }
   else if (f == NULL)
@@ -2643,7 +2643,7 @@ Value is a vector of face attributes.  */)
     {
       if (NILP (lface))
        {
-         lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE),
+         lface = Fmake_vector (make_fixnum (LFACE_VECTOR_SIZE),
                                Qunspecified);
          ASET (lface, 0, Qface);
          fset_face_alist (f, Fcons (Fcons (face, lface), f->face_alist));
@@ -2792,7 +2792,7 @@ FRAME 0 means change the face on all frames, and change 
the default
 
   /* If FRAME is 0, change face on all frames, and change the
      default for new frames.  */
-  if (INTEGERP (frame) && XINT (frame) == 0)
+  if (FIXNUMP (frame) && XFIXNUM (frame) == 0)
     {
       Lisp_Object tail;
       Finternal_set_lisp_face_attribute (face, attr, value, Qt);
@@ -2862,7 +2862,7 @@ FRAME 0 means change the face on all frames, and change 
the default
          if (EQ (face, Qdefault))
            {
              /* The default face must have an absolute size.  */
-             if (!INTEGERP (value) || XINT (value) <= 0)
+             if (!FIXNUMP (value) || XFIXNUM (value) <= 0)
                signal_error ("Default face height not absolute and positive",
                              value);
            }
@@ -2871,9 +2871,9 @@ FRAME 0 means change the face on all frames, and change 
the default
              /* For non-default faces, do a test merge with a random
                 height to see if VALUE's ok. */
              Lisp_Object test = merge_face_heights (value,
-                                                    make_number (10),
+                                                    make_fixnum (10),
                                                     Qnil);
-             if (!INTEGERP (test) || XINT (test) <= 0)
+             if (!FIXNUMP (test) || XFIXNUM (test) <= 0)
                signal_error ("Face height does not produce a positive integer",
                              value);
            }
@@ -3001,14 +3001,14 @@ FRAME 0 means change the face on all frames, and change 
the default
       /* Allow t meaning a simple box of width 1 in foreground color
         of the face.  */
       if (EQ (value, Qt))
-       value = make_number (1);
+       value = make_fixnum (1);
 
       if (UNSPECIFIEDP (value) || IGNORE_DEFFACE_P (value))
        valid_p = true;
       else if (NILP (value))
        valid_p = true;
-      else if (INTEGERP (value))
-       valid_p = XINT (value) != 0;
+      else if (FIXNUMP (value))
+       valid_p = XFIXNUM (value) != 0;
       else if (STRINGP (value))
        valid_p = SCHARS (value) > 0;
       else if (CONSP (value))
@@ -3029,7 +3029,7 @@ FRAME 0 means change the face on all frames, and change 
the default
 
              if (EQ (k, QCline_width))
                {
-                 if (!INTEGERP (v) || XINT (v) == 0)
+                 if (!FIXNUMP (v) || XFIXNUM (v) == 0)
                    break;
                }
              else if (EQ (k, QCcolor))
@@ -3504,7 +3504,7 @@ ordinary `x-get-resource' doesn't take a frame argument.  
*/)
 static Lisp_Object
 face_boolean_x_resource_value (Lisp_Object value, bool signal_p)
 {
-  Lisp_Object result = make_number (0);
+  Lisp_Object result = make_fixnum (0);
 
   eassert (STRINGP (value));
 
@@ -3538,7 +3538,7 @@ DEFUN ("internal-set-lisp-face-attribute-from-resource",
   else if (EQ (attr, QCheight))
     {
       value = Fstring_to_number (value, Qnil);
-      if (!INTEGERP (value) || XINT (value) <= 0)
+      if (!FIXNUMP (value) || XFIXNUM (value) <= 0)
        signal_error ("Invalid face height from X resource", value);
     }
   else if (EQ (attr, QCbold) || EQ (attr, QCitalic))
@@ -3698,7 +3698,7 @@ However, for :height, floating point values are also 
relative.  */
   if (EQ (value, Qunspecified) || (EQ (value, QCignore_defface)))
     return Qt;
   else if (EQ (attribute, QCheight))
-    return INTEGERP (value) ? Qnil : Qt;
+    return FIXNUMP (value) ? Qnil : Qt;
   else
     return Qnil;
 }
@@ -3928,7 +3928,7 @@ return the font name used for CHARACTER.  */)
       if (FRAME_WINDOW_P (f) && !NILP (character))
        {
          CHECK_CHARACTER (character);
-         face_id = FACE_FOR_CHAR (f, fface, XINT (character), -1, Qnil);
+         face_id = FACE_FOR_CHAR (f, fface, XFIXNUM (character), -1, Qnil);
          fface = FACE_FROM_ID_OR_NULL (f, face_id);
        }
       return ((fface && fface->font)
@@ -4256,15 +4256,15 @@ two lists of the form (RED GREEN BLUE) aforementioned. 
*/)
     signal_error ("Invalid color", color2);
 
   if (NILP (metric))
-    return make_number (color_distance (&cdef1, &cdef2));
+    return make_fixnum (color_distance (&cdef1, &cdef2));
   else
     return call2 (metric,
-                  list3 (make_number (cdef1.red),
-                         make_number (cdef1.green),
-                         make_number (cdef1.blue)),
-                  list3 (make_number (cdef2.red),
-                         make_number (cdef2.green),
-                         make_number (cdef2.blue)));
+                  list3 (make_fixnum (cdef1.red),
+                         make_fixnum (cdef1.green),
+                         make_fixnum (cdef1.blue)),
+                  list3 (make_fixnum (cdef2.red),
+                         make_fixnum (cdef2.green),
+                         make_fixnum (cdef2.blue)));
 }
 
 
@@ -4685,7 +4685,7 @@ smaller_face (struct frame *f, int face_id, int steps)
 
   face = FACE_FROM_ID (f, face_id);
   memcpy (attrs, face->lface, sizeof attrs);
-  pt = last_pt = XFASTINT (attrs[LFACE_HEIGHT_INDEX]);
+  pt = last_pt = XFIXNAT (attrs[LFACE_HEIGHT_INDEX]);
   new_face_id = face_id;
   last_height = FONT_HEIGHT (face->font);
 
@@ -4696,7 +4696,7 @@ smaller_face (struct frame *f, int face_id, int steps)
     {
       /* Look up a face for a slightly smaller/larger font.  */
       pt += delta;
-      attrs[LFACE_HEIGHT_INDEX] = make_number (pt);
+      attrs[LFACE_HEIGHT_INDEX] = make_fixnum (pt);
       new_face_id = lookup_face (f, attrs);
       new_face = FACE_FROM_ID (f, new_face_id);
 
@@ -4736,7 +4736,7 @@ face_with_height (struct frame *f, int face_id, int 
height)
 
   face = FACE_FROM_ID (f, face_id);
   memcpy (attrs, face->lface, sizeof attrs);
-  attrs[LFACE_HEIGHT_INDEX] = make_number (height);
+  attrs[LFACE_HEIGHT_INDEX] = make_fixnum (height);
   font_clear_prop (attrs, FONT_SIZE_INDEX);
   face_id = lookup_face (f, attrs);
 #endif /* HAVE_WINDOW_SYSTEM */
@@ -4776,7 +4776,7 @@ DEFUN ("face-attributes-as-vector", 
Fface_attributes_as_vector,
   (Lisp_Object plist)
 {
   Lisp_Object lface;
-  lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE),
+  lface = Fmake_vector (make_fixnum (LFACE_VECTOR_SIZE),
                        Qunspecified);
   merge_face_ref (NULL, XFRAME (selected_frame),
                   plist, XVECTOR (lface)->contents,
@@ -4886,8 +4886,8 @@ x_supports_face_attributes_p (struct frame *f,
              return true;
            s1 = SYMBOL_NAME (face->font->props[i]);
            s2 = SYMBOL_NAME (def_face->font->props[i]);
-           if (! EQ (Fcompare_strings (s1, make_number (0), Qnil,
-                                       s2, make_number (0), Qnil, Qt), Qt))
+           if (! EQ (Fcompare_strings (s1, make_fixnum (0), Qnil,
+                                       s2, make_fixnum (0), Qnil, Qt), Qt))
              return true;
          }
       return false;
@@ -5391,7 +5391,7 @@ realize_default_face (struct frame *f)
       ASET (lface, LFACE_FAMILY_INDEX, build_string ("default"));
       ASET (lface, LFACE_FOUNDRY_INDEX, LFACE_FAMILY (lface));
       ASET (lface, LFACE_SWIDTH_INDEX, Qnormal);
-      ASET (lface, LFACE_HEIGHT_INDEX, make_number (1));
+      ASET (lface, LFACE_HEIGHT_INDEX, make_fixnum (1));
       if (UNSPECIFIEDP (LFACE_WEIGHT (lface)))
        ASET (lface, LFACE_WEIGHT_INDEX, Qnormal);
       if (UNSPECIFIEDP (LFACE_SLANT (lface)))
@@ -5675,13 +5675,13 @@ realize_x_face (struct face_cache *cache, Lisp_Object 
attrs[LFACE_VECTOR_SIZE])
       face->box = FACE_SIMPLE_BOX;
       face->box_line_width = 1;
     }
-  else if (INTEGERP (box))
+  else if (FIXNUMP (box))
     {
       /* Simple box of specified line width in foreground color of the
         face.  */
-      eassert (XINT (box) != 0);
+      eassert (XFIXNUM (box) != 0);
       face->box = FACE_SIMPLE_BOX;
-      face->box_line_width = XINT (box);
+      face->box_line_width = XFIXNUM (box);
       face->box_color = face->foreground;
       face->box_color_defaulted_p = true;
     }
@@ -5708,8 +5708,8 @@ realize_x_face (struct face_cache *cache, Lisp_Object 
attrs[LFACE_VECTOR_SIZE])
 
          if (EQ (keyword, QCline_width))
            {
-             if (INTEGERP (value) && XINT (value) != 0)
-               face->box_line_width = XINT (value);
+             if (FIXNUMP (value) && XFIXNUM (value) != 0)
+               face->box_line_width = XFIXNUM (value);
            }
          else if (EQ (keyword, QCcolor))
            {
@@ -5875,7 +5875,7 @@ map_tty_color (struct frame *f, struct face *face,
     {
       /* Associations in tty-defined-color-alist are of the form
         (NAME INDEX R G B).  We need the INDEX part.  */
-      pixel = XINT (XCAR (XCDR (def)));
+      pixel = XFIXNUM (XCAR (XCDR (def)));
     }
 
   if (pixel == default_pixel && STRINGP (color))
@@ -6074,8 +6074,8 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos,
   prop = Fget_text_property (position, propname, w->contents);
   XSETFASTINT (limit1, (limit < endpos ? limit : endpos));
   end = Fnext_single_property_change (position, propname, w->contents, limit1);
-  if (INTEGERP (end))
-    endpos = XINT (end);
+  if (FIXNUMP (end))
+    endpos = XFIXNUM (end);
 
   /* Look at properties from overlays.  */
   USE_SAFE_ALLOCA;
@@ -6203,8 +6203,8 @@ face_for_overlay_string (struct window *w, ptrdiff_t pos,
   prop = Fget_text_property (position, propname, w->contents);
   XSETFASTINT (limit1, (limit < endpos ? limit : endpos));
   end = Fnext_single_property_change (position, propname, w->contents, limit1);
-  if (INTEGERP (end))
-    endpos = XINT (end);
+  if (FIXNUMP (end))
+    endpos = XFIXNUM (end);
 
   *endptr = endpos;
 
@@ -6276,8 +6276,8 @@ face_at_string_position (struct window *w, Lisp_Object 
string,
      short, so set the limit to the end of the string.  */
   XSETFASTINT (limit, SCHARS (string));
   end = Fnext_single_property_change (position, prop_name, string, limit);
-  if (INTEGERP (end))
-    *endptr = XFASTINT (end);
+  if (FIXNUMP (end))
+    *endptr = XFIXNAT (end);
   else
     *endptr = -1;
 
@@ -6406,7 +6406,7 @@ where R,G,B are numbers between 0 and 255 and name is an 
arbitrary string.  */)
            char *name = buf + num;
            ptrdiff_t len = strlen (name);
            len -= 0 < len && name[len - 1] == '\n';
-           cmap = Fcons (Fcons (make_string (name, len), make_number (color)),
+           cmap = Fcons (Fcons (make_string (name, len), make_fixnum (color)),
                          cmap);
          }
       }
@@ -6471,13 +6471,13 @@ DEFUN ("dump-face", Fdump_face, Sdump_face, 0, 1, 0, 
doc: /* */)
       fprintf (stderr, "\n");
 
       for (i = 0; i < FRAME_FACE_CACHE (SELECTED_FRAME ())->used; ++i)
-       Fdump_face (make_number (i));
+       Fdump_face (make_fixnum (i));
     }
   else
     {
       struct face *face;
-      CHECK_NUMBER (n);
-      face = FACE_FROM_ID_OR_NULL (SELECTED_FRAME (), XINT (n));
+      CHECK_FIXNUM (n);
+      face = FACE_FROM_ID_OR_NULL (SELECTED_FRAME (), XFIXNUM (n));
       if (face == NULL)
        error ("Not a valid face");
       dump_realized_face (face);
diff --git a/src/xfns.c b/src/xfns.c
index 66e49df..f365241 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -274,7 +274,7 @@ x_real_pos_and_offsets (struct frame *f,
      should be the outer WM window. */
   for (;;)
     {
-      Window wm_window, rootw;
+      Window wm_window UNINIT, rootw UNINIT;
 
 #ifdef USE_XCB
       xcb_query_tree_cookie_t query_tree_cookie;
@@ -1233,7 +1233,7 @@ x_set_mouse_color (struct frame *f, Lisp_Object arg, 
Lisp_Object oldval)
       if (!NILP (shape_var))
        {
          CHECK_TYPE_RANGED_INTEGER (unsigned, shape_var);
-         cursor_data.cursor_num[i] = XINT (shape_var);
+         cursor_data.cursor_num[i] = XFIXNUM (shape_var);
        }
       else
        cursor_data.cursor_num[i] = mouse_cursor_types[i].default_shape;
@@ -1531,8 +1531,8 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, 
Lisp_Object oldval)
   if (FRAME_MINIBUF_ONLY_P (f) || FRAME_PARENT_FRAME (f))
     return;
 
-  if (TYPE_RANGED_INTEGERP (int, value))
-    nlines = XINT (value);
+  if (TYPE_RANGED_FIXNUMP (int, value))
+    nlines = XFIXNUM (value);
   else
     nlines = 0;
 
@@ -1618,8 +1618,8 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, 
Lisp_Object oldval)
     return;
 
   /* Use VALUE only if an int >= 0.  */
-  if (RANGED_INTEGERP (0, value, INT_MAX))
-    nlines = XFASTINT (value);
+  if (RANGED_FIXNUMP (0, value, INT_MAX))
+    nlines = XFIXNAT (value);
   else
     nlines = 0;
 
@@ -1661,8 +1661,8 @@ x_change_tool_bar_height (struct frame *f, int height)
   FRAME_TOOL_BAR_HEIGHT (f) = height;
   FRAME_TOOL_BAR_LINES (f) = lines;
   /* Store the `tool-bar-lines' and `height' frame parameters.  */
-  store_frame_param (f, Qtool_bar_lines, make_number (lines));
-  store_frame_param (f, Qheight, make_number (FRAME_LINES (f)));
+  store_frame_param (f, Qtool_bar_lines, make_fixnum (lines));
+  store_frame_param (f, Qheight, make_fixnum (FRAME_LINES (f)));
 
   /* We also have to make sure that the internal border at the top of
      the frame, below the menu bar or tool bar, is redrawn when the
@@ -1716,7 +1716,7 @@ x_set_internal_border_width (struct frame *f, Lisp_Object 
arg, Lisp_Object oldva
   int border;
 
   CHECK_TYPE_RANGED_INTEGER (int, arg);
-  border = max (XINT (arg), 0);
+  border = max (XFIXNUM (arg), 0);
 
   if (border != FRAME_INTERNAL_BORDER_WIDTH (f))
     {
@@ -3261,8 +3261,8 @@ x_icon_verify (struct frame *f, Lisp_Object parms)
   icon_y = x_frame_get_and_record_arg (f, parms, Qicon_top, 0, 0, 
RES_TYPE_NUMBER);
   if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound))
     {
-      CHECK_NUMBER (icon_x);
-      CHECK_NUMBER (icon_y);
+      CHECK_FIXNUM (icon_x);
+      CHECK_FIXNUM (icon_y);
     }
   else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound))
     error ("Both left and top icon corners of icon must be specified");
@@ -3292,7 +3292,7 @@ x_icon (struct frame *f, Lisp_Object parms)
   block_input ();
 
   if (! EQ (icon_x, Qunbound))
-    x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y));
+    x_wm_set_icon_position (f, XFIXNUM (icon_x), XFIXNUM (icon_y));
 
 #if false /* x_get_arg removes the visibility parameter as a side effect,
             but x_create_frame still needs it.  */
@@ -3617,7 +3617,7 @@ This function is an internal primitive--use `make-frame' 
instead.  */)
   if (EQ (parent, Qunbound))
     parent = Qnil;
   if (! NILP (parent))
-    CHECK_NUMBER (parent);
+    CHECK_FIXNUM (parent);
 
   frame = Qnil;
   tem = x_get_arg (dpyinfo, parms, Qminibuffer, "minibuffer", "Minibuffer",
@@ -3725,7 +3725,7 @@ This function is an internal primitive--use `make-frame' 
instead.  */)
   /* Specify the parent under which to make this X window.  */
   if (!NILP (parent))
     {
-      f->output_data.x->parent_desc = (Window) XFASTINT (parent);
+      f->output_data.x->parent_desc = (Window) XFIXNAT (parent);
       f->output_data.x->explicit_parent = true;
     }
   else
@@ -3782,7 +3782,7 @@ This function is an internal primitive--use `make-frame' 
instead.  */)
 
   /* Frame contents get displaced if an embedded X window has a border.  */
   if (! FRAME_X_EMBEDDED_P (f))
-    x_default_parameter (f, parms, Qborder_width, make_number (0),
+    x_default_parameter (f, parms, Qborder_width, make_fixnum (0),
                         "borderWidth", "BorderWidth", RES_TYPE_NUMBER);
 
   /* This defaults to 1 in order to match xterm.  We recognize either
@@ -3800,15 +3800,15 @@ This function is an internal primitive--use 
`make-frame' instead.  */)
     }
   x_default_parameter (f, parms, Qinternal_border_width,
 #ifdef USE_GTK /* We used to impose 0 in xg_create_frame_widgets.  */
-                      make_number (0),
+                      make_fixnum (0),
 #else
-                      make_number (1),
+                      make_fixnum (1),
 #endif
                       "internalBorderWidth", "internalBorderWidth",
                       RES_TYPE_NUMBER);
-  x_default_parameter (f, parms, Qright_divider_width, make_number (0),
+  x_default_parameter (f, parms, Qright_divider_width, make_fixnum (0),
                       NULL, NULL, RES_TYPE_NUMBER);
-  x_default_parameter (f, parms, Qbottom_divider_width, make_number (0),
+  x_default_parameter (f, parms, Qbottom_divider_width, make_fixnum (0),
                       NULL, NULL, RES_TYPE_NUMBER);
   x_default_parameter (f, parms, Qvertical_scroll_bars,
 #if defined (USE_GTK) && defined (USE_TOOLKIT_SCROLL_BARS)
@@ -3866,10 +3866,10 @@ This function is an internal primitive--use 
`make-frame' instead.  */)
      Also process `min-width' and `min-height' parameters right here
      because `frame-windows-min-size' needs them.  */
   tem = x_get_arg (dpyinfo, parms, Qmin_width, NULL, NULL, RES_TYPE_NUMBER);
-  if (NUMBERP (tem))
+  if (FIXED_OR_FLOATP (tem))
     store_frame_param (f, Qmin_width, tem);
   tem = x_get_arg (dpyinfo, parms, Qmin_height, NULL, NULL, RES_TYPE_NUMBER);
-  if (NUMBERP (tem))
+  if (FIXED_OR_FLOATP (tem))
     store_frame_param (f, Qmin_height, tem);
   adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f),
                     FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 5, true,
@@ -3882,11 +3882,11 @@ This function is an internal primitive--use 
`make-frame' instead.  */)
 
   x_default_parameter (f, parms, Qmenu_bar_lines,
                       NILP (Vmenu_bar_mode)
-                      ? make_number (0) : make_number (1),
+                      ? make_fixnum (0) : make_fixnum (1),
                       NULL, NULL, RES_TYPE_NUMBER);
   x_default_parameter (f, parms, Qtool_bar_lines,
                       NILP (Vtool_bar_mode)
-                      ? make_number (0) : make_number (1),
+                      ? make_fixnum (0) : make_fixnum (1),
                       NULL, NULL, RES_TYPE_NUMBER);
 
   x_default_parameter (f, parms, Qbuffer_predicate, Qnil,
@@ -4222,7 +4222,7 @@ each physical monitor, use 
`display-monitor-attributes-list'.  */)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
 
-  return make_number (x_display_pixel_width (dpyinfo));
+  return make_fixnum (x_display_pixel_width (dpyinfo));
 }
 
 DEFUN ("x-display-pixel-height", Fx_display_pixel_height,
@@ -4240,7 +4240,7 @@ each physical monitor, use 
`display-monitor-attributes-list'.  */)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
 
-  return make_number (x_display_pixel_height (dpyinfo));
+  return make_fixnum (x_display_pixel_height (dpyinfo));
 }
 
 DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes,
@@ -4254,7 +4254,7 @@ If omitted or nil, that stands for the selected frame's 
display.
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
 
-  return make_number (dpyinfo->n_planes);
+  return make_fixnum (dpyinfo->n_planes);
 }
 
 DEFUN ("x-display-color-cells", Fx_display_color_cells, Sx_display_color_cells,
@@ -4278,7 +4278,7 @@ If omitted or nil, that stands for the selected frame's 
display.
      it "should be enough for everyone".  */
   if (nr_planes > 24) nr_planes = 24;
 
-  return make_number (1 << nr_planes);
+  return make_fixnum (1 << nr_planes);
 }
 
 DEFUN ("x-server-max-request-size", Fx_server_max_request_size,
@@ -4295,7 +4295,7 @@ On Nextstep, this function just returns nil.  */)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
 
-  return make_number (MAXREQUEST (dpyinfo->display));
+  return make_fixnum (MAXREQUEST (dpyinfo->display));
 }
 
 DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0,
@@ -4358,7 +4358,7 @@ For the number of physical monitors, use `(length
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
 
-  return make_number (ScreenCount (dpyinfo->display));
+  return make_fixnum (ScreenCount (dpyinfo->display));
 }
 
 DEFUN ("x-display-mm-height", Fx_display_mm_height, Sx_display_mm_height, 0, 
1, 0,
@@ -4375,7 +4375,7 @@ for each physical monitor, use 
`display-monitor-attributes-list'.  */)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
 
-  return make_number (HeightMMOfScreen (dpyinfo->screen));
+  return make_fixnum (HeightMMOfScreen (dpyinfo->screen));
 }
 
 DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0,
@@ -4392,7 +4392,7 @@ for each physical monitor, use 
`display-monitor-attributes-list'.  */)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
 
-  return make_number (WidthMMOfScreen (dpyinfo->screen));
+  return make_fixnum (WidthMMOfScreen (dpyinfo->screen));
 }
 
 DEFUN ("x-display-backing-store", Fx_display_backing_store,
@@ -4628,7 +4628,7 @@ x_make_monitor_attribute_list (struct MonitorInfo 
*monitors,
                                struct x_display_info *dpyinfo,
                                const char *source)
 {
-  Lisp_Object monitor_frames = Fmake_vector (make_number (n_monitors), Qnil);
+  Lisp_Object monitor_frames = Fmake_vector (make_fixnum (n_monitors), Qnil);
   Lisp_Object frame, rest;
 
   FOR_EACH_FRAME (rest, frame)
@@ -4931,7 +4931,7 @@ Internal use only, use `display-monitor-attributes-list' 
instead.  */)
 #endif
   n_monitors = gdk_screen_get_n_monitors (gscreen);
 #endif
-  monitor_frames = Fmake_vector (make_number (n_monitors), Qnil);
+  monitor_frames = Fmake_vector (make_fixnum (n_monitors), Qnil);
   monitors = xzalloc (n_monitors * sizeof *monitors);
 
   FOR_EACH_FRAME (rest, frame)
@@ -5099,8 +5099,8 @@ frame_geometry (Lisp_Object frame, Lisp_Object attribute)
       edges = Fx_frame_edges (parent, Qnative_edges);
       if (!NILP (edges))
        {
-         x_native += XINT (Fnth (make_number (0), edges));
-         y_native += XINT (Fnth (make_number (1), edges));
+         x_native += XFIXNUM (Fnth (make_fixnum (0), edges));
+         y_native += XFIXNUM (Fnth (make_fixnum (1), edges));
        }
 
       outer_left = x_native;
@@ -5185,43 +5185,43 @@ frame_geometry (Lisp_Object frame, Lisp_Object 
attribute)
 
   /* Construct list.  */
   if (EQ (attribute, Qouter_edges))
-    return list4 (make_number (outer_left), make_number (outer_top),
-                 make_number (outer_right), make_number (outer_bottom));
+    return list4 (make_fixnum (outer_left), make_fixnum (outer_top),
+                 make_fixnum (outer_right), make_fixnum (outer_bottom));
   else if (EQ (attribute, Qnative_edges))
-    return list4 (make_number (native_left), make_number (native_top),
-                 make_number (native_right), make_number (native_bottom));
+    return list4 (make_fixnum (native_left), make_fixnum (native_top),
+                 make_fixnum (native_right), make_fixnum (native_bottom));
   else if (EQ (attribute, Qinner_edges))
-    return list4 (make_number (inner_left), make_number (inner_top),
-                 make_number (inner_right), make_number (inner_bottom));
+    return list4 (make_fixnum (inner_left), make_fixnum (inner_top),
+                 make_fixnum (inner_right), make_fixnum (inner_bottom));
   else
     return
       listn (CONSTYPE_HEAP, 11,
             Fcons (Qouter_position,
-                   Fcons (make_number (outer_left),
-                          make_number (outer_top))),
+                   Fcons (make_fixnum (outer_left),
+                          make_fixnum (outer_top))),
             Fcons (Qouter_size,
-                   Fcons (make_number (outer_right - outer_left),
-                          make_number (outer_bottom - outer_top))),
+                   Fcons (make_fixnum (outer_right - outer_left),
+                          make_fixnum (outer_bottom - outer_top))),
             /* Approximate.  */
             Fcons (Qexternal_border_size,
-                   Fcons (make_number (right_off),
-                          make_number (bottom_off))),
-            Fcons (Qouter_border_width, make_number (x_border_width)),
+                   Fcons (make_fixnum (right_off),
+                          make_fixnum (bottom_off))),
+            Fcons (Qouter_border_width, make_fixnum (x_border_width)),
             /* Approximate.  */
             Fcons (Qtitle_bar_size,
-                   Fcons (make_number (0),
-                          make_number (top_off - bottom_off))),
+                   Fcons (make_fixnum (0),
+                          make_fixnum (top_off - bottom_off))),
             Fcons (Qmenu_bar_external, menu_bar_external ? Qt : Qnil),
             Fcons (Qmenu_bar_size,
-                   Fcons (make_number (menu_bar_width),
-                          make_number (menu_bar_height))),
+                   Fcons (make_fixnum (menu_bar_width),
+                          make_fixnum (menu_bar_height))),
             Fcons (Qtool_bar_external, tool_bar_external ? Qt : Qnil),
             Fcons (Qtool_bar_position, FRAME_TOOL_BAR_POSITION (f)),
             Fcons (Qtool_bar_size,
-                   Fcons (make_number (tool_bar_width),
-                          make_number (tool_bar_height))),
+                   Fcons (make_fixnum (tool_bar_width),
+                          make_fixnum (tool_bar_height))),
             Fcons (Qinternal_border_width,
-                   make_number (internal_border_width)));
+                   make_fixnum (internal_border_width)));
 }
 
 DEFUN ("x-frame-geometry", Fx_frame_geometry, Sx_frame_geometry, 0, 1, 0,
@@ -5421,16 +5421,10 @@ Some window managers may refuse to restack windows.  */)
   struct frame *f1 = decode_live_frame (frame1);
   struct frame *f2 = decode_live_frame (frame2);
 
-  if (FRAME_OUTER_WINDOW (f1) && FRAME_OUTER_WINDOW (f2))
-    {
-      x_frame_restack (f1, f2, !NILP (above));
-      return Qt;
-    }
-  else
-    {
-      error ("Cannot restack frames");
-      return Qnil;
-    }
+  if (! (FRAME_OUTER_WINDOW (f1) && FRAME_OUTER_WINDOW (f2)))
+    error ("Cannot restack frames");
+  x_frame_restack (f1, f2, !NILP (above));
+  return Qt;
 }
 
 
@@ -5456,7 +5450,7 @@ selected frame's display.  */)
                  (unsigned int *) &dummy);
   unblock_input ();
 
-  return Fcons (make_number (x), make_number (y));
+  return Fcons (make_fixnum (x), make_fixnum (y));
 }
 
 DEFUN ("x-set-mouse-absolute-pixel-position", 
Fx_set_mouse_absolute_pixel_position,
@@ -5476,7 +5470,7 @@ The coordinates X and Y are interpreted in pixels 
relative to a position
 
   block_input ();
   XWarpPointer (FRAME_X_DISPLAY (f), None, DefaultRootWindow (FRAME_X_DISPLAY 
(f)),
-               0, 0, 0, 0, XINT (x), XINT (y));
+               0, 0, 0, 0, XFIXNUM (x), XFIXNUM (y));
   unblock_input ();
 
   return Qnil;
@@ -5774,12 +5768,12 @@ FRAME.  Default is to change on the edit X window.  */)
 
   if (! NILP (format))
     {
-      CHECK_NUMBER (format);
+      CHECK_FIXNUM (format);
 
-      if (XINT (format) != 8 && XINT (format) != 16
-          && XINT (format) != 32)
+      if (XFIXNUM (format) != 8 && XFIXNUM (format) != 16
+          && XFIXNUM (format) != 32)
         error ("FORMAT must be one of 8, 16 or 32");
-      element_format = XINT (format);
+      element_format = XFIXNUM (format);
     }
 
   if (CONSP (value))
@@ -6072,9 +6066,9 @@ Otherwise, the return value is a vector with the 
following fields:
       XFree (tmp_data);
 
       prop_attr = make_uninit_vector (3);
-      ASET (prop_attr, 0, make_number (actual_type));
-      ASET (prop_attr, 1, make_number (actual_format));
-      ASET (prop_attr, 2, make_number (bytes_remaining / (actual_format >> 
3)));
+      ASET (prop_attr, 0, make_fixnum (actual_type));
+      ASET (prop_attr, 1, make_fixnum (actual_format));
+      ASET (prop_attr, 2, make_fixnum (bytes_remaining / (actual_format >> 
3)));
     }
 
   unblock_input ();
@@ -6257,7 +6251,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, 
Lisp_Object parms)
      needed to determine window geometry.  */
   x_default_font_parameter (f, parms);
 
-  x_default_parameter (f, parms, Qborder_width, make_number (0),
+  x_default_parameter (f, parms, Qborder_width, make_fixnum (0),
                       "borderWidth", "BorderWidth", RES_TYPE_NUMBER);
 
   /* This defaults to 2 in order to match xterm.  We recognize either
@@ -6274,12 +6268,12 @@ x_create_tip_frame (struct x_display_info *dpyinfo, 
Lisp_Object parms)
                       parms);
     }
 
-  x_default_parameter (f, parms, Qinternal_border_width, make_number (1),
+  x_default_parameter (f, parms, Qinternal_border_width, make_fixnum (1),
                       "internalBorderWidth", "internalBorderWidth",
                       RES_TYPE_NUMBER);
-  x_default_parameter (f, parms, Qright_divider_width, make_number (0),
+  x_default_parameter (f, parms, Qright_divider_width, make_fixnum (0),
                       NULL, NULL, RES_TYPE_NUMBER);
-  x_default_parameter (f, parms, Qbottom_divider_width, make_number (0),
+  x_default_parameter (f, parms, Qbottom_divider_width, make_fixnum (0),
                       NULL, NULL, RES_TYPE_NUMBER);
 
   /* Also do the stuff which must be set before the window exists.  */
@@ -6463,8 +6457,8 @@ compute_tip_xy (struct frame *f,
 
   /* Move the tooltip window where the mouse pointer is.  Resize and
      show it.  */
-  if ((!INTEGERP (left) && !INTEGERP (right))
-      || (!INTEGERP (top) && !INTEGERP (bottom)))
+  if ((!FIXNUMP (left) && !FIXNUMP (right))
+      || (!FIXNUMP (top) && !FIXNUMP (bottom)))
     {
       Lisp_Object frame, attributes, monitor, geometry;
 
@@ -6484,10 +6478,10 @@ compute_tip_xy (struct frame *f,
           geometry = Fassq (Qgeometry, monitor);
           if (CONSP (geometry))
             {
-              min_x = XINT (Fnth (make_number (1), geometry));
-              min_y = XINT (Fnth (make_number (2), geometry));
-              max_x = min_x + XINT (Fnth (make_number (3), geometry));
-              max_y = min_y + XINT (Fnth (make_number (4), geometry));
+              min_x = XFIXNUM (Fnth (make_fixnum (1), geometry));
+              min_y = XFIXNUM (Fnth (make_fixnum (2), geometry));
+              max_x = min_x + XFIXNUM (Fnth (make_fixnum (3), geometry));
+              max_y = min_y + XFIXNUM (Fnth (make_fixnum (4), geometry));
               if (min_x <= *root_x && *root_x < max_x
                   && min_y <= *root_y && *root_y < max_y)
                 {
@@ -6510,34 +6504,34 @@ compute_tip_xy (struct frame *f,
       max_y = x_display_pixel_height (FRAME_DISPLAY_INFO (f));
     }
 
-  if (INTEGERP (top))
-    *root_y = XINT (top);
-  else if (INTEGERP (bottom))
-    *root_y = XINT (bottom) - height;
-  else if (*root_y + XINT (dy) <= min_y)
+  if (FIXNUMP (top))
+    *root_y = XFIXNUM (top);
+  else if (FIXNUMP (bottom))
+    *root_y = XFIXNUM (bottom) - height;
+  else if (*root_y + XFIXNUM (dy) <= min_y)
     *root_y = min_y; /* Can happen for negative dy */
-  else if (*root_y + XINT (dy) + height <= max_y)
+  else if (*root_y + XFIXNUM (dy) + height <= max_y)
     /* It fits below the pointer */
-    *root_y += XINT (dy);
-  else if (height + XINT (dy) + min_y <= *root_y)
+    *root_y += XFIXNUM (dy);
+  else if (height + XFIXNUM (dy) + min_y <= *root_y)
     /* It fits above the pointer.  */
-    *root_y -= height + XINT (dy);
+    *root_y -= height + XFIXNUM (dy);
   else
     /* Put it on the top.  */
     *root_y = min_y;
 
-  if (INTEGERP (left))
-    *root_x = XINT (left);
-  else if (INTEGERP (right))
-    *root_x = XINT (right) - width;
-  else if (*root_x + XINT (dx) <= min_x)
+  if (FIXNUMP (left))
+    *root_x = XFIXNUM (left);
+  else if (FIXNUMP (right))
+    *root_x = XFIXNUM (right) - width;
+  else if (*root_x + XFIXNUM (dx) <= min_x)
     *root_x = 0; /* Can happen for negative dx */
-  else if (*root_x + XINT (dx) + width <= max_x)
+  else if (*root_x + XFIXNUM (dx) + width <= max_x)
     /* It fits to the right of the pointer.  */
-    *root_x += XINT (dx);
-  else if (width + XINT (dx) + min_x <= *root_x)
+    *root_x += XFIXNUM (dx);
+  else if (width + XFIXNUM (dx) + min_x <= *root_x)
     /* It fits to the left of the pointer.  */
-    *root_x -= width + XINT (dx);
+    *root_x -= width + XFIXNUM (dx);
   else
     /* Put it left justified on the screen -- it ought to fit that way.  */
     *root_x = min_x;
@@ -6758,19 +6752,19 @@ Text larger than the specified size is clipped.  */)
   f = decode_window_system_frame (frame);
 
   if (NILP (timeout))
-    timeout = make_number (5);
+    timeout = make_fixnum (5);
   else
-    CHECK_NATNUM (timeout);
+    CHECK_FIXNAT (timeout);
 
   if (NILP (dx))
-    dx = make_number (5);
+    dx = make_fixnum (5);
   else
-    CHECK_NUMBER (dx);
+    CHECK_FIXNUM (dx);
 
   if (NILP (dy))
-    dy = make_number (-10);
+    dy = make_fixnum (-10);
   else
-    CHECK_NUMBER (dy);
+    CHECK_FIXNUM (dy);
 
 #ifdef USE_GTK
   if (x_gtk_use_system_tooltips)
@@ -6885,9 +6879,9 @@ Text larger than the specified size is clipped.  */)
       if (NILP (Fassq (Qname, parms)))
        parms = Fcons (Fcons (Qname, build_string ("tooltip")), parms);
       if (NILP (Fassq (Qinternal_border_width, parms)))
-       parms = Fcons (Fcons (Qinternal_border_width, make_number (3)), parms);
+       parms = Fcons (Fcons (Qinternal_border_width, make_fixnum (3)), parms);
       if (NILP (Fassq (Qborder_width, parms)))
-       parms = Fcons (Fcons (Qborder_width, make_number (1)), parms);
+       parms = Fcons (Fcons (Qborder_width, make_fixnum (1)), parms);
       if (NILP (Fassq (Qborder_color, parms)))
        parms = Fcons (Fcons (Qborder_color, build_string ("lightyellow")), 
parms);
       if (NILP (Fassq (Qbackground_color, parms)))
@@ -6906,8 +6900,8 @@ Text larger than the specified size is clipped.  */)
   tip_buf = Fget_buffer_create (tip);
   /* We will mark the tip window a "pseudo-window" below, and such
      windows cannot have display margins.  */
-  bset_left_margin_cols (XBUFFER (tip_buf), make_number (0));
-  bset_right_margin_cols (XBUFFER (tip_buf), make_number (0));
+  bset_left_margin_cols (XBUFFER (tip_buf), make_fixnum (0));
+  bset_right_margin_cols (XBUFFER (tip_buf), make_fixnum (0));
   set_window_buffer (window, tip_buf, false, false);
   w = XWINDOW (window);
   w->pseudo_window_p = true;
@@ -6922,11 +6916,11 @@ Text larger than the specified size is clipped.  */)
   w->pixel_top = 0;
 
   if (CONSP (Vx_max_tooltip_size)
-      && RANGED_INTEGERP (1, XCAR (Vx_max_tooltip_size), INT_MAX)
-      && RANGED_INTEGERP (1, XCDR (Vx_max_tooltip_size), INT_MAX))
+      && RANGED_FIXNUMP (1, XCAR (Vx_max_tooltip_size), INT_MAX)
+      && RANGED_FIXNUMP (1, XCDR (Vx_max_tooltip_size), INT_MAX))
     {
-      w->total_cols = XFASTINT (XCAR (Vx_max_tooltip_size));
-      w->total_lines = XFASTINT (XCDR (Vx_max_tooltip_size));
+      w->total_cols = XFIXNAT (XCAR (Vx_max_tooltip_size));
+      w->total_lines = XFIXNAT (XCDR (Vx_max_tooltip_size));
     }
   else
     {
@@ -6956,10 +6950,10 @@ Text larger than the specified size is clipped.  */)
   try_window (window, pos, TRY_WINDOW_IGNORE_FONTS_CHANGE);
   /* Calculate size of tooltip window.  */
   size = Fwindow_text_pixel_size (window, Qnil, Qnil, Qnil,
-                                 make_number (w->pixel_height), Qnil);
+                                 make_fixnum (w->pixel_height), Qnil);
   /* Add the frame's internal border to calculated size.  */
-  width = XINT (Fcar (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f);
-  height = XINT (Fcdr (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f);
+  width = XFIXNUM (Fcar (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f);
+  height = XFIXNUM (Fcdr (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f);
 
   /* Calculate position of tooltip frame.  */
   compute_tip_xy (tip_f, parms, dx, dy, width, height, &root_x, &root_y);
@@ -7797,7 +7791,7 @@ or when you set the mouse color.  */);
   DEFVAR_LISP ("x-max-tooltip-size", Vx_max_tooltip_size,
     doc: /* Maximum size for tooltips.
 Value is a pair (COLUMNS . ROWS).  Text larger than this is clipped.  */);
-  Vx_max_tooltip_size = Fcons (make_number (80), make_number (40));
+  Vx_max_tooltip_size = Fcons (make_fixnum (80), make_fixnum (40));
 
   DEFVAR_LISP ("x-no-window-manager", Vx_no_window_manager,
     doc: /* Non-nil if no X window manager is in use.
diff --git a/src/xfont.c b/src/xfont.c
index c2e416b..73caa70 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -190,7 +190,7 @@ xfont_chars_supported (Lisp_Object chars, XFontStruct 
*xfont,
     {
       for (; CONSP (chars); chars = XCDR (chars))
        {
-         int c = XINT (XCAR (chars));
+         int c = XFIXNUM (XCAR (chars));
          unsigned code = ENCODE_CHAR (charset, c);
          XChar2b char2b;
 
@@ -213,7 +213,7 @@ xfont_chars_supported (Lisp_Object chars, XFontStruct 
*xfont,
 
       for (i = ASIZE (chars) - 1; i >= 0; i--)
        {
-         int c = XINT (AREF (chars, i));
+         int c = XFIXNUM (AREF (chars, i));
          unsigned code = ENCODE_CHAR (charset, c);
          XChar2b char2b;
 
@@ -376,18 +376,18 @@ xfont_list_pattern (Display *display, const char *pattern,
              continue;
            ASET (entity, FONT_TYPE_INDEX, Qx);
            /* Avoid auto-scaled fonts.  */
-           if (INTEGERP (AREF (entity, FONT_DPI_INDEX))
-               && INTEGERP (AREF (entity, FONT_AVGWIDTH_INDEX))
-               && XINT (AREF (entity, FONT_DPI_INDEX)) != 0
-               && XINT (AREF (entity, FONT_AVGWIDTH_INDEX)) == 0)
+           if (FIXNUMP (AREF (entity, FONT_DPI_INDEX))
+               && FIXNUMP (AREF (entity, FONT_AVGWIDTH_INDEX))
+               && XFIXNUM (AREF (entity, FONT_DPI_INDEX)) != 0
+               && XFIXNUM (AREF (entity, FONT_AVGWIDTH_INDEX)) == 0)
              continue;
            /* Avoid not-allowed scalable fonts.  */
            if (NILP (Vscalable_fonts_allowed))
              {
                int size = 0;
 
-               if (INTEGERP (AREF (entity, FONT_SIZE_INDEX)))
-                 size = XINT (AREF (entity, FONT_SIZE_INDEX));
+               if (FIXNUMP (AREF (entity, FONT_SIZE_INDEX)))
+                 size = XFIXNUM (AREF (entity, FONT_SIZE_INDEX));
                else if (FLOATP (AREF (entity, FONT_SIZE_INDEX)))
                  size = XFLOAT_DATA (AREF (entity, FONT_SIZE_INDEX));
                if (size == 0 && i_pass == 0)
@@ -672,8 +672,8 @@ xfont_open (struct frame *f, Lisp_Object entity, int 
pixel_size)
       return Qnil;
     }
 
-  if (XINT (AREF (entity, FONT_SIZE_INDEX)) != 0)
-    pixel_size = XINT (AREF (entity, FONT_SIZE_INDEX));
+  if (XFIXNUM (AREF (entity, FONT_SIZE_INDEX)) != 0)
+    pixel_size = XFIXNUM (AREF (entity, FONT_SIZE_INDEX));
   else if (pixel_size == 0)
     {
       if (FRAME_FONT (f))
@@ -811,8 +811,8 @@ xfont_open (struct frame *f, Lisp_Object entity, int 
pixel_size)
        font->space_width = 0;
 
       val = Ffont_get (font_object, QCavgwidth);
-      if (INTEGERP (val))
-       font->average_width = XINT (val) / 10;
+      if (FIXNUMP (val))
+       font->average_width = XFIXNUM (val) / 10;
       if (font->average_width < 0)
        font->average_width = - font->average_width;
       else
@@ -1101,6 +1101,6 @@ syms_of_xfont (void)
   staticpro (&xfont_scripts_cache);
   xfont_scripts_cache = CALLN (Fmake_hash_table, QCtest, Qequal);
   staticpro (&xfont_scratch_props);
-  xfont_scratch_props = Fmake_vector (make_number (8), Qnil);
+  xfont_scratch_props = Fmake_vector (make_fixnum (8), Qnil);
   register_font_driver (&xfont_driver, NULL);
 }
diff --git a/src/xftfont.c b/src/xftfont.c
index 5ef90a0..85df0d8 100644
--- a/src/xftfont.c
+++ b/src/xftfont.c
@@ -219,24 +219,24 @@ xftfont_add_rendering_parameters (FcPattern *pat, 
Lisp_Object entity)
        FcPatternAddBool (pat, FC_AUTOHINT, NILP (val) ? FcFalse : FcTrue);
       else if (EQ (key, QChintstyle))
        {
-         if (INTEGERP (val))
-           FcPatternAddInteger (pat, FC_HINT_STYLE, XINT (val));
+         if (FIXNUMP (val))
+           FcPatternAddInteger (pat, FC_HINT_STYLE, XFIXNUM (val));
           else if (SYMBOLP (val)
                    && FcNameConstant (SDATA (SYMBOL_NAME (val)), &ival))
            FcPatternAddInteger (pat, FC_HINT_STYLE, ival);
        }
       else if (EQ (key, QCrgba))
        {
-         if (INTEGERP (val))
-           FcPatternAddInteger (pat, FC_RGBA, XINT (val));
+         if (FIXNUMP (val))
+           FcPatternAddInteger (pat, FC_RGBA, XFIXNUM (val));
           else if (SYMBOLP (val)
                    && FcNameConstant (SDATA (SYMBOL_NAME (val)), &ival))
            FcPatternAddInteger (pat, FC_RGBA, ival);
        }
       else if (EQ (key, QClcdfilter))
        {
-         if (INTEGERP (val))
-           FcPatternAddInteger (pat, FC_LCD_FILTER, ival = XINT (val));
+         if (FIXNUMP (val))
+           FcPatternAddInteger (pat, FC_LCD_FILTER, ival = XFIXNUM (val));
           else if (SYMBOLP (val)
                    && FcNameConstant (SDATA (SYMBOL_NAME (val)), &ival))
            FcPatternAddInteger (pat, FC_LCD_FILTER, ival);
@@ -271,7 +271,7 @@ xftfont_open (struct frame *f, Lisp_Object entity, int 
pixel_size)
   val = XCDR (val);
   filename = XCAR (val);
   idx = XCDR (val);
-  size = XINT (AREF (entity, FONT_SIZE_INDEX));
+  size = XFIXNUM (AREF (entity, FONT_SIZE_INDEX));
   if (size == 0)
     size = pixel_size;
   pat = FcPatternCreate ();
@@ -289,16 +289,16 @@ xftfont_open (struct frame *f, Lisp_Object entity, int 
pixel_size)
     FcPatternAddString (pat, FC_FOUNDRY, (FcChar8 *) SDATA (SYMBOL_NAME 
(val)));
   val = AREF (entity, FONT_SPACING_INDEX);
   if (! NILP (val))
-    FcPatternAddInteger (pat, FC_SPACING, XINT (val));
+    FcPatternAddInteger (pat, FC_SPACING, XFIXNUM (val));
   val = AREF (entity, FONT_DPI_INDEX);
   if (! NILP (val))
     {
-      double dbl = XINT (val);
+      double dbl = XFIXNUM (val);
 
       FcPatternAddDouble (pat, FC_DPI, dbl);
     }
   val = AREF (entity, FONT_AVGWIDTH_INDEX);
-  if (INTEGERP (val) && XINT (val) == 0)
+  if (FIXNUMP (val) && XFIXNUM (val) == 0)
     FcPatternAddBool (pat, FC_SCALABLE, FcTrue);
   /* This is necessary to identify the exact font (e.g. 10x20.pcf.gz
      over 10x20-ISO8859-1.pcf.gz).  */
@@ -307,7 +307,7 @@ xftfont_open (struct frame *f, Lisp_Object entity, int 
pixel_size)
   xftfont_add_rendering_parameters (pat, entity);
 
   FcPatternAddString (pat, FC_FILE, (FcChar8 *) SDATA (filename));
-  FcPatternAddInteger (pat, FC_INDEX, XINT (idx));
+  FcPatternAddInteger (pat, FC_INDEX, XFIXNUM (idx));
 
 
   block_input ();
@@ -352,8 +352,8 @@ xftfont_open (struct frame *f, Lisp_Object entity, int 
pixel_size)
       xftfont_info->matrix.xy = 0x10000L * matrix->xy;
       xftfont_info->matrix.yx = 0x10000L * matrix->yx;
     }
-  if (INTEGERP (AREF (entity, FONT_SPACING_INDEX)))
-    spacing = XINT (AREF (entity, FONT_SPACING_INDEX));
+  if (FIXNUMP (AREF (entity, FONT_SPACING_INDEX)))
+    spacing = XFIXNUM (AREF (entity, FONT_SPACING_INDEX));
   else
     spacing = FC_PROPORTIONAL;
   if (! ascii_printable[0])
@@ -412,7 +412,7 @@ xftfont_open (struct frame *f, Lisp_Object entity, int 
pixel_size)
     }
   font->height = font->ascent + font->descent;
 
-  if (XINT (AREF (entity, FONT_SIZE_INDEX)) == 0)
+  if (XFIXNUM (AREF (entity, FONT_SIZE_INDEX)) == 0)
     {
       int upEM = ft_face->units_per_EM;
 
diff --git a/src/xmenu.c b/src/xmenu.c
index a99e8ab..10e882a 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -1173,17 +1173,17 @@ menu_position_func (GtkMenu *menu, gint *x, gint *y, 
gboolean *push_in, gpointer
      items in x-display-monitor-attributes-list. */
   workarea = call3 (Qframe_monitor_workarea,
                     Qnil,
-                    make_number (data->x),
-                    make_number (data->y));
+                    make_fixnum (data->x),
+                    make_fixnum (data->y));
 
   if (CONSP (workarea))
     {
       int min_x, min_y;
 
-      min_x = XINT (XCAR (workarea));
-      min_y = XINT (Fnth (make_number (1), workarea));
-      max_x = min_x + XINT (Fnth (make_number (2), workarea));
-      max_y = min_y + XINT (Fnth (make_number (3), workarea));
+      min_x = XFIXNUM (XCAR (workarea));
+      min_y = XFIXNUM (Fnth (make_fixnum (1), workarea));
+      max_x = min_x + XFIXNUM (Fnth (make_fixnum (2), workarea));
+      max_y = min_y + XFIXNUM (Fnth (make_fixnum (3), workarea));
     }
 
   if (max_x < 0 || max_y < 0)
@@ -2043,9 +2043,9 @@ menu_help_callback (char const *help_string, int pane, 
int item)
     pane_name = first_item[MENU_ITEMS_ITEM_NAME];
 
   /* (menu-item MENU-NAME PANE-NUMBER)  */
-  menu_object = list3 (Qmenu_item, pane_name, make_number (pane));
+  menu_object = list3 (Qmenu_item, pane_name, make_fixnum (pane));
   show_help_echo (help_string ? build_string (help_string) : Qnil,
-                 Qnil, menu_object, make_number (item));
+                 Qnil, menu_object, make_fixnum (item));
 }
 
 struct pop_down_menu
diff --git a/src/xml.c b/src/xml.c
index 3674e32..5f3ccc8 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -187,8 +187,8 @@ parse_region (Lisp_Object start, Lisp_Object end, 
Lisp_Object base_url,
 
   validate_region (&start, &end);
 
-  istart = XINT (start);
-  iend = XINT (end);
+  istart = XFIXNUM (start);
+  iend = XFIXNUM (end);
   istart_byte = CHAR_TO_BYTE (istart);
   iend_byte = CHAR_TO_BYTE (iend);
 
diff --git a/src/xrdb.c b/src/xrdb.c
index 836c147..4abf1ad 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -474,13 +474,13 @@ x_load_resources (Display *display, const char 
*xrm_string,
 
   /* Set double click time of list boxes in the file selection
      dialog from `double-click-time'.  */
-  if (INTEGERP (Vdouble_click_time) && XINT (Vdouble_click_time) > 0)
+  if (FIXNUMP (Vdouble_click_time) && XFIXNUM (Vdouble_click_time) > 0)
     {
       sprintf (line, "%s*fsb*DirList.doubleClickInterval: %"pI"d",
-              myclass, XFASTINT (Vdouble_click_time));
+              myclass, XFIXNAT (Vdouble_click_time));
       XrmPutLineResource (&rdb, line);
       sprintf (line, "%s*fsb*ItemsList.doubleClickInterval: %"pI"d",
-              myclass, XFASTINT (Vdouble_click_time));
+              myclass, XFIXNAT (Vdouble_click_time));
       XrmPutLineResource (&rdb, line);
     }
 
diff --git a/src/xselect.c b/src/xselect.c
index 8448944..dd3da8e 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -401,16 +401,16 @@ x_get_local_selection (Lisp_Object selection_symbol, 
Lisp_Object target_type,
   if (STRINGP (check)
       || VECTORP (check)
       || SYMBOLP (check)
-      || INTEGERP (check)
+      || FIXNUMP (check)
       || NILP (value))
     return value;
   /* Check for a value that CONS_TO_INTEGER could handle.  */
   else if (CONSP (check)
-          && INTEGERP (XCAR (check))
-          && (INTEGERP (XCDR (check))
+          && FIXNUMP (XCAR (check))
+          && (FIXNUMP (XCDR (check))
               ||
               (CONSP (XCDR (check))
-               && INTEGERP (XCAR (XCDR (check)))
+               && FIXNUMP (XCAR (XCDR (check)))
                && NILP (XCDR (XCDR (check))))))
     return value;
 
@@ -1581,7 +1581,7 @@ selection_data_to_lisp_data (struct x_display_info 
*dpyinfo,
        lispy_type = QUTF8_STRING;
       else
        lispy_type = QSTRING;
-      Fput_text_property (make_number (0), make_number (size),
+      Fput_text_property (make_fixnum (0), make_fixnum (size),
                          Qforeign_selection, lispy_type, str);
       return str;
     }
@@ -1627,9 +1627,9 @@ selection_data_to_lisp_data (struct x_display_info 
*dpyinfo,
   else if (format == 16 && size == sizeof (short))
     {
       if (type == XA_INTEGER)
-        return make_number (((short *) data) [0]);
+        return make_fixnum (((short *) data) [0]);
       else
-        return make_number (((unsigned short *) data) [0]);
+        return make_fixnum (((unsigned short *) data) [0]);
     }
 
   /* Convert any other kind of data to a vector of numbers, represented
@@ -1645,7 +1645,7 @@ selection_data_to_lisp_data (struct x_display_info 
*dpyinfo,
           for (i = 0; i < size / 2; i++)
             {
               short j = ((short *) data) [i];
-              ASET (v, i, make_number (j));
+              ASET (v, i, make_fixnum (j));
             }
         }
       else
@@ -1653,7 +1653,7 @@ selection_data_to_lisp_data (struct x_display_info 
*dpyinfo,
           for (i = 0; i < size / 2; i++)
             {
               unsigned short j = ((unsigned short *) data) [i];
-              ASET (v, i, make_number (j));
+              ASET (v, i, make_fixnum (j));
             }
         }
       return v;
@@ -1693,7 +1693,7 @@ static unsigned long
 cons_to_x_long (Lisp_Object obj)
 {
   if (X_ULONG_MAX <= INTMAX_MAX
-      || XINT (INTEGERP (obj) ? obj : XCAR (obj)) < 0)
+      || XFIXNUM (FIXNUMP (obj) ? obj : XCAR (obj)) < 0)
     return cons_to_signed (obj, X_LONG_MIN, min (X_ULONG_MAX, INTMAX_MAX));
   else
     return cons_to_unsigned (obj, X_ULONG_MAX);
@@ -1748,7 +1748,7 @@ lisp_data_to_selection_data (struct x_display_info 
*dpyinfo,
       *x_atom_ptr = symbol_to_x_atom (dpyinfo, obj);
       if (NILP (type)) type = QATOM;
     }
-  else if (RANGED_INTEGERP (X_SHRT_MIN, obj, X_SHRT_MAX))
+  else if (RANGED_FIXNUMP (X_SHRT_MIN, obj, X_SHRT_MAX))
     {
       void *data = xmalloc (sizeof (short) + 1);
       short *short_ptr = data;
@@ -1756,14 +1756,14 @@ lisp_data_to_selection_data (struct x_display_info 
*dpyinfo,
       cs->format = 16;
       cs->size = 1;
       cs->data[sizeof (short)] = 0;
-      *short_ptr = XINT (obj);
+      *short_ptr = XFIXNUM (obj);
       if (NILP (type)) type = QINTEGER;
     }
-  else if (INTEGERP (obj)
-          || (CONSP (obj) && INTEGERP (XCAR (obj))
-              && (INTEGERP (XCDR (obj))
+  else if (FIXNUMP (obj)
+          || (CONSP (obj) && FIXNUMP (XCAR (obj))
+              && (FIXNUMP (XCDR (obj))
                   || (CONSP (XCDR (obj))
-                      && INTEGERP (XCAR (XCDR (obj)))))))
+                      && FIXNUMP (XCAR (XCDR (obj)))))))
     {
       void *data = xmalloc (sizeof (unsigned long) + 1);
       unsigned long *x_long_ptr = data;
@@ -1811,7 +1811,7 @@ lisp_data_to_selection_data (struct x_display_info 
*dpyinfo,
          if (NILP (type)) type = QINTEGER;
          for (i = 0; i < size; i++)
            {
-             if (! RANGED_INTEGERP (X_SHRT_MIN, AREF (obj, i),
+             if (! RANGED_FIXNUMP (X_SHRT_MIN, AREF (obj, i),
                                     X_SHRT_MAX))
                {
                  /* Use sizeof (long) even if it is more than 32 bits.
@@ -1832,7 +1832,7 @@ lisp_data_to_selection_data (struct x_display_info 
*dpyinfo,
              if (format == 32)
                x_atoms[i] = cons_to_x_long (AREF (obj, i));
              else
-               shorts[i] = XINT (AREF (obj, i));
+               shorts[i] = XFIXNUM (AREF (obj, i));
            }
        }
     }
@@ -1846,20 +1846,20 @@ static Lisp_Object
 clean_local_selection_data (Lisp_Object obj)
 {
   if (CONSP (obj)
-      && INTEGERP (XCAR (obj))
+      && FIXNUMP (XCAR (obj))
       && CONSP (XCDR (obj))
-      && INTEGERP (XCAR (XCDR (obj)))
+      && FIXNUMP (XCAR (XCDR (obj)))
       && NILP (XCDR (XCDR (obj))))
     obj = Fcons (XCAR (obj), XCDR (obj));
 
   if (CONSP (obj)
-      && INTEGERP (XCAR (obj))
-      && INTEGERP (XCDR (obj)))
+      && FIXNUMP (XCAR (obj))
+      && FIXNUMP (XCDR (obj)))
     {
-      if (XINT (XCAR (obj)) == 0)
+      if (XFIXNUM (XCAR (obj)) == 0)
        return XCDR (obj);
-      if (XINT (XCAR (obj)) == -1)
-       return make_number (- XINT (XCDR (obj)));
+      if (XFIXNUM (XCAR (obj)) == -1)
+       return make_fixnum (- XFIXNUM (XCDR (obj)));
     }
   if (VECTORP (obj))
     {
@@ -2264,10 +2264,10 @@ x_check_property_data (Lisp_Object data)
     {
       Lisp_Object o = XCAR (iter);
 
-      if (! NUMBERP (o) && ! STRINGP (o) && ! CONSP (o))
+      if (! FIXED_OR_FLOATP (o) && ! STRINGP (o) && ! CONSP (o))
         return -1;
       else if (CONSP (o) &&
-               (! NUMBERP (XCAR (o)) || ! NUMBERP (XCDR (o))))
+               (! FIXED_OR_FLOATP (XCAR (o)) || ! FIXED_OR_FLOATP (XCDR (o))))
         return -1;
       if (size == INT_MAX)
        return -1;
@@ -2303,18 +2303,18 @@ x_fill_property_data (Display *dpy, Lisp_Object data, 
void *ret, int format)
     {
       Lisp_Object o = XCAR (iter);
 
-      if (NUMBERP (o) || CONSP (o))
+      if (FIXED_OR_FLOATP (o) || CONSP (o))
         {
           if (CONSP (o)
-             && RANGED_INTEGERP (X_LONG_MIN >> 16, XCAR (o), X_LONG_MAX >> 16)
-             && RANGED_INTEGERP (- (1 << 15), XCDR (o), -1))
+             && RANGED_FIXNUMP (X_LONG_MIN >> 16, XCAR (o), X_LONG_MAX >> 16)
+             && RANGED_FIXNUMP (- (1 << 15), XCDR (o), -1))
             {
              /* cons_to_x_long does not handle negative values for v2.
                  For XDnd, v2 might be y of a window, and can be negative.
                  The XDnd spec. is not explicit about negative values,
                  but let's assume negative v2 is sent modulo 2**16.  */
-             unsigned long v1 = XINT (XCAR (o)) & 0xffff;
-             unsigned long v2 = XINT (XCDR (o)) & 0xffff;
+             unsigned long v1 = XFIXNUM (XCAR (o)) & 0xffff;
+             unsigned long v2 = XFIXNUM (XCDR (o)) & 0xffff;
              val = (v1 << 16) | v2;
             }
           else
@@ -2481,11 +2481,11 @@ x_handle_dnd_message (struct frame *f, const 
XClientMessageEvent *event,
       data = (unsigned char *) idata;
     }
 
-  vec = Fmake_vector (make_number (4), Qnil);
+  vec = Fmake_vector (make_fixnum (4), Qnil);
   ASET (vec, 0, SYMBOL_NAME (x_atom_to_symbol (FRAME_DISPLAY_INFO (f),
                                               event->message_type)));
   ASET (vec, 1, frame);
-  ASET (vec, 2, make_number (event->format));
+  ASET (vec, 2, make_fixnum (event->format));
   ASET (vec, 3, x_property_data_to_lisp (f,
                                         data,
                                         event->message_type,
@@ -2496,8 +2496,8 @@ x_handle_dnd_message (struct frame *f, const 
XClientMessageEvent *event,
   bufp->kind = DRAG_N_DROP_EVENT;
   bufp->frame_or_window = frame;
   bufp->timestamp = CurrentTime;
-  bufp->x = make_number (x);
-  bufp->y = make_number (y);
+  bufp->x = make_fixnum (x);
+  bufp->y = make_fixnum (y);
   bufp->arg = vec;
   bufp->modifiers = 0;
 
@@ -2554,17 +2554,17 @@ x_send_client_event (Lisp_Object display, Lisp_Object 
dest, Lisp_Object from,
   struct frame *f = decode_window_system_frame (from);
   bool to_root;
 
-  CHECK_NUMBER (format);
+  CHECK_FIXNUM (format);
   CHECK_CONS (values);
 
   if (x_check_property_data (values) == -1)
     error ("Bad data in VALUES, must be number, cons or string");
 
-  if (XINT (format) != 8 && XINT (format) != 16 && XINT (format) != 32)
+  if (XFIXNUM (format) != 8 && XFIXNUM (format) != 16 && XFIXNUM (format) != 
32)
     error ("FORMAT must be one of 8, 16 or 32");
 
   event.xclient.type = ClientMessage;
-  event.xclient.format = XINT (format);
+  event.xclient.format = XFIXNUM (format);
 
   if (FRAMEP (dest) || NILP (dest))
     {
@@ -2580,7 +2580,7 @@ x_send_client_event (Lisp_Object display, Lisp_Object 
dest, Lisp_Object from,
       else
         error ("DEST as a string must be one of PointerWindow or InputFocus");
     }
-  else if (NUMBERP (dest) || CONSP (dest))
+  else if (FIXED_OR_FLOATP (dest) || CONSP (dest))
     CONS_TO_INTEGER (dest, Window, wdest);
   else
     error ("DEST must be a frame, nil, string, number or cons");
diff --git a/src/xsettings.c b/src/xsettings.c
index 81c8f9b..0b67db3 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -393,7 +393,7 @@ parse_settings (unsigned char *prop,
                 struct xsettings *settings)
 {
   Lisp_Object byteorder = Fbyteorder ();
-  int my_bo = XFASTINT (byteorder) == 'B' ? MSBFirst : LSBFirst;
+  int my_bo = XFIXNAT (byteorder) == 'B' ? MSBFirst : LSBFirst;
   int that_bo = prop[0];
   CARD32 n_settings;
   int bytes_parsed = 0;
diff --git a/src/xterm.c b/src/xterm.c
index af28dab..06c8446 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -917,8 +917,8 @@ x_set_frame_alpha (struct frame *f)
 
   if (FLOATP (Vframe_alpha_lower_limit))
     alpha_min = XFLOAT_DATA (Vframe_alpha_lower_limit);
-  else if (INTEGERP (Vframe_alpha_lower_limit))
-    alpha_min = (XINT (Vframe_alpha_lower_limit)) / 100.0;
+  else if (FIXNUMP (Vframe_alpha_lower_limit))
+    alpha_min = (XFIXNUM (Vframe_alpha_lower_limit)) / 100.0;
 
   if (alpha < 0.0)
     return;
@@ -3106,14 +3106,14 @@ x_draw_image_relief (struct glyph_string *s)
   if (s->face->id == TOOL_BAR_FACE_ID)
     {
       if (CONSP (Vtool_bar_button_margin)
-         && INTEGERP (XCAR (Vtool_bar_button_margin))
-         && INTEGERP (XCDR (Vtool_bar_button_margin)))
+         && FIXNUMP (XCAR (Vtool_bar_button_margin))
+         && FIXNUMP (XCDR (Vtool_bar_button_margin)))
        {
-         extra_x = XINT (XCAR (Vtool_bar_button_margin));
-         extra_y = XINT (XCDR (Vtool_bar_button_margin));
+         extra_x = XFIXNUM (XCAR (Vtool_bar_button_margin));
+         extra_y = XFIXNUM (XCDR (Vtool_bar_button_margin));
        }
-      else if (INTEGERP (Vtool_bar_button_margin))
-       extra_x = extra_y = XINT (Vtool_bar_button_margin);
+      else if (FIXNUMP (Vtool_bar_button_margin))
+       extra_x = extra_y = XFIXNUM (Vtool_bar_button_margin);
     }
 
   top_p = bot_p = left_p = right_p = false;
@@ -3704,8 +3704,8 @@ x_draw_glyph_string (struct glyph_string *s)
                  Lisp_Object val
                    = buffer_local_value (Qunderline_minimum_offset,
                                          s->w->contents);
-                 if (INTEGERP (val))
-                   minimum_offset = XFASTINT (val);
+                 if (FIXNUMP (val))
+                   minimum_offset = XFIXNAT (val);
                  else
                    minimum_offset = 1;
                  val = buffer_local_value (Qx_underline_at_descent_line,
@@ -4824,15 +4824,15 @@ x_x_to_emacs_modifiers (struct x_display_info *dpyinfo, 
int state)
   Lisp_Object tem;
 
   tem = Fget (Vx_ctrl_keysym, Qmodifier_value);
-  if (INTEGERP (tem)) mod_ctrl = XINT (tem) & INT_MAX;
+  if (FIXNUMP (tem)) mod_ctrl = XFIXNUM (tem) & INT_MAX;
   tem = Fget (Vx_alt_keysym, Qmodifier_value);
-  if (INTEGERP (tem)) mod_alt = XINT (tem) & INT_MAX;
+  if (FIXNUMP (tem)) mod_alt = XFIXNUM (tem) & INT_MAX;
   tem = Fget (Vx_meta_keysym, Qmodifier_value);
-  if (INTEGERP (tem)) mod_meta = XINT (tem) & INT_MAX;
+  if (FIXNUMP (tem)) mod_meta = XFIXNUM (tem) & INT_MAX;
   tem = Fget (Vx_hyper_keysym, Qmodifier_value);
-  if (INTEGERP (tem)) mod_hyper = XINT (tem) & INT_MAX;
+  if (FIXNUMP (tem)) mod_hyper = XFIXNUM (tem) & INT_MAX;
   tem = Fget (Vx_super_keysym, Qmodifier_value);
-  if (INTEGERP (tem)) mod_super = XINT (tem) & INT_MAX;
+  if (FIXNUMP (tem)) mod_super = XFIXNUM (tem) & INT_MAX;
 
   return (  ((state & (ShiftMask | dpyinfo->shift_lock_mask)) ? shift_modifier 
: 0)
             | ((state & ControlMask)                   ? mod_ctrl      : 0)
@@ -4854,15 +4854,15 @@ x_emacs_to_x_modifiers (struct x_display_info *dpyinfo, 
EMACS_INT state)
   Lisp_Object tem;
 
   tem = Fget (Vx_ctrl_keysym, Qmodifier_value);
-  if (INTEGERP (tem)) mod_ctrl = XINT (tem);
+  if (FIXNUMP (tem)) mod_ctrl = XFIXNUM (tem);
   tem = Fget (Vx_alt_keysym, Qmodifier_value);
-  if (INTEGERP (tem)) mod_alt = XINT (tem);
+  if (FIXNUMP (tem)) mod_alt = XFIXNUM (tem);
   tem = Fget (Vx_meta_keysym, Qmodifier_value);
-  if (INTEGERP (tem)) mod_meta = XINT (tem);
+  if (FIXNUMP (tem)) mod_meta = XFIXNUM (tem);
   tem = Fget (Vx_hyper_keysym, Qmodifier_value);
-  if (INTEGERP (tem)) mod_hyper = XINT (tem);
+  if (FIXNUMP (tem)) mod_hyper = XFIXNUM (tem);
   tem = Fget (Vx_super_keysym, Qmodifier_value);
-  if (INTEGERP (tem)) mod_super = XINT (tem);
+  if (FIXNUMP (tem)) mod_super = XFIXNUM (tem);
 
 
   return (  ((state & mod_alt)         ? dpyinfo->alt_mod_mask   : 0)
@@ -5511,8 +5511,8 @@ x_scroll_bar_to_input_event (const XEvent *event,
 #endif
   ievent->code = 0;
   ievent->part = ev->data.l[2];
-  ievent->x = make_number (ev->data.l[3]);
-  ievent->y = make_number (ev->data.l[4]);
+  ievent->x = make_fixnum (ev->data.l[3]);
+  ievent->y = make_fixnum (ev->data.l[4]);
   ievent->modifiers = 0;
 }
 
@@ -5546,8 +5546,8 @@ x_horizontal_scroll_bar_to_input_event (const XEvent 
*event,
 #endif
   ievent->code = 0;
   ievent->part = ev->data.l[2];
-  ievent->x = make_number (ev->data.l[3]);
-  ievent->y = make_number (ev->data.l[4]);
+  ievent->x = make_fixnum (ev->data.l[3]);
+  ievent->y = make_fixnum (ev->data.l[4]);
   ievent->modifiers = 0;
 }
 
@@ -8201,7 +8201,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
 
       /* If mouse-highlight is an integer, input clears out
         mouse highlighting.  */
-      if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
+      if (!hlinfo->mouse_face_hidden && FIXNUMP (Vmouse_highlight)
 #if ! defined (USE_GTK)
          && (f == 0
              || !EQ (f->tool_bar_window, hlinfo->mouse_face_window))
@@ -8358,15 +8358,15 @@ handle_one_xevent (struct x_display_info *dpyinfo,
 
          /* Now non-ASCII.  */
          if (HASH_TABLE_P (Vx_keysym_table)
-             && (c = Fgethash (make_number (keysym),
+             && (c = Fgethash (make_fixnum (keysym),
                                Vx_keysym_table,
                                Qnil),
-                 NATNUMP (c)))
+                 FIXNATP (c)))
            {
-             inev.ie.kind = (SINGLE_BYTE_CHAR_P (XFASTINT (c))
+             inev.ie.kind = (SINGLE_BYTE_CHAR_P (XFIXNAT (c))
                               ? ASCII_KEYSTROKE_EVENT
                               : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
-             inev.ie.code = XFASTINT (c);
+             inev.ie.code = XFIXNAT (c);
              goto done_keysym;
            }
 
@@ -9853,7 +9853,7 @@ For details, see etc/PROBLEMS.\n",
   if (terminal_list == 0)
     {
       fprintf (stderr, "%s\n", error_msg);
-      Fkill_emacs (make_number (70));
+      Fkill_emacs (make_fixnum (70));
       /* NOTREACHED */
     }
 
@@ -9935,7 +9935,6 @@ x_io_error_quitter (Display *display)
   snprintf (buf, sizeof buf, "Connection lost to X server '%s'",
            DisplayString (display));
   x_connection_closed (display, buf, true);
-  assume (false);
 }
 
 /* Changing the font of the frame.  */
@@ -10254,8 +10253,8 @@ x_calc_absolute_position (struct frame *f)
          XSETFRAME (frame, f);
          edges = Fx_frame_edges (frame, Qouter_edges);
          if (!NILP (edges))
-           width = (XINT (Fnth (make_number (2), edges))
-                    - XINT (Fnth (make_number (0), edges)));
+           width = (XFIXNUM (Fnth (make_fixnum (2), edges))
+                    - XFIXNUM (Fnth (make_fixnum (0), edges)));
        }
 
       if (p)
@@ -10296,8 +10295,8 @@ x_calc_absolute_position (struct frame *f)
          if (NILP (edges))
            edges = Fx_frame_edges (frame, Qouter_edges);
          if (!NILP (edges))
-           height = (XINT (Fnth (make_number (3), edges))
-                     - XINT (Fnth (make_number (1), edges)));
+           height = (XFIXNUM (Fnth (make_fixnum (3), edges))
+                     - XFIXNUM (Fnth (make_fixnum (1), edges)));
        }
 
       if (p)
@@ -10501,12 +10500,12 @@ set_wm_state (Lisp_Object frame, bool add, Atom atom, 
Atom value)
 {
   struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (XFRAME (frame));
 
-  x_send_client_event (frame, make_number (0), frame,
+  x_send_client_event (frame, make_fixnum (0), frame,
                        dpyinfo->Xatom_net_wm_state,
-                       make_number (32),
+                       make_fixnum (32),
                        /* 1 = add, 0 = remove */
                        Fcons
-                       (make_number (add),
+                       (make_fixnum (add),
                         Fcons
                         (make_fixnum_or_float (atom),
                          (value != 0
@@ -10638,7 +10637,7 @@ get_current_wm_state (struct frame *f,
 #ifdef USE_XCB
   xcb_get_property_cookie_t prop_cookie;
   xcb_get_property_reply_t *prop;
-  xcb_atom_t *reply_data;
+  xcb_atom_t *reply_data UNINIT;
 #else
   Display *dpy = FRAME_X_DISPLAY (f);
   unsigned long bytes_remaining;
@@ -11139,8 +11138,8 @@ x_set_window_size_1 (struct frame *f, bool 
change_gravity,
     {
       frame_size_history_add
        (f, Qx_set_window_size_1, width, height,
-        list2 (make_number (old_height),
-               make_number (pixelheight + FRAME_MENUBAR_HEIGHT (f))));
+        list2 (make_fixnum (old_height),
+               make_fixnum (pixelheight + FRAME_MENUBAR_HEIGHT (f))));
 
       XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
                     old_width, pixelheight + FRAME_MENUBAR_HEIGHT (f));
@@ -11149,7 +11148,7 @@ x_set_window_size_1 (struct frame *f, bool 
change_gravity,
     {
       frame_size_history_add
        (f, Qx_set_window_size_2, width, height,
-        list2 (make_number (old_width), make_number (pixelwidth)));
+        list2 (make_fixnum (old_width), make_fixnum (pixelwidth)));
 
       XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
                     pixelwidth, old_height);
@@ -11159,10 +11158,10 @@ x_set_window_size_1 (struct frame *f, bool 
change_gravity,
     {
       frame_size_history_add
        (f, Qx_set_window_size_3, width, height,
-        list3 (make_number (pixelwidth + FRAME_TOOLBAR_WIDTH (f)),
-               make_number (pixelheight + FRAME_TOOLBAR_HEIGHT (f)
+        list3 (make_fixnum (pixelwidth + FRAME_TOOLBAR_WIDTH (f)),
+               make_fixnum (pixelheight + FRAME_TOOLBAR_HEIGHT (f)
                             + FRAME_MENUBAR_HEIGHT (f)),
-               make_number (FRAME_MENUBAR_HEIGHT (f))));
+               make_fixnum (FRAME_MENUBAR_HEIGHT (f))));
 
       XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
                     pixelwidth, pixelheight + FRAME_MENUBAR_HEIGHT (f));
@@ -11346,9 +11345,9 @@ x_ewmh_activate_frame (struct frame *f)
     {
       Lisp_Object frame;
       XSETFRAME (frame, f);
-      x_send_client_event (frame, make_number (0), frame,
+      x_send_client_event (frame, make_fixnum (0), frame,
                           dpyinfo->Xatom_net_active_window,
-                          make_number (32),
+                          make_fixnum (32),
                           list2i (1, dpyinfo->last_user_time));
     }
 }
@@ -13324,15 +13323,15 @@ With MS Windows or Nextstep, the value is t.  */);
 
   DEFSYM (Qmodifier_value, "modifier-value");
   DEFSYM (Qctrl, "ctrl");
-  Fput (Qctrl, Qmodifier_value, make_number (ctrl_modifier));
+  Fput (Qctrl, Qmodifier_value, make_fixnum (ctrl_modifier));
   DEFSYM (Qalt, "alt");
-  Fput (Qalt, Qmodifier_value, make_number (alt_modifier));
+  Fput (Qalt, Qmodifier_value, make_fixnum (alt_modifier));
   DEFSYM (Qhyper, "hyper");
-  Fput (Qhyper, Qmodifier_value, make_number (hyper_modifier));
+  Fput (Qhyper, Qmodifier_value, make_fixnum (hyper_modifier));
   DEFSYM (Qmeta, "meta");
-  Fput (Qmeta, Qmodifier_value, make_number (meta_modifier));
+  Fput (Qmeta, Qmodifier_value, make_fixnum (meta_modifier));
   DEFSYM (Qsuper, "super");
-  Fput (Qsuper, Qmodifier_value, make_number (super_modifier));
+  Fput (Qsuper, Qmodifier_value, make_fixnum (super_modifier));
 
   DEFVAR_LISP ("x-ctrl-keysym", Vx_ctrl_keysym,
     doc: /* Which keys Emacs uses for the ctrl modifier.
diff --git a/src/xwidget.c b/src/xwidget.c
index 758e640..4739993 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -79,16 +79,16 @@ Returns the newly constructed xwidget, or nil if 
construction fails.  */)
    Lisp_Object arguments, Lisp_Object buffer)
 {
   CHECK_SYMBOL (type);
-  CHECK_NATNUM (width);
-  CHECK_NATNUM (height);
+  CHECK_FIXNAT (width);
+  CHECK_FIXNAT (height);
 
   struct xwidget *xw = allocate_xwidget ();
   Lisp_Object val;
   xw->type = type;
   xw->title = title;
   xw->buffer = NILP (buffer) ? Fcurrent_buffer () : Fget_buffer_create 
(buffer);
-  xw->height = XFASTINT (height);
-  xw->width = XFASTINT (width);
+  xw->height = XFIXNAT (height);
+  xw->width = XFIXNAT (width);
   xw->kill_without_query = false;
   XSETXWIDGET (val, xw);
   Vxwidget_list = Fcons (val, Vxwidget_list);
@@ -294,7 +294,7 @@ webkit_js_to_lisp (JSContextRef context, JSValueRef value)
     case kJSTypeBoolean:
       return (JSValueToBoolean (context, value)) ? Qt : Qnil;
     case kJSTypeNumber:
-      return make_number (JSValueToNumber (context, value, NULL));
+      return make_fixnum (JSValueToNumber (context, value, NULL));
     case kJSTypeObject:
       {
         if (JSValueIsArray (context, value))
@@ -713,7 +713,7 @@ save_script_callback (struct xwidget *xw, Lisp_Object 
script, Lisp_Object fun)
 {
   Lisp_Object cbs = xw->script_callbacks;
   if (NILP (cbs))
-    xw->script_callbacks = cbs = Fmake_vector (make_number (32), Qnil);
+    xw->script_callbacks = cbs = Fmake_vector (make_fixnum (32), Qnil);
 
   /* Find first free index.  */
   ptrdiff_t idx;
@@ -767,8 +767,8 @@ DEFUN ("xwidget-resize", Fxwidget_resize, Sxwidget_resize, 
3, 3, 0,
   CHECK_RANGED_INTEGER (new_width, 0, INT_MAX);
   CHECK_RANGED_INTEGER (new_height, 0, INT_MAX);
   struct xwidget *xw = XXWIDGET (xwidget);
-  int w = XFASTINT (new_width);
-  int h = XFASTINT (new_height);
+  int w = XFIXNAT (new_width);
+  int h = XFIXNAT (new_height);
 
   xw->width = w;
   xw->height = h;
@@ -811,8 +811,8 @@ Emacs allocated area accordingly.  */)
   CHECK_XWIDGET (xwidget);
   GtkRequisition requisition;
   gtk_widget_size_request (XXWIDGET (xwidget)->widget_osr, &requisition);
-  return list2 (make_number (requisition.width),
-               make_number (requisition.height));
+  return list2 (make_fixnum (requisition.width),
+               make_fixnum (requisition.height));
 }
 
 DEFUN ("xwidgetp",
@@ -843,7 +843,7 @@ Currently [TYPE TITLE WIDTH HEIGHT].  */)
   CHECK_XWIDGET (xwidget);
   struct xwidget *xw = XXWIDGET (xwidget);
   return CALLN (Fvector, xw->type, xw->title,
-               make_natnum (xw->width), make_natnum (xw->height));
+               make_fixed_natnum (xw->width), make_fixed_natnum (xw->height));
 }
 
 DEFUN ("xwidget-view-info",
@@ -855,9 +855,9 @@ Currently [X Y CLIP_RIGHT CLIP_BOTTOM CLIP_TOP CLIP_LEFT].  
*/)
 {
   CHECK_XWIDGET_VIEW (xwidget_view);
   struct xwidget_view *xv = XXWIDGET_VIEW (xwidget_view);
-  return CALLN (Fvector, make_number (xv->x), make_number (xv->y),
-               make_number (xv->clip_right), make_number (xv->clip_bottom),
-               make_number (xv->clip_top), make_number (xv->clip_left));
+  return CALLN (Fvector, make_fixnum (xv->x), make_fixnum (xv->y),
+               make_fixnum (xv->clip_right), make_fixnum (xv->clip_bottom),
+               make_fixnum (xv->clip_top), make_fixnum (xv->clip_left));
 }
 
 DEFUN ("xwidget-view-model",
diff --git a/test/lisp/calendar/todo-mode-tests.el 
b/test/lisp/calendar/todo-mode-tests.el
index 325faef..6cd2bfe 100644
--- a/test/lisp/calendar/todo-mode-tests.el
+++ b/test/lisp/calendar/todo-mode-tests.el
@@ -763,6 +763,47 @@ The highlighting should remain enabled."
    (ert-simulate-command '(forward-line)) ; Now on first done item.
    (should (eq 'hl-line (get-char-property (point) 'face)))))
 
+(ert-deftest todo-test-current-file-in-edit-mode ()
+  "Test the value of todo-current-todo-file in todo-edit-mode."
+  (with-todo-test
+   (todo-test--show 1)
+   ;; The preceding call todo-mode but does not run pre-command-hook
+   ;; in the test environment, thus failing to set
+   ;; todo-global-current-todo-file, which is needed for the test
+   ;; after todo-edit-item--text.  So force the hook function to run.
+   (ert-simulate-command '(todo-mode))
+   (let ((curfile todo-current-todo-file))
+     (should (equal curfile todo-test-file-1))
+     (todo-edit-item--text 'multiline)
+     (should (equal todo-current-todo-file curfile))
+     (todo-edit-quit)
+     (todo-edit-file)
+     (should (equal todo-current-todo-file curfile))
+     (todo-edit-quit))
+   (todo-find-archive)
+   (let ((curfile todo-current-todo-file))
+     (should (equal curfile todo-test-archive-1))
+     (todo-edit-file)
+     (should (equal todo-current-todo-file curfile)))))
+
+(ert-deftest todo-test-edit-quit ()
+  "Test result of exiting todo-edit-mode on a whole file.
+Exiting should return to the same todo-mode or todo-archive-mode
+buffer from which the editing command was invoked."
+  (with-todo-test
+   (todo-test--show 1)
+   (let ((buf (current-buffer)))
+     (todo-edit-file)
+     (todo-edit-quit)
+     (should (eq (current-buffer) buf))
+     (should (eq major-mode 'todo-mode))
+   (todo-find-archive)
+   (let ((buf (current-buffer)))
+     (todo-edit-file)
+     (todo-edit-quit)
+     (should (eq (current-buffer) buf))
+     (should (eq major-mode 'todo-archive-mode))))))
+
 
 (provide 'todo-mode-tests)
 ;;; todo-mode-tests.el ends here
diff --git a/test/lisp/international/ccl-tests.el 
b/test/lisp/international/ccl-tests.el
new file mode 100644
index 0000000..b41b8c1
--- /dev/null
+++ b/test/lisp/international/ccl-tests.el
@@ -0,0 +1,238 @@
+;; Copyright (C) 2018 Free Software Foundation, Inc.
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'ert)
+(require 'ccl)
+(require 'seq)
+
+
+(ert-deftest shift ()
+  ;; shift left +ve                      5628     #x00000000000015fc
+  (should (= (ash  5628  8)           1440768)) ; #x000000000015fc00
+  (should (= (lsh  5628  8)           1440768)) ; #x000000000015fc00
+
+  ;; shift left -ve                     -5628     #x3fffffffffffea04
+  (should (= (ash -5628  8)          -1440768)) ; #x3fffffffffea0400
+  (should (= (lsh -5628  8)          -1440768)) ; #x3fffffffffea0400
+
+  ;; shift right +ve                     5628     #x00000000000015fc
+  (should (= (ash  5628 -8)                21)) ; #x0000000000000015
+  (should (= (lsh  5628 -8)                21)) ; #x0000000000000015
+
+  ;; shift right -ve                    -5628     #x3fffffffffffea04
+  (should (= (ash -5628 -8)               -22)) ; #x3fffffffffffffea
+
+  ;; shift right                       -5628      #x3fffffffffffea04
+  (cond
+   ((fboundp 'bignump)
+    (should (= (lsh -5628 -8)            -22))) ; #x3fffffffffffffea  bignum
+   ((= (logb most-negative-fixnum) 61)
+    (should (= (lsh -5628 -8)
+               (string-to-number
+                "18014398509481962"))))         ; #x003fffffffffffea  master 
(64bit)
+   ((= (logb most-negative-fixnum) 29)
+    (should (= (lsh -5628 -8)        4194282))) ; #x003fffea          master 
(32bit)
+   ))
+
+;; CCl program from `pgg-parse-crc24' in lisp/obsolete/pgg-parse.el
+(defconst prog-pgg-source
+  '(1
+    ((loop
+      (read r0) (r1 ^= r0) (r2 ^= 0)
+      (r5 = 0)
+      (loop
+       (r1 <<= 1)
+       (r1 += ((r2 >> 15) & 1))
+       (r2 <<= 1)
+       (if (r1 & 256)
+          ((r1 ^= 390) (r2 ^= 19707)))
+       (if (r5 < 7)
+          ((r5 += 1)
+           (repeat))))
+      (repeat)))))
+
+(defconst prog-pgg-code
+  [1 30 14 114744 114775 0 161 131127 1 148217 15 82167
+     1 1848 131159 1 1595 5 256 114743 390 114775 19707
+     1467 16 7 183 1 -5628 -7164 22])
+
+(defconst prog-pgg-dump
+"Out-buffer must be as large as in-buffer.
+Main-body:
+    2:[read-register] read r0 (0 remaining)
+    3:[set-assign-expr-register] r1 ^= r0
+    4:[set-assign-expr-const] r2 ^= 0
+    6:[set-short-const] r5 = 0
+    7:[set-assign-expr-const] r1 <<= 1
+    9:[set-expr-const] r7 = r2 >> 15
+   11:[set-assign-expr-const] r7 &= 1
+   13:[set-assign-expr-register] r1 += r7
+   14:[set-assign-expr-const] r2 <<= 1
+   16:[jump-cond-expr-const] if !(r1 & 256), jump to 23(+7)
+   19:[set-assign-expr-const] r1 ^= 390
+   21:[set-assign-expr-const] r2 ^= 19707
+   23:[jump-cond-expr-const] if !(r5 < 7), jump to 29(+6)
+   26:[set-assign-expr-const] r5 += 1
+   28:[jump] jump to 7(-21)
+   29:[jump] jump to 2(-27)
+At EOF:
+   30:[end] end
+")
+
+(ert-deftest ccl-compile-pgg ()
+  (should (equal (ccl-compile prog-pgg-source) prog-pgg-code)))
+
+(ert-deftest ccl-dump-pgg ()
+  (with-temp-buffer
+    (ccl-dump prog-pgg-code)
+    (should (equal (buffer-string) prog-pgg-dump))))
+
+(ert-deftest pgg-parse-crc24 ()
+  ;; Compiler
+  (require 'pgg)
+  (should (equal pgg-parse-crc24 prog-pgg-code))
+  ;; Interpreter
+  (should (equal (pgg-parse-crc24-string "foo") (concat [#x4f #xc2 #x55])))
+  (should (equal (pgg-parse-crc24-string "bar") (concat [#x51 #xd9 #x53])))
+  (should (equal (pgg-parse-crc24-string "baz") (concat [#xf0 #x58 #x6a]))))
+
+(ert-deftest pgg-parse-crc24-dump ()
+  ;; Disassembler
+  (require 'pgg)
+  (with-temp-buffer
+    (ccl-dump pgg-parse-crc24)
+    (should (equal (buffer-string) prog-pgg-dump))))
+
+;;----------------------------------------------------------------------------
+;; Program from 'midikbd-decoder in midi-kbd-0.2.el GNU ELPA package
+(defconst prog-midi-source
+  '(2
+    (loop
+     (loop
+      ;; central message receiver loop here.
+      ;; When it exits, the command to deal with is in r0
+      ;; Any arguments are in r1 and r2
+      ;; r3 contains: 0 if no arguments are accepted
+      ;;              1 if 1 argument can be accepted
+      ;;              2 if 2 arguments can be accepted
+      ;;              3 if the first of two arguments has been accepted
+      ;; Arguments are read into r1 and r2.
+      ;; r4 contains the current running status byte if any.
+      (read-if (r0 < #x80)
+              (branch r3
+                      (repeat)
+                      ((r1 = r0) (r0 = r4) (break))
+                      ((r1 = r0) (r3 = 3) (repeat))
+                      ((r2 = r0) (r3 = 2) (r0 = r4) (break))))
+      (if (r0 >= #xf8) ; real time message
+         (break))
+      (if (r0 < #xf0) ; channel command
+         ((r4 = r0)
+          (if ((r0 & #xe0) == #xc0)
+              ;; program change and channel pressure take only 1 argument
+              (r3 = 1)
+            (r3 = 2))
+          (repeat)))
+      ;; system common message, we swallow those for now
+      (r3 = 0)
+      (repeat))
+     (if ((r0 & #xf0) == #x90)
+        (if (r2 == 0)              ; Some Midi devices use velocity 0
+                                       ; for switching notes off,
+                                       ; so translate into note-off
+                                       ; and fall through
+            (r0 -= #x10)
+          ((r0 &= #xf)
+           (write 0)
+           (write r0 r1 r2)
+           (repeat))))
+     (if ((r0 & #xf0) == #x80)
+        ((r0 &= #xf)
+         (write 1)
+         (write r0 r1 r2)
+         (repeat)))
+     (repeat))))
+
+(defconst prog-midi-code
+  [2 72 4893 16 128 1133 5 6 9 12 16 -2556 32 1024 6660 32 865
+     -4092 64 609 1024 4868 795 20 248 3844 3099 16 240 128 82169
+     224 1275 18 192 353 260 609 -9468 97 -9980 82169 240 4091
+     18 144 1371 18 0 16407 16 1796 81943 15 20 529 305 81 -14588
+     82169 240 2555 18 128 81943 15 276 529 305 81 -17660 -17916 22])
+
+(defconst prog-midi-dump
+"Out-buffer must be 2 times bigger than in-buffer.
+Main-body:
+    2:[read-jump-cond-expr-const] read r0, if !(r0 < 128), jump to 22(+20)
+    5:[branch] jump to array[r3] of length 4
+       11 12 15 18 22 
+   11:[jump] jump to 2(-9)
+   12:[set-register] r1 = r0
+   13:[set-register] r0 = r4
+   14:[jump] jump to 41(+27)
+   15:[set-register] r1 = r0
+   16:[set-short-const] r3 = 3
+   17:[jump] jump to 2(-15)
+   18:[set-register] r2 = r0
+   19:[set-short-const] r3 = 2
+   20:[set-register] r0 = r4
+   21:[jump] jump to 41(+20)
+   22:[jump-cond-expr-const] if !(r0 >= 248), jump to 26(+4)
+   25:[jump] jump to 41(+16)
+   26:[jump-cond-expr-const] if !(r0 < 240), jump to 39(+13)
+   29:[set-register] r4 = r0
+   30:[set-expr-const] r7 = r0 & 224
+   32:[jump-cond-expr-const] if !(r7 == 192), jump to 37(+5)
+   35:[set-short-const] r3 = 1
+   36:[jump] jump to 38(+2)
+   37:[set-short-const] r3 = 2
+   38:[jump] jump to 2(-36)
+   39:[set-short-const] r3 = 0
+   40:[jump] jump to 2(-38)
+   41:[set-expr-const] r7 = r0 & 240
+   43:[jump-cond-expr-const] if !(r7 == 144), jump to 59(+16)
+   46:[jump-cond-expr-const] if !(r2 == 0), jump to 52(+6)
+   49:[set-assign-expr-const] r0 -= 16
+   51:[jump] jump to 59(+8)
+   52:[set-assign-expr-const] r0 &= 15
+   54:[write-const-string] write char \"\x00\"
+   55:[write-register] write r0 (2 remaining)
+   56:[write-register] write r1 (1 remaining)
+   57:[write-register] write r2 (0 remaining)
+   58:[jump] jump to 2(-56)
+   59:[set-expr-const] r7 = r0 & 240
+   61:[jump-cond-expr-const] if !(r7 == 128), jump to 71(+10)
+   64:[set-assign-expr-const] r0 &= 15
+   66:[write-const-string] write char \"\x01\"
+   67:[write-register] write r0 (2 remaining)
+   68:[write-register] write r1 (1 remaining)
+   69:[write-register] write r2 (0 remaining)
+   70:[jump] jump to 2(-68)
+   71:[jump] jump to 2(-69)
+At EOF:
+   72:[end] end
+")
+
+(ert-deftest ccl-compile-midi ()
+  (should (equal (ccl-compile prog-midi-source) prog-midi-code)))
+
+(ert-deftest ccl-dump-midi ()
+  (with-temp-buffer
+    (ccl-dump prog-midi-code)
+    (should (equal (buffer-string) prog-midi-dump))))
diff --git a/test/lisp/net/tramp-archive-tests.el 
b/test/lisp/net/tramp-archive-tests.el
index 0abb4f9..e759786 100644
--- a/test/lisp/net/tramp-archive-tests.el
+++ b/test/lisp/net/tramp-archive-tests.el
@@ -311,6 +311,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
 
 (ert-deftest tramp-archive-test07-file-exists-p ()
   "Check `file-exist-p', `write-region' and `delete-file'."
+  :tags '(:expensive-test)
   (skip-unless tramp-archive-enabled)
 
   (unwind-protect
@@ -333,6 +334,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
 
 (ert-deftest tramp-archive-test08-file-local-copy ()
   "Check `file-local-copy'."
+  :tags '(:expensive-test)
   (skip-unless tramp-archive-enabled)
 
   (let (tmp-name)
@@ -359,6 +361,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
 
 (ert-deftest tramp-archive-test09-insert-file-contents ()
   "Check `insert-file-contents'."
+  :tags '(:expensive-test)
   (skip-unless tramp-archive-enabled)
 
   (let ((tmp-name (expand-file-name "bar/bar" tramp-archive-test-archive)))
@@ -385,6 +388,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
 
 (ert-deftest tramp-archive-test11-copy-file ()
   "Check `copy-file'."
+  :tags '(:expensive-test)
   (skip-unless tramp-archive-enabled)
 
   ;; Copy simple file.
@@ -450,6 +454,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
 
 (ert-deftest tramp-archive-test15-copy-directory ()
   "Check `copy-directory'."
+  :tags '(:expensive-test)
   (skip-unless tramp-archive-enabled)
 
   (let* ((tmp-name1 (expand-file-name "bar" tramp-archive-test-archive))
@@ -504,6 +509,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
 
 (ert-deftest tramp-archive-test16-directory-files ()
   "Check `directory-files'."
+  :tags '(:expensive-test)
   (skip-unless tramp-archive-enabled)
 
   (let ((tmp-name tramp-archive-test-archive)
@@ -527,6 +533,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
 
 (ert-deftest tramp-archive-test17-insert-directory ()
   "Check `insert-directory'."
+  :tags '(:expensive-test)
   (skip-unless tramp-archive-enabled)
 
   (let (;; We test for the summary line.  Keyword "total" could be localized.
@@ -569,6 +576,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
 (ert-deftest tramp-archive-test18-file-attributes ()
   "Check `file-attributes'.
 This tests also `file-readable-p' and `file-regular-p'."
+  :tags '(:expensive-test)
   (skip-unless tramp-archive-enabled)
 
   (let ((tmp-name1 (expand-file-name "foo.txt" tramp-archive-test-archive))
@@ -619,6 +627,7 @@ This tests also `file-readable-p' and `file-regular-p'."
 
 (ert-deftest tramp-archive-test19-directory-files-and-attributes ()
   "Check `directory-files-and-attributes'."
+  :tags '(:expensive-test)
   (skip-unless tramp-archive-enabled)
 
   (let ((tmp-name (expand-file-name "bar" tramp-archive-test-archive))
@@ -644,6 +653,7 @@ This tests also `file-readable-p' and `file-regular-p'."
 (ert-deftest tramp-archive-test20-file-modes ()
   "Check `file-modes'.
 This tests also `file-executable-p', `file-writable-p' and `set-file-modes'."
+  :tags '(:expensive-test)
   (skip-unless tramp-archive-enabled)
 
   (let ((tmp-name1 (expand-file-name "foo.txt" tramp-archive-test-archive))
@@ -673,6 +683,7 @@ This tests also `file-executable-p', `file-writable-p' and 
`set-file-modes'."
 
 (ert-deftest tramp-archive-test21-file-links ()
   "Check `file-symlink-p' and `file-truename'"
+  :tags '(:expensive-test)
   (skip-unless tramp-archive-enabled)
 
   ;; We must use `file-truename' for the file archive, because it
@@ -711,6 +722,7 @@ This tests also `file-executable-p', `file-writable-p' and 
`set-file-modes'."
 
 (ert-deftest tramp-archive-test26-file-name-completion ()
   "Check `file-name-completion' and `file-name-all-completions'."
+  :tags '(:expensive-test)
   (skip-unless tramp-archive-enabled)
 
   (let ((tmp-name tramp-archive-test-archive))
@@ -804,6 +816,7 @@ This tests also `file-executable-p', `file-writable-p' and 
`set-file-modes'."
 
 (ert-deftest tramp-archive-test44-auto-load ()
   "Check that `tramp-archive' autoloads properly."
+  :tags '(:expensive-test)
   (skip-unless tramp-archive-enabled)
   ;; Autoloading tramp-archive works since Emacs 27.1.
   (skip-unless (tramp-archive--test-emacs27-p))
@@ -834,6 +847,7 @@ This tests also `file-executable-p', `file-writable-p' and 
`set-file-modes'."
 
 (ert-deftest tramp-archive-test44-delay-load ()
   "Check that `tramp-archive' is loaded lazily, only when needed."
+  :tags '(:expensive-test)
   (skip-unless tramp-archive-enabled)
   ;; Autoloading tramp-archive works since Emacs 27.1.
   (skip-unless (tramp-archive--test-emacs27-p))
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 29a8df8..e1838d1 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -5155,6 +5155,8 @@ process sentinels.  They shall not disturb each other."
 ;; This test is inspired by Bug#29163.
 (ert-deftest tramp-test44-auto-load ()
   "Check that Tramp autoloads properly."
+  (skip-unless (tramp--test-enabled))
+
   (let ((default-directory (expand-file-name temporary-file-directory))
        (code
         (format
@@ -5265,42 +5267,52 @@ Since it unloads Tramp, it shall be the last test to 
run."
   ;; cannot test older Emacsen, therefore.
   (skip-unless (tramp--test-emacs26-p))
 
-  (when (featurep 'tramp)
-    (unload-feature 'tramp 'force)
-    ;; No Tramp feature must be left.
-    (should-not (featurep 'tramp))
-    (should-not (all-completions "tramp" (delq 'tramp-tests features)))
-    ;; `file-name-handler-alist' must be clean.
-    (should-not (all-completions "tramp" (mapcar 'cdr 
file-name-handler-alist)))
-    ;; There shouldn't be left a bound symbol, except buffer-local
-    ;; variables, and autoload functions.  We do not regard our test
-    ;; symbols, and the Tramp unload hooks.
-    (mapatoms
-     (lambda (x)
-       (and (or (and (boundp x) (null (local-variable-if-set-p x)))
-               (and (functionp x) (null (autoloadp (symbol-function x)))))
-           (string-match "^tramp" (symbol-name x))
-           (not (string-match "^tramp--?test" (symbol-name x)))
-           (not (string-match "unload-hook$" (symbol-name x)))
-           (ert-fail (format "`%s' still bound" x)))))
-    ;; The defstruct `tramp-file-name' and all its internal functions
-    ;; shall be purged.
-    (should-not (cl--find-class 'tramp-file-name))
-    (mapatoms
-     (lambda (x)
-       (and (functionp x)
-            (string-match "tramp-file-name" (symbol-name x))
-            (ert-fail (format "Structure function `%s' still exists" x)))))
-    ;; There shouldn't be left a hook function containing a Tramp
-    ;; function.  We do not regard the Tramp unload hooks.
-    (mapatoms
-     (lambda (x)
-       (and (boundp x)
-           (string-match "-\\(hook\\|function\\)s?$" (symbol-name x))
-           (not (string-match "unload-hook$" (symbol-name x)))
-           (consp (symbol-value x))
-           (ignore-errors (all-completions "tramp" (symbol-value x)))
-           (ert-fail (format "Hook `%s' still contains Tramp function" x)))))))
+  ;; We have autoloaded objects from tramp.el and tramp-archive.el.
+  ;; In order to remove them, we first need to load both packages.
+  (require 'tramp)
+  (require 'tramp-archive)
+  (should (featurep 'tramp))
+  (should (featurep 'tramp-archive))
+  ;; This unloads also tramp-archive.el and tramp-theme.el if needed.
+  (unload-feature 'tramp 'force)
+  ;; No Tramp feature must be left.
+  (should-not (featurep 'tramp))
+  (should-not (featurep 'tramp-archive))
+  (should-not (featurep 'tramp-theme))
+  (should-not
+   (all-completions
+    "tramp" (delq 'tramp-tests (delq 'tramp-archive-tests features))))
+  ;; `file-name-handler-alist' must be clean.
+  (should-not (all-completions "tramp" (mapcar 'cdr file-name-handler-alist)))
+  ;; There shouldn't be left a bound symbol, except buffer-local
+  ;; variables, and autoload functions.  We do not regard our test
+  ;; symbols, and the Tramp unload hooks.
+  (mapatoms
+   (lambda (x)
+     (and (or (and (boundp x) (null (local-variable-if-set-p x)))
+             (and (functionp x) (null (autoloadp (symbol-function x)))))
+         (string-match "^tramp" (symbol-name x))
+         (not (string-match "^tramp\\(-archive\\)?--?test" (symbol-name x)))
+         (not (string-match "unload-hook$" (symbol-name x)))
+         (ert-fail (format "`%s' still bound" x)))))
+  ;; The defstruct `tramp-file-name' and all its internal functions
+  ;; shall be purged.
+  (should-not (cl--find-class 'tramp-file-name))
+  (mapatoms
+   (lambda (x)
+     (and (functionp x)
+          (string-match "tramp-file-name" (symbol-name x))
+          (ert-fail (format "Structure function `%s' still exists" x)))))
+  ;; There shouldn't be left a hook function containing a Tramp
+  ;; function.  We do not regard the Tramp unload hooks.
+  (mapatoms
+   (lambda (x)
+     (and (boundp x)
+         (string-match "-\\(hook\\|function\\)s?$" (symbol-name x))
+         (not (string-match "unload-hook$" (symbol-name x)))
+         (consp (symbol-value x))
+         (ignore-errors (all-completions "tramp" (symbol-value x)))
+         (ert-fail (format "Hook `%s' still contains Tramp function" x))))))
 
 (defun tramp-test-all (&optional interactive)
   "Run all tests for \\[tramp]."
@@ -5321,7 +5333,7 @@ Since it unloads Tramp, it shall be the last test to run."
 ;; * Fix `tramp-test05-expand-file-name-relative' in `expand-file-name'.
 ;; * Fix `tramp-test06-directory-file-name' for `ftp'.
 ;; * Investigate, why `tramp-test11-copy-file' and `tramp-test12-rename-file'
-;;   do not work properly for `owncloud'.
+;;   do not work properly for `nextcloud'.
 ;; * Fix `tramp-test29-start-file-process' on MS Windows (`process-send-eof'?).
 ;; * Fix `tramp-test30-interrupt-process', timeout doesn't work reliably.
 ;; * Fix Bug#16928 in `tramp-test42-asynchronous-requests'.
diff --git a/test/lisp/shadowfile-tests.el b/test/lisp/shadowfile-tests.el
index 085ab47..3bab22f 100644
--- a/test/lisp/shadowfile-tests.el
+++ b/test/lisp/shadowfile-tests.el
@@ -63,6 +63,14 @@
       (format "/mock::%s" temporary-file-directory)))
   "Temporary directory for Tramp tests.")
 
+(setq password-cache-expiry nil
+      tramp-verbose 0
+      tramp-message-show-message nil)
+
+;; This should happen on hydra only.
+(when (getenv "EMACS_HYDRA_CI")
+  (add-to-list 'tramp-remote-path 'tramp-own-remote-path))
+
 (defconst shadow-test-info-file
   (expand-file-name "shadows_test" temporary-file-directory)
   "File to keep shadow information in during tests.")
@@ -618,7 +626,7 @@ guaranteed by the originator of a cluster definition."
                  shadow-test-remote-temporary-file-directory))
                mocked-input `(,cluster1 ,file1 ,cluster2 ,file2 ,(kbd "RET")))
          (with-temp-buffer
-           (setq-local buffer-file-name file1)
+            (set-visited-file-name file1)
            (call-interactively 'shadow-define-literal-group))
 
           ;; `shadow-literal-groups' is a list of lists.
@@ -679,7 +687,7 @@ guaranteed by the originator of a cluster definition."
                mocked-input `(,(shadow-regexp-superquote file)
                                ,cluster1 ,cluster2 ,(kbd "RET")))
          (with-temp-buffer
-           (setq-local buffer-file-name nil)
+            (set-visited-file-name nil)
            (call-interactively 'shadow-define-regexp-group))
 
           ;; `shadow-regexp-groups' is a list of lists.
@@ -718,7 +726,6 @@ guaranteed by the originator of a cluster definition."
         shadow-files-to-copy
        cluster1 cluster2 primary regexp file)
     (unwind-protect
-        (condition-case err
         (progn
          ;; Cleanup.
          (when (file-exists-p shadow-info-file)
@@ -726,7 +733,6 @@ guaranteed by the originator of a cluster definition."
          (when (file-exists-p shadow-todo-file)
            (delete-file shadow-todo-file))
 
-          (message "Point 1")
           ;; Define clusters.
          (setq cluster1 "cluster1"
                primary shadow-system-name
@@ -739,7 +745,6 @@ guaranteed by the originator of a cluster definition."
                regexp (shadow-regexp-superquote primary))
          (shadow-set-cluster cluster2 primary regexp)
 
-          (message "Point 2")
          ;; Define a literal group.
          (setq file
                (make-temp-name
@@ -747,35 +752,21 @@ guaranteed by the originator of a cluster definition."
                 shadow-literal-groups
                 `((,(concat "/cluster1:" file) ,(concat "/cluster2:" file))))
 
-          (message "Point 3")
           ;; Save file from "cluster1" definition.
           (with-temp-buffer
-            (setq buffer-file-name file)
+            (set-visited-file-name file)
             (insert "foo")
             (save-buffer))
-          (message "%s" file)
-          (message "%s" (shadow-contract-file-name (concat "/cluster2:" file)))
-          (message "%s" shadow-files-to-copy)
          (should
            (member
             (cons file (shadow-contract-file-name (concat "/cluster2:" file)))
             shadow-files-to-copy))
 
-          (message "Point 4")
           ;; Save file from "cluster2" definition.
           (with-temp-buffer
-            (message "Point 4.1")
-            (message "%s" file)
-            (message "%s" (shadow-site-primary cluster2))
-            (setq buffer-file-name (concat (shadow-site-primary cluster2) 
file))
-            (message "Point 4.2")
+            (set-visited-file-name (concat (shadow-site-primary cluster2) 
file))
             (insert "foo")
-            (message "%s" buffer-file-name)
             (save-buffer))
-          (message "Point 4.3")
-          (message "%s" (shadow-site-primary cluster2))
-          (message "%s" (shadow-contract-file-name (concat "/cluster1:" file)))
-          (message "%s" shadow-files-to-copy)
          (should
            (member
             (cons
@@ -783,7 +774,6 @@ guaranteed by the originator of a cluster definition."
              (shadow-contract-file-name (concat "/cluster1:" file)))
             shadow-files-to-copy))
 
-          (message "Point 5")
          ;; Define a regexp group.
          (setq shadow-files-to-copy nil
                 shadow-regexp-groups
@@ -792,10 +782,9 @@ guaranteed by the originator of a cluster definition."
                    ,(concat (shadow-site-primary cluster2)
                             (shadow-regexp-superquote file)))))
 
-          (message "Point 6")
           ;; Save file from "cluster1" definition.
           (with-temp-buffer
-            (setq buffer-file-name file)
+            (set-visited-file-name file)
             (insert "foo")
             (save-buffer))
          (should
@@ -803,10 +792,9 @@ guaranteed by the originator of a cluster definition."
             (cons file (shadow-contract-file-name (concat "/cluster2:" file)))
             shadow-files-to-copy))
 
-          (message "Point 7")
           ;; Save file from "cluster2" definition.
           (with-temp-buffer
-            (setq buffer-file-name (concat (shadow-site-primary cluster2) 
file))
+            (set-visited-file-name (concat (shadow-site-primary cluster2) 
file))
             (insert "foo")
             (save-buffer))
          (should
@@ -815,7 +803,6 @@ guaranteed by the originator of a cluster definition."
              (concat (shadow-site-primary cluster2) file)
              (shadow-contract-file-name (concat "/cluster1:" file)))
             shadow-files-to-copy)))
-        (error (message "Error: %s" err) (signal (car err) (cdr err))))
 
       ;; Cleanup.
       (when (file-exists-p shadow-info-file)
@@ -833,6 +820,7 @@ guaranteed by the originator of a cluster definition."
   "Check that needed shadow files are copied."
   (skip-unless (not (memq system-type '(windows-nt ms-dos))))
   (skip-unless (file-remote-p shadow-test-remote-temporary-file-directory))
+  (skip-unless (file-writable-p shadow-test-remote-temporary-file-directory))
 
   (let ((backup-inhibited t)
         (shadow-info-file shadow-test-info-file)
@@ -879,11 +867,11 @@ guaranteed by the originator of a cluster definition."
 
           ;; Save files.
           (with-temp-buffer
-            (setq buffer-file-name file)
+            (set-visited-file-name file)
             (insert "foo")
             (save-buffer))
           (with-temp-buffer
-            (setq buffer-file-name (concat (shadow-site-primary cluster2) 
file))
+            (set-visited-file-name (concat (shadow-site-primary cluster2) 
file))
             (insert "foo")
             (save-buffer))
 
diff --git a/test/lisp/thingatpt-tests.el b/test/lisp/thingatpt-tests.el
index cfb57de..b4a5fd9 100644
--- a/test/lisp/thingatpt-tests.el
+++ b/test/lisp/thingatpt-tests.el
@@ -65,7 +65,10 @@
     ("http://example.com/ab)c" 4 url "http://example.com/ab)c")
     ;; URL markup, lacking schema
     ("<url:address@hidden>" 1 url "mailto:address@hidden";)
-    ("<url:ftp.example.net/abc/>" 1 url "ftp://ftp.example.net/abc/";))
+    ("<url:ftp.example.net/abc/>" 1 url "ftp://ftp.example.net/abc/";)
+    ;; UUID, only hex is allowed
+    ("01234567-89ab-cdef-ABCD-EF0123456789" 1 uuid 
"01234567-89ab-cdef-ABCD-EF0123456789")
+    ("01234567-89ab-cdef-ABCD-EF012345678G" 1 uuid nil))
   "List of thing-at-point tests.
 Each list element should have the form
 
diff --git a/test/lisp/wdired-tests.el b/test/lisp/wdired-tests.el
index b4ef4ab..f1ec4af 100644
--- a/test/lisp/wdired-tests.el
+++ b/test/lisp/wdired-tests.el
@@ -116,13 +116,13 @@ wdired-mode."
            (kill-region (point) (progn (search-forward ".")
                                        (forward-char -1) (point)))
            (insert replace)
-           (should (equal (dired-get-filename) new-file))))
+           (should (equal (dired-get-filename) new-file)))
        (when buf
          (with-current-buffer buf
             ;; Prevent kill-buffer-query-functions from chiming in.
            (set-buffer-modified-p nil)
            (kill-buffer buf)))
-       (delete-directory test-dir t))))
+       (delete-directory test-dir t)))))
 
 
 (provide 'wdired-tests)
diff --git a/test/src/data-tests.el b/test/src/data-tests.el
index 3cd5378..a4c6b0e 100644
--- a/test/src/data-tests.el
+++ b/test/src/data-tests.el
@@ -23,13 +23,21 @@
 
 (require 'cl-lib)
 
+(defconst data-tests--float-greater-than-fixnums (+ 1.0 most-positive-fixnum)
+  "A floating-point value that is greater than all fixnums.
+It is also as small as conveniently possible, to make the tests sharper.
+Adding 1.0 to most-positive-fixnum should suffice on all
+practical Emacs platforms, since the result is a power of 2 and
+this is exactly representable and is greater than
+most-positive-fixnum, which is just less than a power of 2.")
+
 (ert-deftest data-tests-= ()
   (should-error (=))
   (should (= 1))
   (should (= 2 2))
   (should (= 9 9 9 9 9 9 9 9 9))
   (should (= most-negative-fixnum (float most-negative-fixnum)))
-  (should-not (= most-positive-fixnum (+ 1.0 most-positive-fixnum)))
+  (should-not (= most-positive-fixnum data-tests--float-greater-than-fixnums))
   (should-not (apply #'= '(3 8 3)))
   (should-error (= 9 9 'foo))
   ;; Short circuits before getting to bad arg
@@ -40,7 +48,7 @@
   (should (< 1))
   (should (< 2 3))
   (should (< -6 -1 0 2 3 4 8 9 999))
-  (should (< 0.5 most-positive-fixnum (+ 1.0 most-positive-fixnum)))
+  (should (< 0.5 most-positive-fixnum data-tests--float-greater-than-fixnums))
   (should-not (apply #'< '(3 8 3)))
   (should-error (< 9 10 'foo))
   ;; Short circuits before getting to bad arg
@@ -51,7 +59,7 @@
   (should (> 1))
   (should (> 3 2))
   (should (> 6 1 0 -2 -3 -4 -8 -9 -999))
-  (should (> (+ 1.0 most-positive-fixnum) most-positive-fixnum 0.5))
+  (should (> data-tests--float-greater-than-fixnums most-positive-fixnum 0.5))
   (should-not (apply #'> '(3 8 3)))
   (should-error (> 9 8 'foo))
   ;; Short circuits before getting to bad arg
@@ -62,7 +70,7 @@
   (should (<= 1))
   (should (<= 2 3))
   (should (<= -6 -1 -1 0 0 0 2 3 4 8 999))
-  (should (<= 0.5 most-positive-fixnum (+ 1.0 most-positive-fixnum)))
+  (should (<= 0.5 most-positive-fixnum data-tests--float-greater-than-fixnums))
   (should-not (apply #'<= '(3 8 3 3)))
   (should-error (<= 9 10 'foo))
   ;; Short circuits before getting to bad arg
@@ -73,7 +81,7 @@
   (should (>= 1))
   (should (>= 3 2))
   (should (>= 666 1 0 0 -2 -3 -3 -3 -4 -8 -8 -9 -999))
-  (should (>= (+ 1.0 most-positive-fixnum) most-positive-fixnum))
+  (should (>= data-tests--float-greater-than-fixnums most-positive-fixnum))
   (should-not (apply #'>= '(3 8 3)))
   (should-error (>= 9 8 'foo))
   ;; Short circuits before getting to bad arg
@@ -97,7 +105,7 @@
   (should (= 2 (min 3 2)))
   (should (= -999 (min 666 1 0 0 -2 -3 -3 -3 -4 -8 -8 -9 -999)))
   (should (= most-positive-fixnum
-             (min (+ 1.0 most-positive-fixnum) most-positive-fixnum)))
+             (min data-tests--float-greater-than-fixnums 
most-positive-fixnum)))
   (should (= 3 (apply #'min '(3 8 3))))
   (should-error (min 9 8 'foo))
   (should-error (min (make-marker)))
@@ -105,7 +113,9 @@
   (should (isnan (min 0.0e+NaN)))
   (should (isnan (min 0.0e+NaN 1 2)))
   (should (isnan (min 1.0 0.0e+NaN)))
-  (should (isnan (min 1.0 0.0e+NaN 1.1))))
+  (should (isnan (min 1.0 0.0e+NaN 1.1)))
+  (should (isnan (min 1.0 0.0e+NaN 1.1 (1+ most-positive-fixnum))))
+  (should (isnan (max 1.0 0.0e+NaN 1.1 (1+ most-positive-fixnum)))))
 
 (defun data-tests-popcnt (byte)
   "Calculate the Hamming weight of BYTE."
@@ -515,4 +525,123 @@ comparing the subr with a much slower lisp 
implementation."
                        (bound-and-true-p data-tests-foo2)
                        (bound-and-true-p data-tests-foo3)))))))
 
+(ert-deftest data-tests-bignum ()
+  (should (bignump (+ most-positive-fixnum 1)))
+  (let ((f0 (+ (float most-positive-fixnum) 1))
+        (f-1 (- (float most-negative-fixnum) 1))
+        (b0 (+ most-positive-fixnum 1))
+        (b-1 (- most-negative-fixnum 1)))
+    (should (> b0 -1))
+    (should (> b0 f-1))
+    (should (> b0 b-1))
+    (should (>= b0 -1))
+    (should (>= b0 f-1))
+    (should (>= b0 b-1))
+    (should (>= b-1 b-1))
+
+    (should (< -1 b0))
+    (should (< f-1 b0))
+    (should (< b-1 b0))
+    (should (<= -1 b0))
+    (should (<= f-1 b0))
+    (should (<= b-1 b0))
+    (should (<= b-1 b-1))
+
+    (should (= b0 f0))
+    (should (= b0 b0))
+
+    (should (/= b0 f-1))
+    (should (/= b0 b-1))))
+
+(ert-deftest data-tests-+ ()
+  (should-not (fixnump (+ most-positive-fixnum most-positive-fixnum)))
+  (should (> (+ most-positive-fixnum most-positive-fixnum) 
most-positive-fixnum))
+  (should (eq (- (+ most-positive-fixnum most-positive-fixnum)
+                 (+ most-positive-fixnum most-positive-fixnum))
+              0)))
+
+(ert-deftest data-tests-/ ()
+  (let* ((x (* most-positive-fixnum 8))
+         (y (* most-negative-fixnum 8))
+         (z (- y)))
+    (should (= most-positive-fixnum (/ x 8)))
+    (should (= most-negative-fixnum (/ y 8)))
+    (should (= -1 (/ y z)))
+    (should (= -1 (/ z y)))
+    (should (= 0 (/ x (* 2 x))))
+    (should (= 0 (/ y (* 2 y))))
+    (should (= 0 (/ z (* 2 z))))))
+
+(ert-deftest data-tests-number-predicates ()
+  (should (fixnump 0))
+  (should (fixnump most-negative-fixnum))
+  (should (fixnump most-positive-fixnum))
+  (should (integerp (+ most-positive-fixnum 1)))
+  (should (integer-or-marker-p (+ most-positive-fixnum 1)))
+  (should (numberp (+ most-positive-fixnum 1)))
+  (should (number-or-marker-p (+ most-positive-fixnum 1)))
+  (should (natnump (+ most-positive-fixnum 1)))
+  (should-not (fixnump (+ most-positive-fixnum 1)))
+  (should (bignump (+ most-positive-fixnum 1))))
+
+(ert-deftest data-tests-number-to-string ()
+  (let* ((s "99999999999999999999999999999")
+         (v (read s)))
+    (should (equal (number-to-string v) s))))
+
+(ert-deftest data-tests-1+ ()
+  (should (> (1+ most-positive-fixnum) most-positive-fixnum))
+  (should (fixnump (1+ (1- most-negative-fixnum)))))
+
+(ert-deftest data-tests-1- ()
+  (should (< (1- most-negative-fixnum) most-negative-fixnum))
+  (should (fixnump (1- (1+ most-positive-fixnum)))))
+
+(ert-deftest data-tests-logand ()
+  (should (= -1 (logand -1)))
+  (let ((n (* 2 most-negative-fixnum)))
+    (should (= (logand -1 n) n))))
+
+(ert-deftest data-tests-logcount ()
+  (should (= (logcount (read "#xffffffffffffffffffffffffffffffff")) 128)))
+
+(ert-deftest data-tests-logior ()
+  (should (= -1 (logior -1)))
+  (should (= -1 (logior most-positive-fixnum most-negative-fixnum))))
+
+(ert-deftest data-tests-logxor ()
+  (should (= -1 (logxor -1)))
+  (let ((n (1+ most-positive-fixnum)))
+    (should (= (logxor -1 n) (lognot n)))))
+
+(ert-deftest data-tests-minmax ()
+  (let ((a (- most-negative-fixnum 1))
+        (b (+ most-positive-fixnum 1))
+        (c 0))
+    (should (= (min a b c) a))
+    (should (= (max a b c) b))))
+
+(defun data-tests-check-sign (x y)
+  (should (eq (cl-signum x) (cl-signum y))))
+
+(ert-deftest data-tests-%-mod ()
+  (let* ((b1 (+ most-positive-fixnum 1))
+         (nb1 (- b1))
+         (b3 (+ most-positive-fixnum 3))
+         (nb3 (- b3)))
+    (data-tests-check-sign (% 1 3) (% b1 b3))
+    (data-tests-check-sign (mod 1 3) (mod b1 b3))
+    (data-tests-check-sign (% 1 -3) (% b1 nb3))
+    (data-tests-check-sign (mod 1 -3) (mod b1 nb3))
+    (data-tests-check-sign (% -1 3) (% nb1 b3))
+    (data-tests-check-sign (mod -1 3) (mod nb1 b3))
+    (data-tests-check-sign (% -1 -3) (% nb1 nb3))
+    (data-tests-check-sign (mod -1 -3) (mod nb1 nb3))))
+
+(ert-deftest data-tests-ash-lsh ()
+  (should (= (ash most-negative-fixnum 1)
+             (* most-negative-fixnum 2)))
+  (should (= (lsh most-negative-fixnum 1)
+             (* most-negative-fixnum 2))))
+
 ;;; data-tests.el ends here
diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el
index 2951270..964ff08 100644
--- a/test/src/editfns-tests.el
+++ b/test/src/editfns-tests.el
@@ -88,7 +88,21 @@
            (format "%-10s" (concat (propertize "01" 'face 'bold)
                                    (propertize "23" 'face 'underline)
                                    (propertize "45" 'face 'italic)))
-           #("012345    " 0 2 (face bold) 2 4 (face underline) 4 10 (face 
italic)))))
+           #("012345    "
+             0 2 (face bold) 2 4 (face underline) 4 10 (face italic))))
+  ;; Bug #32404
+  (should (ert-equal-including-properties
+           (format (concat (propertize "%s" 'face 'bold)
+                           ""
+                           (propertize "%s" 'face 'error))
+                   "foo" "bar")
+           #("foobar" 0 3 (face bold) 3 6 (face error))))
+  (should (ert-equal-including-properties
+           (format (concat "%s" (propertize "%s" 'face 'error)) "foo" "bar")
+           #("foobar" 3 6 (face error))))
+  (should (ert-equal-including-properties
+           (format (concat "%s " (propertize "%s" 'face 'error)) "foo" "bar")
+           #("foo bar" 4 7 (face error)))))
 
 ;; Tests for bug#5131.
 (defun transpose-test-reverse-word (start end)
@@ -159,20 +173,23 @@
   (should-error (format "%x" 18446744073709551616.0)
                 :type 'overflow-error))
 (ert-deftest read-large-integer ()
-  (should-error (read (format "%d0" most-negative-fixnum))
-                :type 'overflow-error)
-  (should-error (read (format "%+d" (* -8.0 most-negative-fixnum)))
-                :type 'overflow-error)
-  (should-error (read (substring (format "%d" most-negative-fixnum) 1))
-                :type 'overflow-error)
+  (should (eq (type-of (read (format "%d0" most-negative-fixnum))) 'integer))
+  (should (eq (type-of (read (format "%+d" (* -8.0 most-negative-fixnum))))
+              'integer))
+  (should (eq (type-of (read (substring (format "%d" most-negative-fixnum) 1)))
+              'integer))
+  (should (eq (type-of (read (format "#x%x" most-negative-fixnum)))
+              'integer))
+  (should (eq (type-of (read (format "#o%o" most-negative-fixnum)))
+              'integer))
+  (should (eq (type-of (read (format "#32rG%x" most-positive-fixnum)))
+              'integer))
   (let ((binary-as-unsigned nil))
     (dolist (fmt '("%d" "%s" "#o%o" "#x%x"))
       (dolist (val (list most-negative-fixnum (1+ most-negative-fixnum)
                          -1 0 1
                          (1- most-positive-fixnum) most-positive-fixnum))
-        (should (eq val (read (format fmt val)))))))
-  (should-error (read (format "#32rG%x" most-positive-fixnum))
-                :type 'overflow-error))
+        (should (eq val (read (format fmt val))))))))
 
 (ert-deftest format-%o-invalid-float ()
   (should-error (format "%o" -1e-37)
@@ -360,4 +377,14 @@
     (should (eq (type-of (car (nth 4 buffer-undo-list))) 'marker))
     (garbage-collect)))
 
+(ert-deftest format-bignum ()
+  (let* ((s1 "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")
+         (v1 (read (concat "#x" s1)))
+         (s2 "99999999999999999999999999999999")
+         (v2 (read s2)))
+    (should (> v1 most-positive-fixnum))
+    (should (equal (format "%X" v1) s1))
+    (should (> v2 most-positive-fixnum))
+    (should (equal (format "%d" v2) s2))))
+
 ;;; editfns-tests.el ends here
diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el
index 9ef5a47..90cd37a 100644
--- a/test/src/emacs-module-tests.el
+++ b/test/src/emacs-module-tests.el
@@ -68,10 +68,10 @@
                (1+ #x1fffffff)))
     (should (= (mod-test-sum -1 (1+ #x1fffffff))
                #x1fffffff)))
-  (should-error (mod-test-sum 1 most-positive-fixnum)
-                :type 'overflow-error)
-  (should-error (mod-test-sum -1 most-negative-fixnum)
-                :type 'overflow-error))
+  (should (= (mod-test-sum 1 most-positive-fixnum)
+             (1+ most-positive-fixnum)))
+  (should (= (mod-test-sum -1 most-negative-fixnum)
+             (1- most-negative-fixnum))))
 
 (ert-deftest mod-test-sum-docstring ()
   (should (string= (documentation 'mod-test-sum) "Return A + B\n\n(fn a b)")))
diff --git a/test/src/floatfns-tests.el b/test/src/floatfns-tests.el
index cb173ee..7714c05 100644
--- a/test/src/floatfns-tests.el
+++ b/test/src/floatfns-tests.el
@@ -34,4 +34,16 @@
   (should-error (ftruncate 0) :type 'wrong-type-argument)
   (should-error (fround 0) :type 'wrong-type-argument))
 
+(ert-deftest bignum-to-float ()
+  (should (eql (float (+ most-positive-fixnum 1))
+               (+ (float most-positive-fixnum) 1))))
+
+(ert-deftest bignum-abs ()
+  (should (= most-positive-fixnum
+             (- (abs most-negative-fixnum) 1))))
+
+(ert-deftest bignum-logb ()
+  (should (= (+ (logb most-positive-fixnum) 1)
+             (logb (+ most-positive-fixnum 1)))))
+
 (provide 'floatfns-tests)
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el
index e4b9cbe..f722ed6 100644
--- a/test/src/fns-tests.el
+++ b/test/src/fns-tests.el
@@ -604,4 +604,24 @@
   (should (equal 1 (string-distance "ab" "a我b")))
   (should (equal 1 (string-distance "我" "她"))))
 
+(ert-deftest test-bignum-eql ()
+  "Test that `eql' works for bignums."
+  (let ((x (+ most-positive-fixnum 1))
+        (y (+ most-positive-fixnum 1)))
+    (should (eq x x))
+    (should (eql x y))
+    (should (equal x y))
+    (should-not (eql x 0.0e+NaN))))
+
+(ert-deftest test-bignum-hash ()
+  "Test that hash tables work for bignums."
+  ;; Make two bignums that are eql but not eq.
+  (let ((b1 (1+ most-positive-fixnum))
+        (b2 (1+ most-positive-fixnum)))
+    (dolist (test '(eq eql equal))
+      (let ((hash (make-hash-table :test test)))
+        (puthash b1 t hash)
+        (should (eq (gethash b2 hash)
+                    (funcall test b1 b2)))))))
+
 (provide 'fns-tests)
diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el
index 639a6da..1738134 100644
--- a/test/src/lread-tests.el
+++ b/test/src/lread-tests.el
@@ -195,9 +195,7 @@ literals (Bug#20852)."
     (should (eq x (cdr x)))))
 
 (ert-deftest lread-long-hex-integer ()
-  (should-error
-   (read 
"#xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")
-   :type 'overflow-error))
+  (should (bignump (read 
"#xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"))))
 
 (ert-deftest lread-test-bug-31186 ()
   (with-temp-buffer
diff --git a/test/src/print-tests.el b/test/src/print-tests.el
index c96cb5d..091f1aa 100644
--- a/test/src/print-tests.el
+++ b/test/src/print-tests.el
@@ -98,5 +98,11 @@ otherwise, use a different charset."
   (let ((sym '\’bar))
     (should (eq (read (prin1-to-string sym)) sym))))
 
+(ert-deftest print-bignum ()
+  (let* ((str "999999999999999999999999999999999")
+         (val (read str)))
+    (should (> val most-positive-fixnum))
+    (should (equal (prin1-to-string val) str))))
+
 (provide 'print-tests)
 ;;; print-tests.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]