1.0.28.66: implement SB-EXT:GET-TIME-OF-DAY
[sbcl.git] / src / code / pred.lisp
index 7d006cc..2830c51 100644 (file)
     (extended-char 'extended-char)
     ((member t) 'boolean)
     (keyword 'keyword)
-    ((or array complex) (type-specifier (ctype-of object)))
+    ((or array complex)
+     (type-specifier (ctype-of object)))
     (t
      (let* ((classoid (layout-classoid (layout-of object)))
             (name (classoid-name classoid)))
@@ -317,18 +318,21 @@ length and have identical components. Other arrays must be EQ to be EQUAL."
               (hash-table-equalp x y)))
         ((%instancep x)
          (let* ((layout-x (%instance-layout x))
-                (len (layout-length layout-x)))
+                (raw-len (layout-n-untagged-slots layout-x))
+                (total-len (layout-length layout-x))
+                (normal-len (- total-len raw-len)))
            (and (%instancep y)
                 (eq layout-x (%instance-layout y))
                 (structure-classoid-p (layout-classoid layout-x))
-                (do ((i 1 (1+ i)))
-                    ((= i len) t)
-                  (declare (fixnum i))
+                (dotimes (i normal-len t)
                   (let ((x-el (%instance-ref x i))
                         (y-el (%instance-ref y i)))
                     (unless (or (eq x-el y-el)
                                 (equalp x-el y-el))
-                      (return nil)))))))
+                      (return nil))))
+                (if (zerop raw-len)
+                    t
+                    (raw-instance-slots-equalp layout-x x y)))))
         ((vectorp x)
          (let ((length (length x)))
            (and (vectorp y)
@@ -358,8 +362,9 @@ length and have identical components. Other arrays must be EQ to be EQUAL."
 #!+sb-test
 (let ((test-cases `((0.0 ,(load-time-value (make-unportable-float :single-float-negative-zero)) t)
                     (0.0 1.0 nil)
-                    (#c(1 0) #c(1.0 0) t)
-                    (#c(1.1 0) #c(11/10 0) nil) ; due to roundoff error
+                    (#c(1 0) #c(1.0 0.0) t)
+                    (#c(0 1) #c(0.0 1.0) t)
+                    (#c(1.1 0.0) #c(11/10 0) nil) ; due to roundoff error
                     ("Hello" "hello" t)
                     ("Hello" #(#\h #\E #\l #\l #\o) t)
                     ("Hello" "goodbye" nil))))