Is there a more efficient way to cast 4 bytes into a long?

Viewed 219

Assume I have a fixed-size bytes array and a long:

Dim abHeader(0 To 3) As Byte
Dim lHeader As Long

To transport the bytes array into the Long, with the arrays index 3 located at the 8 LSB of the Long, I currently use:

lHeader = (CLng(abHeader(0)) << 24) _
       Or (CLng(abHeader(1)) << 16) _
       Or (CLng(abHeader(2)) << 8) _
       Or (CLng(abHeader(3)))

Is there a computationally more efficient way to do this task in VB.NET? (It's being used in a time-critical loop.)

NB: Option Strict is on.

2 Answers
Related