Advertisement
ASP_Volume3 Math/ Dates #48077

Convert two dWords to a qWord

How to convert two 32-bit dWords to a 64-bit qWord.

AI

एआई सारांश: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

सोर्स कोड
original-source
Option Explicit
Private Type tLoHi 'remember - we are little endian
  Lo As Long
  Hi As Long
End Type
Private Type tCurr
  LoHi As Currency
End Type
Private Function Convert(ByVal HiWord As Long, ByVal LoWord As Long) As Variant
 'convert two 32bit dWords to a 64bit qWord
 Dim LoHi As tLoHi
 Dim Curr As tCurr
  LoHi.Hi = HiWord
  LoHi.Lo = LoWord
  LSet Curr = LoHi
  Convert = CDec(Curr.LoHi) * 10000    'remove decimal point from currency
End Function
Private Sub Command1_Click()
  Cls
  Print "MaxPos ", Convert(&H7FFFFFFF, &HFFFFFFFF)
  Print "MaxNeg ", Convert(&H80000000, 0)
  Print "Plus 1 ", Convert(0, 1)
  Print "Minus 1", Convert(&HFFFFFFFF, &HFFFFFFFF)
End Sub
मूल टिप्पणियाँ (3)
Wayback Machine से पुनर्प्राप्त