Post Reply 
(50G) Bit Mirror of Zint
06-26-2015, 09:08 AM (This post was last modified: 06-15-2017 01:43 PM by Gene.)
Post: #1
(50G) Bit Mirror of Zint
ZBMRR takes an integer from the stack & returns the bit reversed integer.

eg For input

65

the programme returns

65

or for input

77^77

the programme returns

18366534824822646077823694996015305077283851597047981665758027101169075241717800​535357331193664397611464622329815059415485300995452848454341037661

in

2.72 sec

ZBMRR
Code:

::
  CK1&Dispatch
  # FF
  ::
    FPTR2 ^DupQIsZero?
    ?SEMI
    Z0_
    SWAP
    FPTR2 ^Z>ZH
    FPTR2 ^ZBits
    ZERO_DO
    INDEX@
    FPTR2 ^ZBit?
    ITE
    Z1_
    Z0_
    ROTDUP
    FPTR2 ^RADDext
    FPTR2 ^RADDext
    SWAPLOOP
    DROP
  ;
;
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)