Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > .NET

Lost Password?

Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 06-06-2014, 09:13 PM
bilm bilm is offline
Junior Member
Join Date: Nov 2012
Posts: 3
Default Convert routine with pointer math to .NET

I do a lot of byte swapping and use an old popular routine that saves using separate multiple routines. It can swap bytes in any size of unsigned integer or byte array.

I need to convert it to .NET so no pointer math. I also need to keep the same parameters 'source', 'destination' and 'byte count'.

procedure SwapBytes(const Source; var Dest; Count: LongInt);
var pSrc, pDst : PChar;
i : LongInt;
pSrc := @Source;
pDst := PChar(@Dest) + Count;
for i := 0 to Count-1 do
pDst^ := pSrc^;

I can't figure out how to do it.

Reply With Quote

Thread Tools
Display Modes

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

Forum Jump

All times are GMT. The time now is 05:54 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.