简体   繁体   中英

How do I combine 2 32-bit Unsigned Integers to 64-bit integer

Lets say I got 2 unsigned integer
first with value &H0D345B40
second with value &H9AF34A32

How do I produce a unsigned 64 bit integer with the value &H324AF39A405B340D

Here is what I tried

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

Solved it a crappy way but not bad anyways

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM