;;; -*- Mode:LISP; Package:USER; Readtable:CL; Base:10. -*-

;;; This file contains support for letting the compiler run
;;; on the lambda.

(defmacro hw::unboxed-constant (n)
  (setq n (eval n))
  (if (or (typep n '(unsigned-byte 32.))
	  (typep n '(signed-byte 32.)))
      `'(HW::UNBOXED-CONSTANT ,(lisp:logand #xffffffff n))
      (error "This is not a 32 bit number: ~s" n)))

(defmacro hw::boxed-constant (n)
  (setq n (eval n))
  (if (typep n '(unsigned-byte 32.))
      `'(HW::BOXED-CONSTANT ,n)
      (error "This is not a 32 bit number: ~s" n)))

(zl:defsubst nlisp:dpb (value byte-spec word)
  (dpb value
       (byte (byte-size byte-spec)
	     (byte-position byte-spec))
       word))

(zl:defsubst nlisp:ldb (byte-spec word)
  (ldb (byte (byte-size byte-spec)
	     (byte-position byte-spec))
       word))
