X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Ftypep.lisp;h=121e2054de636c98e91c2b476522ddc5eadd51ae;hb=860543cc7ba0266e41e1d41ac9b6a208f3795f1a;hp=a4f79202b6102f469058efec9b095921ca92fe50;hpb=58ff25d134554f86b15d1978ae21861ccbe70f3d;p=sbcl.git diff --git a/src/code/typep.lisp b/src/code/typep.lisp index a4f7920..121e205 100644 --- a/src/code/typep.lisp +++ b/src/code/typep.lisp @@ -59,7 +59,6 @@ (long-float (typep num 'long-float)) ((nil) (floatp num)))) ((nil) t))) - #!-negative-zero-is-not-zero (flet ((bound-test (val) (let ((low (numeric-type-low type)) (high (numeric-type-high type))) @@ -77,37 +76,6 @@ (bound-test (imagpart object)))) (:real (and (not (complexp object)) - (bound-test object))))) - #!+negative-zero-is-not-zero - (labels ((signed-> (x y) - (if (and (zerop x) (zerop y) (floatp x) (floatp y)) - (> (float-sign x) (float-sign y)) - (> x y))) - (signed->= (x y) - (if (and (zerop x) (zerop y) (floatp x) (floatp y)) - (>= (float-sign x) (float-sign y)) - (>= x y))) - (bound-test (val) - (let ((low (numeric-type-low type)) - (high (numeric-type-high type))) - (and (cond ((null low) t) - ((listp low) - (signed-> val (car low))) - (t - (signed->= val low))) - (cond ((null high) t) - ((listp high) - (signed-> (car high) val)) - (t - (signed->= high val))))))) - (ecase (numeric-type-complexp type) - ((nil) t) - (:complex - (and (complexp object) - (bound-test (realpart object)) - (bound-test (imagpart object)))) - (:real - (and (not (complexp object)) (bound-test object))))))) (array-type (and (arrayp object) @@ -135,9 +103,9 @@ object))))))) (member-type (if (member object (member-type-members type)) t)) - (sb!xc:class + (classoid #+sb-xc-host (ctypep object type) - #-sb-xc-host (class-typep (layout-of object) type object)) + #-sb-xc-host (classoid-typep (layout-of object) type object)) (union-type (some (lambda (union-type-type) (%%typep object union-type-type)) (union-type-types type))) @@ -188,24 +156,25 @@ ;;; Do a type test from a class cell, allowing forward reference and ;;; redefinition. -(defun class-cell-typep (obj-layout cell object) - (let ((class (class-cell-class cell))) - (unless class - (error "The class ~S has not yet been defined." (class-cell-name cell))) - (class-typep obj-layout class object))) +(defun classoid-cell-typep (obj-layout cell object) + (let ((classoid (classoid-cell-classoid cell))) + (unless classoid + (error "The class ~S has not yet been defined." + (classoid-cell-name cell))) + (classoid-typep obj-layout classoid object))) -;;; Test whether OBJ-LAYOUT is from an instance of CLASS. -(defun class-typep (obj-layout class object) +;;; Test whether OBJ-LAYOUT is from an instance of CLASSOID. +(defun classoid-typep (obj-layout classoid object) (declare (optimize speed)) (when (layout-invalid obj-layout) - (if (and (typep (sb!xc:class-of object) 'sb!xc:standard-class) object) + (if (and (typep (classoid-of object) 'standard-classoid) object) (setq obj-layout (sb!pcl::check-wrapper-validity object)) (error "TYPEP was called on an obsolete object (was class ~S)." - (class-proper-name (layout-class obj-layout))))) - (let ((layout (class-layout class)) + (classoid-proper-name (layout-classoid obj-layout))))) + (let ((layout (classoid-layout classoid)) (obj-inherits (layout-inherits obj-layout))) (when (layout-invalid layout) - (error "The class ~S is currently invalid." class)) + (error "The class ~S is currently invalid." classoid)) (or (eq obj-layout layout) (dotimes (i (length obj-inherits) nil) (when (eq (svref obj-inherits i) layout)