|
|
|
Click here to copy the following block |
Function ShiftRight(ByVal value As Long, ByVal times As Long) As Long Dim mask As Long, signBit As Long If times >= 32 Then Exit Function If times = 0 Then ShiftRight = value: Exit Function signBit = (value < 0) And Power2(31 - times) If times < 31 Then mask = Not (Power2(times) - 1) End If value = (value And &H7FFFFFFF) And mask ShiftRight = (value \ Power2(times)) Or signBit End Function
Function Power2(ByVal exponent As Long) As Long Static res(0 To 31) As Long Dim i As Long If exponent < 0 Or exponent > 31 Then Err.Raise 5 If res(0) = 0 Then res(0) = 1 For i = 1 To 30 res(i) = res(i - 1) * 2 Next res(31) = &H80000000 End If Power2 = res(exponent) End Function |
|
|
|
Submitted By :
Nayan Patel
(Member Since : 5/26/2004 12:23:06 PM)
|
|
|
Job Description :
He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |
View all (893) submissions by this author
(Birth Date : 7/14/1981 ) |
|
|