HP Forums
(50G) Bit Mirror of Zint - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (50G) Bit Mirror of Zint (/thread-4233.html)



(50G) Bit Mirror of Zint - Gerald H - 06-26-2015 09:08 AM

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
  ;
;