17-10-12, 12:55 AM
كاتب الموضوع : AhmedEssawy
كود :
Public Function IsOdd(ByVal lngNumber as Long) as Boolean
'When executing 10000000 times the code below takes
'about 20 seconds to execute.
'IsOdd = IIf((lngNumber And &H1) = 1, True, False)
'When executing 10000000 times the code below takes
'about 20 seconds to execute.
'IsOdd = IIf((lngNumber Mod 2) = 0, False, True)
'When executing 10000000 times the code below takes
'about 6 seconds to execute.
IsOdd = NOT (lngNumber AND &H01)
'Measurements are made on a Pentium 733 MHz
End Function