/[cmucl]/src/code/sap.lisp
ViewVC logotype

Diff of /src/code/sap.lisp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.22 by rtoy, Fri Mar 19 15:18:59 2010 UTC revision 1.23 by rtoy, Mon Apr 19 02:18:04 2010 UTC
# Line 36  Line 36 
36  ;;;; Primitive SAP operations.  ;;;; Primitive SAP operations.
37    
38  (defun sap< (x y)  (defun sap< (x y)
39    _N"Return T iff the SAP X points to a smaller address then the SAP Y."    "Return T iff the SAP X points to a smaller address then the SAP Y."
40    (declare (type system-area-pointer x y))    (declare (type system-area-pointer x y))
41    (sap< x y))    (sap< x y))
42    
43  (defun sap<= (x y)  (defun sap<= (x y)
44    _N"Return T iff the SAP X points to a smaller or the same address as    "Return T iff the SAP X points to a smaller or the same address as
45     the SAP Y."     the SAP Y."
46    (declare (type system-area-pointer x y))    (declare (type system-area-pointer x y))
47    (sap<= x y))    (sap<= x y))
48    
49  (defun sap= (x y)  (defun sap= (x y)
50    _N"Return T iff the SAP X points to the same address as the SAP Y."    "Return T iff the SAP X points to the same address as the SAP Y."
51    (declare (type system-area-pointer x y))    (declare (type system-area-pointer x y))
52    (sap= x y))    (sap= x y))
53    
54  (defun sap>= (x y)  (defun sap>= (x y)
55    _N"Return T iff the SAP X points to a larger or the same address as    "Return T iff the SAP X points to a larger or the same address as
56     the SAP Y."     the SAP Y."
57    (declare (type system-area-pointer x y))    (declare (type system-area-pointer x y))
58    (sap>= x y))    (sap>= x y))
59    
60  (defun sap> (x y)  (defun sap> (x y)
61    _N"Return T iff the SAP X points to a larger address then the SAP Y."    "Return T iff the SAP X points to a larger address then the SAP Y."
62    (declare (type system-area-pointer x y))    (declare (type system-area-pointer x y))
63    (sap> x y))    (sap> x y))
64    
65  (defun sap+ (sap offset)  (defun sap+ (sap offset)
66    _N"Return a new sap OFFSET bytes from SAP."    "Return a new sap OFFSET bytes from SAP."
67    (declare (type system-area-pointer sap)    (declare (type system-area-pointer sap)
68             (type (signed-byte #-alpha #.vm:word-bits #+alpha 64) offset))             (type (signed-byte #-alpha #.vm:word-bits #+alpha 64) offset))
69    (sap+ sap offset))    (sap+ sap offset))
70    
71  (defun sap- (sap1 sap2)  (defun sap- (sap1 sap2)
72    _N"Return the byte offset between SAP1 and SAP2."    "Return the byte offset between SAP1 and SAP2."
73    (declare (type system-area-pointer sap1 sap2))    (declare (type system-area-pointer sap1 sap2))
74    (sap- sap1 sap2))    (sap- sap1 sap2))
75    
76  (defun sap-int (sap)  (defun sap-int (sap)
77    _N"Converts a System Area Pointer into an integer."    "Converts a System Area Pointer into an integer."
78    (declare (type system-area-pointer sap))    (declare (type system-area-pointer sap))
79    (sap-int sap))    (sap-int sap))
80    
81  (defun int-sap (int)  (defun int-sap (int)
82    _N"Converts an integer into a System Area Pointer."    "Converts an integer into a System Area Pointer."
83    (declare (type (unsigned-byte #-alpha #.vm:word-bits #+alpha 64) int))    (declare (type (unsigned-byte #-alpha #.vm:word-bits #+alpha 64) int))
84    (int-sap int))    (int-sap int))
85    
86  (defun sap-ref-8 (sap offset)  (defun sap-ref-8 (sap offset)
87    _N"Returns the 8-bit byte at OFFSET bytes from SAP."    "Returns the 8-bit byte at OFFSET bytes from SAP."
88    (declare (type system-area-pointer sap)    (declare (type system-area-pointer sap)
89             (type (signed-byte #-alpha #.vm:word-bits #+alpha 64) offset))             (type (signed-byte #-alpha #.vm:word-bits #+alpha 64) offset))
90    (sap-ref-8 sap offset))    (sap-ref-8 sap offset))
91    
92  (defun sap-ref-16 (sap offset)  (defun sap-ref-16 (sap offset)
93    _N"Returns the 16-bit word at OFFSET bytes from SAP."    "Returns the 16-bit word at OFFSET bytes from SAP."
94    (declare (type system-area-pointer sap)    (declare (type system-area-pointer sap)
95             (type (signed-byte #-alpha #.(1- vm:word-bits) #+alpha 63) offset))             (type (signed-byte #-alpha #.(1- vm:word-bits) #+alpha 63) offset))
96    (sap-ref-16 sap offset))    (sap-ref-16 sap offset))
97    
98  (defun sap-ref-32 (sap offset)  (defun sap-ref-32 (sap offset)
99    _N"Returns the 32-bit dualword at OFFSET bytes from SAP."    "Returns the 32-bit dualword at OFFSET bytes from SAP."
100    (declare (type system-area-pointer sap)    (declare (type system-area-pointer sap)
101             (fixnum offset))             (fixnum offset))
102    (sap-ref-32 sap offset))    (sap-ref-32 sap offset))
103    
104  (defun sap-ref-64 (sap offset)  (defun sap-ref-64 (sap offset)
105    _N"Returns the 64-bit quadword at OFFSET bytes from SAP."    "Returns the 64-bit quadword at OFFSET bytes from SAP."
106    (declare (type system-area-pointer sap)    (declare (type system-area-pointer sap)
107             (fixnum offset))             (fixnum offset))
108    (sap-ref-64 sap offset))    (sap-ref-64 sap offset))
109    
110  (defun sap-ref-sap (sap offset)  (defun sap-ref-sap (sap offset)
111    _N"Returns the 32-bit system-area-pointer at OFFSET bytes from SAP."    "Returns the 32-bit system-area-pointer at OFFSET bytes from SAP."
112    (declare (type system-area-pointer sap)    (declare (type system-area-pointer sap)
113             (type (signed-byte #-alpha #.vm:word-bits #+alpha 64) offset))             (type (signed-byte #-alpha #.vm:word-bits #+alpha 64) offset))
114    (sap-ref-sap sap offset))    (sap-ref-sap sap offset))
115    
116  (defun sap-ref-single (sap offset)  (defun sap-ref-single (sap offset)
117    _N"Returns the 32-bit single-float at OFFSET bytes from SAP."    "Returns the 32-bit single-float at OFFSET bytes from SAP."
118    (declare (type system-area-pointer sap)    (declare (type system-area-pointer sap)
119             (fixnum offset))             (fixnum offset))
120    (sap-ref-single sap offset))    (sap-ref-single sap offset))
121    
122  (defun sap-ref-double (sap offset)  (defun sap-ref-double (sap offset)
123    _N"Returns the 64-bit double-float at OFFSET bytes from SAP."    "Returns the 64-bit double-float at OFFSET bytes from SAP."
124    (declare (type system-area-pointer sap)    (declare (type system-area-pointer sap)
125             (fixnum offset))             (fixnum offset))
126    (sap-ref-double sap offset))    (sap-ref-double sap offset))
# Line 133  Line 133 
133    (sap-ref-long sap offset))    (sap-ref-long sap offset))
134    
135  (defun signed-sap-ref-8 (sap offset)  (defun signed-sap-ref-8 (sap offset)
136    _N"Returns the signed 8-bit byte at OFFSET bytes from SAP."    "Returns the signed 8-bit byte at OFFSET bytes from SAP."
137    (declare (type system-area-pointer sap)    (declare (type system-area-pointer sap)
138             (type (signed-byte #-alpha #.vm:word-bits #+alpha 64) offset))             (type (signed-byte #-alpha #.vm:word-bits #+alpha 64) offset))
139    (signed-sap-ref-8 sap offset))    (signed-sap-ref-8 sap offset))
140    
141  (defun signed-sap-ref-16 (sap offset)  (defun signed-sap-ref-16 (sap offset)
142    _N"Returns the signed 16-bit word at OFFSET bytes from SAP."    "Returns the signed 16-bit word at OFFSET bytes from SAP."
143    (declare (type system-area-pointer sap)    (declare (type system-area-pointer sap)
144             (type (signed-byte #-alpha #.(1- vm:word-bits) #+alpha 63) offset))             (type (signed-byte #-alpha #.(1- vm:word-bits) #+alpha 63) offset))
145    (signed-sap-ref-16 sap offset))    (signed-sap-ref-16 sap offset))
146    
147  (defun signed-sap-ref-32 (sap offset)  (defun signed-sap-ref-32 (sap offset)
148    _N"Returns the signed 32-bit dualword at OFFSET bytes from SAP."    "Returns the signed 32-bit dualword at OFFSET bytes from SAP."
149    (declare (type system-area-pointer sap)    (declare (type system-area-pointer sap)
150             (fixnum offset))             (fixnum offset))
151    (signed-sap-ref-32 sap offset))    (signed-sap-ref-32 sap offset))
152    
153  (defun signed-sap-ref-64 (sap offset)  (defun signed-sap-ref-64 (sap offset)
154    _N"Returns the signed 64-bit quadword at OFFSET bytes from SAP."    "Returns the signed 64-bit quadword at OFFSET bytes from SAP."
155    (declare (type system-area-pointer sap)    (declare (type system-area-pointer sap)
156             (fixnum offset))             (fixnum offset))
157    (signed-sap-ref-64 sap offset))    (signed-sap-ref-64 sap offset))

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23

  ViewVC Help
Powered by ViewVC 1.1.5