Paste: reverse bytes

Author: erikc
Mode: factor
Date: Thu, 4 Mar 2010 04:18:36
Plain Text |
: reverse-bytes! ( ptr i j -- )
    2dup < [
        {
            [ drop alien-unsigned-1 ]
            [ nip alien-unsigned-1 ]
            [ drop set-alien-unsigned-1 ]
            [ nip set-alien-unsigned-1 ]
            [ [ 1 + ] [ 1 - ] bi* reverse-bytes! ]
        } 3cleave
    ] [ 3drop ] if ;

New Annotation

Summary:
Author:
Mode:
Body: