VBspeed / Bits / HiWord
VBspeed © 2000-10, updated: 06-Dec-2000
HiWord


Function HiWord
Returns the HiWord (the most significant 2 bytes) from a 4-byte DoubleWord (aka Long).
Code
HiWord01
Public Function HiWord01(lDWord As Long) As Integer
  HiWord01 = (lDWord And &HFFFF0000) \ &H10000
End Function
  
HiWord02
Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
    (pDst As Any, pSrc As Any, ByVal ByteLen As Long)

Public Function HiWord02(lDWord As Long) As Integer CopyMemory HiWord02, ByVal VarPtr(lDWord) + 2&, 2& End Function
Calls
1iRet = HiWord(&H80000000)
Charts
 VB5 Charts
Code
HiWord01 
HiWord02 
Call 1
11.000.032µs
210.750.340µs
 VB6 Charts
Code
HiWord01 
HiWord02 
Call 1
11.000.032µs
210.530.340µs
Conclusions
  • Look at the numbers and draw your conclusions...
Got comments? How to read all those numbers

top




VBspeed © 2000-10 by Donald Lessau