1.0.18.2: more conservative interval artihmetic
[sbcl.git] / src / compiler / generic / early-vm.lisp
1 ;;;; This software is part of the SBCL system. See the README file for
2 ;;;; more information.
3 ;;;;
4 ;;;; This software is derived from the CMU CL system, which was
5 ;;;; written at Carnegie Mellon University and released into the
6 ;;;; public domain. The software is in the public domain and is
7 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
8 ;;;; files for more information.
9
10 (in-package "SB!VM")
11
12 ;;; the number of bits at the low end of a pointer used for type
13 ;;; information
14 (def!constant n-lowtag-bits
15   (integer-length (1- (/ (* 2 n-word-bits) n-byte-bits))))
16 ;;; a mask to extract the low tag bits from a pointer
17 (def!constant lowtag-mask (1- (ash 1 n-lowtag-bits)))
18 ;;; the exclusive upper bound on the value of the low tag bits from a
19 ;;; pointer
20 (def!constant lowtag-limit (ash 1 n-lowtag-bits))
21 ;;; the number of tag bits used for a fixnum
22 (def!constant n-fixnum-tag-bits (1- n-lowtag-bits))
23 ;;; the fixnum tag mask
24 (def!constant fixnum-tag-mask (1- (ash 1 n-fixnum-tag-bits)))
25 ;;; the bit width of positive fixnums
26 (def!constant n-positive-fixnum-bits (- n-word-bits n-fixnum-tag-bits 1))
27
28 ;;; the number of bits to shift between word addresses and byte addresses
29 (def!constant word-shift (1- (integer-length (/ n-word-bits n-byte-bits))))
30
31 ;;; the number of bytes in a word
32 (def!constant n-word-bytes (/ n-word-bits n-byte-bits))
33
34 ;;; the number of bits used in the header word of a data block to store
35 ;;; the type
36 (def!constant n-widetag-bits 8)
37 ;;; a mask to extract the type from a data block header word
38 (def!constant widetag-mask (1- (ash 1 n-widetag-bits)))
39
40 (def!constant sb!xc:most-positive-fixnum
41     (1- (ash 1 (- n-word-bits n-lowtag-bits)))
42   #!+sb-doc
43   "the fixnum closest in value to positive infinity")
44 (def!constant sb!xc:most-negative-fixnum
45     (ash -1 (- n-word-bits n-lowtag-bits))
46   #!+sb-doc
47   "the fixnum closest in value to negative infinity")
48
49 (def!constant most-positive-exactly-single-float-fixnum
50   (min #xffffff most-positive-fixnum))
51 (def!constant most-negative-exactly-single-float-fixnum
52   (max #x-ffffff most-negative-fixnum))
53 (def!constant most-positive-exactly-double-float-fixnum
54   (min #x1fffffffffffff most-positive-fixnum))
55 (def!constant most-negative-exactly-double-float-fixnum
56   (max #x-1fffffffffffff most-negative-fixnum))