HP Forums

Full Version: (35S) Integer Bit Mirror
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
Reference URL's