Index: /trunk/source/compiler/optimizers.lisp
===================================================================
--- /trunk/source/compiler/optimizers.lisp	(revision 14558)
+++ /trunk/source/compiler/optimizers.lisp	(revision 14559)
@@ -584,22 +584,26 @@
 
 (define-compiler-macro ldb (&whole call &environment env byte integer)
-   (cond ((and (integerp byte) (> byte 0))
-          (let ((size (byte-size byte))
-                (position (byte-position byte)))
-            (cond ((nx-form-typep integer 'fixnum env)
-                   `(logand ,(byte-mask size)
-                     (the fixnum (ash ,integer ,(- position)))))
-                  (t `(load-byte ,size ,position ,integer)))))
-         ((and (consp byte)
-               (eq (%car byte) 'byte)
-               (eq (list-length (%cdr byte)) 2))
-          (let ((size (%cadr byte))
-                (position (%caddr byte)))
-            (if (and (nx-form-typep integer 'fixnum env) (fixnump position))
-              ;; I'm not sure this is worth doing
-              `(logand (byte-mask ,size) (the fixnum (ash ,integer ,(- position))))
-              ;; this IS worth doing
-              `(load-byte ,size ,position ,integer))))
-         (t call)))
+  (cond ((and (integerp byte) (> byte 0))
+         (let ((size (byte-size byte))
+               (position (byte-position byte)))
+           (cond ((nx-form-typep integer 'fixnum env)
+                  `(logand ,(byte-mask size)
+                    (the fixnum (ash ,integer ,(- position)))))
+                 ((zerop position)
+                  `(logand ,(byte-mask size) ,integer))
+                 (t `(load-byte ,size ,position ,integer)))))
+        ((and (consp byte)
+              (eq (%car byte) 'byte)
+              (eq (list-length (%cdr byte)) 2))
+         (let ((size (%cadr byte))
+               (position (%caddr byte)))
+           (if (eql position 0)
+             `(logand (byte-mask ,size) ,integer)
+             (if (and (nx-form-typep integer 'fixnum env) (fixnump position))
+               ;; I'm not sure this is worth doing
+               `(logand (byte-mask ,size) (the fixnum (ash ,integer ,(- position))))
+               ;; this IS worth doing
+               `(load-byte ,size ,position ,integer)))))
+        (t call)))
 
 (define-compiler-macro length (&whole call &environment env seq)
