1.0.2.1: DATA-VECTOR-{REF,SET}-WITH-OFFSET for the x86
[sbcl.git] / src / compiler / generic / utils.lisp
index 7095f61..1ebf85d 100644 (file)
   (if (fixnump num)
       (ash num (1- n-lowtag-bits))
       (error "~W is too big for a fixnum." num)))
+
+;;; Determining whether a constant offset fits in an addressing mode.
+#!+x86
+(defun foldable-constant-offset-p (element-size lowtag data-offset offset)
+  (if (< element-size n-byte-bits)
+      nil
+      (multiple-value-bind (min max)
+          (sb!impl::displacement-bounds lowtag element-size data-offset)
+        (<= min offset max))))
+
 \f
 ;;;; routines for dealing with static symbols