[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
more fun
(defconstant max-byte (ash 1 vm:byte-bits))
(deftype byte ()
`(unsigned-byte ,vm:byte-bits))
(defconstant bit-reversed-byte-table
(make-array max-byte
:element-type 'byte
:initial-contents (loop for n from 0 to (1- max-byte) collecting
(%reverse-fixnum-bits n vm:byte-bits))))
(defun reverse-byte-bits (byte)
(declare (type byte byte) (optimize (speed 3)))
(aref bit-reversed-byte-table byte))
* (TYPE-OF BIT-REVERSED-BYTE-TABLE)
(SIMPLE-ARRAY (UNSIGNED-BYTE 8) (256))
* (DISASSEMBLE 'REVERSE-BYTE-BITS)
0B307778: .ENTRY "Top-Level Form"() ; FUNCTION
...
7B0: .ENTRY REVERSE-BYTE-BITS(byte) ; (FUNCTION ((UNSIGNED-BYTE ..)))
...
7DC: TADDCCTV %ZERO, %A0
7E0: MOVE %OCFP, %NL1
7E4: LD [%CODE+17], %A1 ; #(0 128 64 192 32 ...)
[Why did it load this?]
7E8: ADD %ZERO, 1024, %NL0
7EC: CMP %A0, %NL0
7F0: BGEU L1
7F4: NOP
7F8: LD [%CODE+17], %A1 ; #(0 128 64 192 32 ...)
7FC: SRL %A0, 2, %CFUNC
800: ADD 1, %CFUNC
804: LDUB [%A1+%CFUNC], %NL0
808: MOVE %NL0, %CFUNC
80C: SRA %CFUNC, 29, %NL0 [So if BIT... is a constant,
with elements of type
(unsigned byte 8), why does
it bother?]
810: CMP %NL0, 0
814: BEQ L2
... etc (non-fixnum integer allocation)
870: L0: UNIMP 10 ; Error trap
...
87C: L1: UNIMP 10 ; Error trap
...
NIL
*
I hope I'm not being *too* annoying... I suppose a lot of these things
you're already aware of...
-Miles
--
Miles Bader -- HCRC, University of Edinburgh -- Miles.Bader@ed.ac.uk
99% of everything is grunge