1 ;;;; cross-compile-time-only replacements for byte-specifier
4 ;;;; This software is part of the SBCL system. See the README file for
7 ;;;; This software is derived from the CMU CL system, which was
8 ;;;; written at Carnegie Mellon University and released into the
9 ;;;; public domain. The software is in the public domain and is
10 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
11 ;;;; files for more information.
15 (defun sb!xc:byte (size position)
18 (defun sb!xc:byte-size (cross-byte)
21 (defun sb!xc:byte-position (cross-byte)
24 (defun uncross-byte (cross-byte)
25 (cl:byte (sb!xc:byte-size cross-byte) (sb!xc:byte-position cross-byte)))
27 (defun sb!xc:ldb (cross-byte int)
28 (cl:ldb (uncross-byte cross-byte) int))
30 (defun sb!xc:ldb-test (cross-byte int)
31 (cl:ldb-test (uncross-byte cross-byte) int))
33 (defun sb!xc:dpb (new cross-byte int)
34 (cl:dpb new (uncross-byte cross-byte) int))
36 (defun sb!xc:mask-field (cross-byte int)
37 (cl:mask-field (uncross-byte cross-byte) int))
39 (defun sb!xc:deposit-field (new cross-byte int)
40 (cl:deposit-field new (uncross-byte cross-byte) int))
42 (define-setf-expander sb!xc:ldb (cross-byte int &environment env)
43 (multiple-value-bind (temps vals stores store-form access-form)
44 (get-setf-expansion int env)
46 (bug "SETF SB!XC:LDB too hairy!"))
47 (let ((btemp (gensym))
49 (values (cons btemp temps)
50 (cons cross-byte vals)
52 `(let ((,(car stores) (cl:dpb ,store (uncross-byte ,btemp) ,access-form)))
55 `(cl:ldb (uncross-byte ,btemp) ,access-form)))))
57 (define-setf-expander sb!xc:mask-field (cross-byte int &environment env)
58 (multiple-value-bind (temps vals stores store-form access-form)
59 (get-setf-expansion int env)
61 (bug "SETF SB!XC:MASK-FIELD too hairy!"))
62 (let ((btemp (gensym))
64 (values (cons btemp temps)
65 (cons cross-byte vals)
67 `(let ((,(car stores) (cl:deposit-field ,store (uncross-byte ,btemp) ,access-form)))
70 `(cl:mask-field (uncross-byte ,btemp) ,access-form)))))