HP Forums
(35S) Integer Bit Mirror - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (35S) Integer Bit Mirror (/thread-4293.html)



(35S) Integer Bit Mirror - Gerald H - 07-04-2015 08:03 AM

The programme takes an integer from the stack & returns the bit reversed integer.

eg For input

65

the programme returns

65

or for input

888

the programme returns

123.

Code:

1    LBL M
2    X=0?
3    RTN
4    0
5    x<>y
6    IDIV(REGX,2)
7    REGZ*2+RMDR(REGY,2)
8    x<>y
9    x≠0?
10    GTO M006
11    R↓
12    RTN