From: Taylor R Campbell Date: Tue, 22 Jan 2019 03:47:47 +0000 (+0000) Subject: Fix byte ordering in GENERATE/NSECTS. X-Git-Tag: mit-scheme-pucked-10.1.20~11^2~66^2~35 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=57f02f16e96a1a24466eeb6f1dadbd5353c6b2e6;p=mit-scheme.git Fix byte ordering in GENERATE/NSECTS. --- diff --git a/src/compiler/machines/aarch64/rules3.scm b/src/compiler/machines/aarch64/rules3.scm index 9e764240d..5529cb44e 100644 --- a/src/compiler/machines/aarch64/rules3.scm +++ b/src/compiler/machines/aarch64/rules3.scm @@ -793,10 +793,10 @@ USA. (define (generate/nsects nsects) (let ((n (vector-length nsects))) (define (adjoin/be byte word bits) - (bitwise-ior (shift-left byte bits) word)) - (define (adjoin/le byte word bits) bits (bitwise-ior byte (shift-left word 8))) + (define (adjoin/le byte word bits) + (bitwise-ior (shift-left byte bits) word)) (define adjoin (case endianness ((BIG) adjoin/be) @@ -806,13 +806,15 @@ USA. ((i (* (quotient (+ n 7) 8) 8)) (words (LAP))) (if (< 0 i) - (let subloop ((j 0) (word 0)) - (if (< j 8) - (let ((byte (if (< (+ i j) n) (vector-ref nsects (+ i j)) 0))) - (subloop (+ j 1) (adjoin byte word (* j 8)))) - (loop (- i 8) - (LAP (DATA 64 U ,word) - ,@words)))) + (let ((i (- i 8))) + (let subloop ((j 0) (word 0)) + (if (< j 8) + (let ((byte + (if (< (+ i j) n) (vector-ref nsects (+ i j)) 0))) + (subloop (+ j 1) (adjoin byte word (* j 8)))) + (loop i + (LAP (DATA 64 U ,word) + ,@words))))) words)))) (define (generate/constants-block constants references assignments