![]() |
|
Register | FAQ | The Twelve Commandments | Members List | Calendar | Arcade | Find the Best VPN | Today's Posts | Search |
General Gnutella Development Discussion For general discussion about Gnutella development. |
| LinkBack ![]() | Thread Tools ![]() | Display Modes ![]() |
|
| |||
![]() ...while using VB! A professional C++ and VB programmer "B.Olaf" helped me to make faster routines, and now I finally know a bit more about RTLMoveMemory and the Memory in general... the routines listed below are 2 or even 3 times faster the my old ones: Use them!!! <code> Option Explicit 'Functions using 'RtlMoveMemory' by "B.Olaf Rasch" [bolaf-rasch@gmx.de] Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByRef lpvDest As Any, ByRef lpvSource As Any, ByVal cbCopy As Long) Function EncodeNo16(ByVal Number As Long) As String '"Long" is used to replace "unsigned int" EncodeNo16 = Space(2) CopyMemory ByVal EncodeNo16, Number, 2 End Function Function DecodeNo16(ByVal Number As String) As Long '"Long" is used to replace "unsigned int" CopyMemory DecodeNo16, ByVal Number, 2 End Function Function EncodeNo32(ByVal Number As Double) As String Dim lngTemp As Long If Number > 2147483647# Then lngTemp = CLng(Number - CDbl(4294967296#)) Else lngTemp = CLng(Number) End If EncodeNo32 = Space(4) CopyMemory ByVal EncodeNo32, lngTemp, 4 End Function Function DecodeNo32(ByVal Number As String) As Double Dim lngTemp As Long CopyMemory lngTemp, ByVal Number, 4 If lngTemp < 0 Then DecodeNo32 = CDbl(4294967296#) + lngTemp Else DecodeNo32 = CDbl(lngTemp) End If End Function </code> thx!!! |
| |
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Stop The Confusion of Bit/Byte | Angry Pirate | Open Discussion topics | 0 | June 20th, 2006 07:07 PM |
Single byte in Query-Hit trailer | mario5 | NapShare (Cross-platform) | 0 | February 11th, 2003 01:56 PM |
Searching in multi-byte languages (Japanese, Korean) | Unregistered | General Discussion | 3 | November 24th, 2002 10:02 PM |
Splitting download segments byte loss? | HelgeB | General Discussion | 6 | July 11th, 2002 06:24 AM |
Server sending only 16 byte 'packets' | Unregistered | General Gnutella Development Discussion | 1 | May 31st, 2002 07:35 AM |