Project

General

Profile

HTSP signed 64bit integer bit representation

Added by Rüdiger Gubler over 9 years ago

Hi,

I'm confused about the number to bit mapping in the HTS-Protocol.
The Java-Implementation link here as a reference generates the following:

Input Integer --> Bits                                --> Back converted Integer
        127   -->                            01111111 -->         127
        128   -->                   10000000 00000000 -->         128
       -128   -->                            10000000 -->         128
       -127   -->                            10000001 -->         129
        256   -->                   00000000 00000001 -->         256
       -256   -->                   00000000 11111111 -->       65280
 2147483647   --> 11111111 11111111 11111111 01111111 -->  2147483647
-2147483648   --> 00000000 00000000 00000000 10000000 --> -2147483648

This looks not as a valid mapping.

Can someone give me the correct bits for the above input values please?

Yours Rüdiger


Replies (1)

RE: HTSP signed 64bit integer bit representation - Added by Rüdiger Gubler over 9 years ago

I played around and got this:

         127 -->                                                                 01111111 -->                       7F -->          127
         128 -->                                                                 10000000 -->                       80 -->          128
         255 -->                                                                 11111111 -->                       FF -->          255
         256 -->                                                        00000000-00000001 -->                    00-01 -->          256
           0 -->                                                                 00000000 -->                       00 -->            0
         258 -->                                                        00000010-00000001 -->                    02-01 -->          258
         100 -->                                                                 01100100 -->                       64 -->          100
        1337 -->                                                        00111001-00000101 -->                    39-05 -->         1337
          -1 -->  11111111-11111111-11111111-11111111-11111111-11111111-11111111-11111111 -->  FF-FF-FF-FF-FF-FF-FF-FF -->           -1

The results are looking as expected. Hopefully this is the solution.

    (1-1/1)