【问题标题】:How do I combine 2 32-bit Unsigned Integers to 64-bit integer如何将 2 个 32 位无符号整数组合为 64 位整数
【发布时间】:2018-06-07 21:11:05
【问题描述】:

假设我有 2 个无符号整数
第一个值为&H0D345B40
第二个值&H9AF34A32

如何生成一个无符号的 64 位整数,其值为 &H324AF39A405B340D

这是我尝试过的

dim crypt1 as uint32 = &H0D345B40
dim crypt2 as uint32 = &H9AF34A32

Dim output As UInt64 = (CType(CType(crypt1, UInt64), Long) Or (crypt2 << 32))

the output is &H000000009FF75B72

【问题讨论】:

  • 昏暗输出 = &H9AF34A320D345B40UL
  • 是的,但我需要结合 2 个变量,不能只用手
  • 昏暗输出为 UInt64 = crypt2 * &h10000000 + crypt1

标签: vb.net type-conversion endianness unsigned


【解决方案1】:

以一种糟糕的方式解决了它,但无论如何也不错

    dim output() as uint64
    Dim bytes() As UInteger = {crypt1, crypt2}

    Buffer.BlockCopy(bytes, 0, output, 0, 8)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-16
    • 2013-12-22
    相关资源
    最近更新 更多