32 bit floating point decimal help

I've got a 32 bit floating point decimal at a device. It's split into two 16 bit integers to go over the wire.

The original value, at the device, is 156.

The two 16 bit integers come across as 17180 and 0. How do I convert, in C#, the 17180 and 0 back to 156?
Who is Participating?
käµfm³d 👽Commented:
I edited my post (not quick enough it seems). You need a left-shift as well. However, I don't see how you could possibly get back a number that is smaller than either of its two parts. I think something isn't correct in the initial conversion.
käµfm³d 👽Commented:
Use bitwise OR ( | ) combined with a left shift ( << ):

int result = (int1 << 16) | int2;

Open in new window

be sure to put them in the correct order of higher-order bits and lower-order bits (higher on the left of the |).
lateapexAuthor Commented:
So I tried this:

 int myFirst = 17180;
            int mySecond = 0;
            int myResult = myFirst | mySecond;

myResult came out to 17180.

I'm trying put the two back together to form a 32 bit floating point that I know left the device with a value of 156.

The reason for this is the device sometimes reverses the order of the two 16 bit integers and we need to debug.

lateapexAuthor Commented:
Thanks for the help. I didn't ask a good question.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.