Board index » delphi » Re: Moving X number of words from A to B

Re: Moving X number of words from A to B


2005-11-04 02:16:50 AM
delphi233
Quote
Can anyone help with the following.
I need to move X number of words from a to b in memory.
The interface for the procedure looks like this:

Procedure Move16Bit(SrcAddr,DstAddr:PWord;Const inCount:Integer);
Begin
end;

I tried to figure out the rep stosw command, but i got lost in the
docs i found.
There is no need to test the pointers or if inCount<=0.
select source & destination ->blindcopy.

Please help anyone!
I would recommend just using the Fastcode Move challenge winner. Some
optimization may be possible if the size is always a multiple of two,
but i doubt this minor gain would be worth the effort - the Fastcode
Move winner should be pretty fast.
--
The Fastcode Project: www.fastcodeproject.org/
 
 

Re: Moving X number of words from A to B

Hi
Can anyone help with the following.
I need to move X number of words from a to b in memory.
The interface for the procedure looks like this:
Procedure Move16Bit(SrcAddr,DstAddr:PWord;Const inCount:Integer);
Begin
end;
I tried to figure out the rep stosw command, but i got lost in the docs i
found.
There is no need to test the pointers or if inCount<=0.
select source & destination ->blindcopy.
Please help anyone!
Jon Lennart Aasenden
 

Re: Moving X number of words from A to B

Hi Jon,
Quote
I need to move X number of words from a to b in memory.
What is the typical range of X? If X can be a wide range or if the source
and target blocks can overlap, then the Fastcode Move challenge winner (as
Avatar suggested) would be a good bet. Otherwise it may be possible to write
a routine that is slightly faster.
Regards,
Pierre
 

Re: Moving X number of words from A to B

Well, it will be used as a part of my blitter routine, so speed is nice.
Problem is that i dont want to include extra units. The project is huge as
it is now.
I seem to remember that the fastcode project is a collection of units right?
Also, the different implementations use different instruction sets?
Anyways, the routine will be used to copy scanline by scaline from one
surface to another.
Hope you could help me out
Jon Lennart Aasenden
"Pierre le Riche" <XXXX@XXXXX.COM>writes
Quote
Hi Jon,

>I need to move X number of words from a to b in memory.

What is the typical range of X? If X can be a wide range or if the source
and target blocks can overlap, then the Fastcode Move challenge winner (as
Avatar suggested) would be a good bet. Otherwise it may be possible to
write
a routine that is slightly faster.

Regards,
Pierre


 

Re: Moving X number of words from A to B

Hi Jon,
Quote
>>I need to move X number of words from a to b in memory.
Anyways, the routine will be used to copy scanline by scaline from one
surface to another.
Are the following assumptions valid?
1) X is always>0
2) The source and destination blocks will never overlap
Also, what is the typical range of values for X?
Regards,
Pierre
 

Re: Moving X number of words from A to B

Quote
>X is always>0?
Yes
Quote
>The source and destination blocks will never overlap?
Hmm.. When thinking about it, they may do that. It makes sense to avoid this
in general, it is highly unlikely that anyone would blit a rectangle to a
position within its own bounds. I will add a test for this, so the answere
is Yes.
Quote
>>Also, what is the typical range of values for X?
Anything really. Depends on how big the surface is.
I have not set a limit for offline surfaces (not dibs, they have maximum
limitations), so it can be anything from 32x32 to 4096x4096.
While i can live without the MoveWord() procedure, i am struggeling to find
any info on moving 24 bit data from a to b. It could be reduced to use
longword moves (3 24 bit pixels=12 bytes, 3 long moves).
I have done that in my pascal code. How the assembler version would look i
have no idea..
Well, any help is welcome.
Thank you for taking the time to reply!
Kind regards
Jon Lennart Aasenden
"Pierre le Riche" <XXXX@XXXXX.COM>writes
Quote
Hi Jon,

>>>I need to move X number of words from a to b in memory.
>Anyways, the routine will be used to copy scanline by scaline from one
>surface to another.

Are the following assumptions valid?

1) X is always>0
2) The source and destination blocks will never overlap

Also, what is the typical range of values for X?

Regards,
Pierre


 

Re: Moving X number of words from A to B

Hi Jon,
Quote
>>X is always>0?
Yes
I would suggest you use a simplified FastMove entry. You can remove the
check for sizes <= 0 and also for forward/backward move and only use the
forward move part (since there is no overlapping). It should be marginally
faster.
Regards,
Pierre
 

Re: Moving X number of words from A to B

Hi
I agree 100% that this is the best bet on a very fast Move.
Best regards
Dennis Kjaer Christensen