Paste: morton order

Author: j
Mode: assembly-x86
Date: Tue, 18 May 2010 05:56:27
Plain Text |
[ { fixnum } declare [ HEX: F00F bitand ] [ HEX: 0F00 bitand -4 shift ] [ HEX: 00F0 bitand 4 shift ] tri bitor bitor ] disassemble
000000010f2d8980: 498b06          mov rax, [r14]
000000010f2d8983: 48c1f804        sar rax, 0x4
000000010f2d8987: 4889c1          mov rcx, rax
000000010f2d898a: 4881e10ff00000  and rcx, 0xf00f
000000010f2d8991: 4889c2          mov rdx, rax
000000010f2d8994: 4881e2000f0000  and rdx, 0xf00
000000010f2d899b: 48c1e204        shl rdx, 0x4
000000010f2d899f: 48c1fa08        sar rdx, 0x8
000000010f2d89a3: 4881e0f0000000  and rax, 0xf0
000000010f2d89aa: 48c1e004        shl rax, 0x4
000000010f2d89ae: 4809c2          or rdx, rax
000000010f2d89b1: 4809d1          or rcx, rdx
000000010f2d89b4: 48c1e104        shl rcx, 0x4
000000010f2d89b8: 49890e          mov [r14], rcx
000000010f2d89bb: c3              ret 

Annotation: code

Author: pruned
Mode: factor
Date: Tue, 18 May 2010 07:02:45
Plain Text |
TYPED: odd-even-merge-bits ( u: ulonglong-2 -- w: ulonglong-2 )
    ushort-8-cast
    [ $[ BIN: 10011001 HEX: 101 * ushort-8-with ] vand ]
    [ $[ BIN: 01000100 HEX: 101 * ushort-8-with ] vand 1 vrshift vor ] 
    [ $[ BIN: 00100010 HEX: 101 * ushort-8-with ] vand 1 vlshift vor ] tri
    [ $[ BIN: 11000011 HEX: 101 * ushort-8-with ] vand ]
    [ $[ BIN: 00110000 HEX: 101 * ushort-8-with ] vand 2 vrshift vor ] 
    [ $[ BIN: 00001100 HEX: 101 * ushort-8-with ] vand 2 vlshift vor ] tri
    [ $[ HEX: F00F ushort-8-with ] vand ]
    [ $[ HEX: 0F00 ushort-8-with ] vand 4 vrshift vor ] 
    [ $[ HEX: 00F0 ushort-8-with ] vand 4 vlshift vor ] tri
    uchar-16{ 0 2 4 6 8 10 12 14 1 3 5 7 9 11 13 15 } vshuffle-bytes
    ulonglong-2-cast
; 

Annotation: final code

Author: pruned
Mode: factor
Date: Tue, 18 May 2010 07:15:01
Plain Text |
TYPED: >z-order ( u: ulonglong-2 -- w: ulonglong-2 )
    ushort-8-cast
    [ $[ BIN: 10011001 HEX: 101 * ushort-8-with ] vand ]
    [ $[ BIN: 01000100 HEX: 101 * ushort-8-with ] vand 1 vrshift vor ] 
    [ $[ BIN: 00100010 HEX: 101 * ushort-8-with ] vand 1 vlshift vor ] tri
    [ $[ BIN: 11000011 HEX: 101 * ushort-8-with ] vand ]
    [ $[ BIN: 00110000 HEX: 101 * ushort-8-with ] vand 2 vrshift vor ] 
    [ $[ BIN: 00001100 HEX: 101 * ushort-8-with ] vand 2 vlshift vor ] tri
    [ $[ HEX: F00F ushort-8-with ] vand ]
    [ $[ HEX: 0F00 ushort-8-with ] vand 4 vrshift vor ] 
    [ $[ HEX: 00F0 ushort-8-with ] vand 4 vlshift vor ] tri
    uchar-16{ 0 2 4 6 8 10 12 14 1 3 5 7 9 11 13 15 } vshuffle-bytes
    ulonglong-2-cast
;

TYPED: z-order> ( u: ulonglong-2 -- w: ulonglong-2 )
    ushort-8-cast
    uchar-16{ 0 8 1 9 2 10 3 11 4 12 5 13 6 14 7 15 } vshuffle-bytes
    [ $[ HEX: F00F ushort-8-with ] vand ]
    [ $[ HEX: 0F00 ushort-8-with ] vand 4 vrshift vor ] 
    [ $[ HEX: 00F0 ushort-8-with ] vand 4 vlshift vor ] tri
    [ $[ BIN: 11000011 HEX: 101 * ushort-8-with ] vand ]
    [ $[ BIN: 00110000 HEX: 101 * ushort-8-with ] vand 2 vrshift vor ] 
    [ $[ BIN: 00001100 HEX: 101 * ushort-8-with ] vand 2 vlshift vor ] tri
    [ $[ BIN: 10011001 HEX: 101 * ushort-8-with ] vand ]
    [ $[ BIN: 01000100 HEX: 101 * ushort-8-with ] vand 1 vrshift vor ] 
    [ $[ BIN: 00100010 HEX: 101 * ushort-8-with ] vand 1 vlshift vor ] tri
    ulonglong-2-cast
; 

New Annotation

Summary:
Author:
Mode:
Body: