Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a vector container. There are a number from 0 to 255. The data bytes are top (of the container). On the fourth day begins mantissa and it may consist of several numbers, for example. Mantissa consists of <120, 111, 200>. That is, it is the number of machine: <0x78, 0x6F, 0xC8>. Total turn mantissa: 0x786FC8.

I can convert because of the method:

  1. Set the number of 120, 111, 200 in hexadecimal.(0x78, 0x6F, 0xC8)
  2. Put the numbers in line.("78" "6F" "C8")
  3. Fold the line.("786FC8")
  4. Move back to an integer type. 0x786FC8

Q: Is there any way you do it faster and without strings?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
201 views
Welcome To Ask or Share your Answers For Others

1 Answer

It sounds like you want <120, 111, 200> → (120 * 256 + 111) * 256 + 200.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...