check-mod-fixnum: correct the test for power-of-two.
[sbcl.git] / src / compiler / x86 / type-vops.lisp
index 4ad6d5d..a0223ff 100644 (file)
   (:temporary (:sc any-reg) temp)
   (:generator 30
      (let* ((low (numeric-type-low type))
-            (hi (fixnumize (numeric-type-high type)))
+            (hi (numeric-type-high type))
+            (fixnum-hi (fixnumize hi))
             (error (gen-label)))
        ;; FIXME: abstract
        (assemble (*elsewhere*)
          (emit-label error)
-         (inst mov temp hi)
+         (inst mov temp fixnum-hi)
          (emit-error-break vop error-trap
                            (error-number-or-lose 'object-not-mod-error)
                            (list value temp)))
          ;; Handle powers of two specially
          ;; The higher bits and the fixnum tag can be tested in one go
          ((= (logcount (1+ hi)) 1)
-          (inst test value (lognot hi))
+          (inst test value (lognot fixnum-hi))
           (inst jmp :ne error))
          (t
           (generate-fixnum-test value)
           (inst jmp :ne error)
-          (inst cmp value hi)
+          (inst cmp value fixnum-hi)
           (inst jmp :a error)))
        (move result value))))