Gnutella Forums  

Go Back   Gnutella Forums > Gnutella News and Gnutelliums Forums > General Gnutella Development Discussion
Register FAQ The Twelve Commandments Members List Calendar Arcade Find the Best VPN Today's Posts

General Gnutella Development Discussion For general discussion about Gnutella development.


 
 
LinkBack Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #10 (permalink)  
Old April 25th, 2002
Devotee
 
Join Date: March 29th, 2002
Location: Germany
Posts: 21
Pferdo is flying high
Default performance is REALLY IMPORTANT...

...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!!!
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
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


All times are GMT -7. The time now is 06:05 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 ©2011, Crawlability, Inc.

Copyright © 2020 Gnutella Forums.
All Rights Reserved.