superstition with no important effect
authorAndy Wingo <wingo@pobox.com>
Tue, 2 Sep 2008 07:15:26 +0000 (00:15 -0700)
committerAndy Wingo <wingo@pobox.com>
Tue, 2 Sep 2008 18:00:32 +0000 (11:00 -0700)
* module/system/vm/assemble.scm (dump-object!): Some superstition, use
  bit arithmetic instead of int arithmetic. Makes me happier.

module/system/vm/assemble.scm

index 6827de6..b7f573e 100644 (file)
           (cond
             ((and (< nargs 16) (< nlocs 128) (< nexts 16))
              ;; 16-bit representation
-             (let ((x (+ (* nargs 4096) (* nrest 2048) (* nlocs 16) nexts)))
-               (push-code! `(make-int16 ,(quotient x 256) ,(modulo x 256)))))
+             (let ((x (logior
+                        (ash nargs 12) (ash nrest 11) (ash nlocs 4) nexts)))
+               (push-code! `(make-int16 ,(ash x -8) ,(logand x (1- (ash 1 8)))))))
             (else
              ;; Other cases
              (push-code! (object->code nargs))