从几个十进制数中提取一个十六进制数

Drawing up a hexadecimal number from several decimal numbers

我有一个矢量容器。有一个从 0 到 255 的数字。数据字节在顶部(容器的)。第四天开始尾数,例如,它可能由多个数字组成。尾数由 <120, 111, 200> 组成。即机器编号:<0x78,0x6F,0xC8>。总转尾数: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

问:有什么方法可以更快而且不用字符串吗?

听起来你想要<120, 111, 200> → (<em>120</em> * <strong>256</strong> + <em>111</em>) * <strong>256</strong> + <em>200</em>.