improvement of index-calculation
- From: "Guenther Wimpassinger" <gw_spam@xxxxxxxxx>
- Date: Wed, 27 Jul 2005 12:13:59 +0200
Hi!
I want to improve the speed of the following function
function TMathCloudParticles.GetVoxelFromXYZ(const x, y, z: integer): boolean;
begin
// result := GetArrayBit(pCldFront, GetVoxelIndex(x, y, z));
result := (pCldFront[
x or
(z shl iCloudDimXZ) or
((y and not iBitMaskY) shl ((iCloudDimXZ shl 1)-5))] and
(1 shl (y and iBitMaskY))) <>0;
end;
pCldFront : PDwordArray;
iCloudDimXZ,iBitMaskY : Integer (private fields of the class).
It is possible to pre-calculate ((iCloudDimXZ shl 1)-5) in the
constructor of the class to another private field.
TIA
Guenther
.
- Follow-Ups:
- Re: improvement of index-calculation
- From: Guenther Wimpassinger
- Re: improvement of index-calculation
- From: Eric Grange
- Re: improvement of index-calculation
- From: Ralf Mimoun
- Re: improvement of index-calculation
- Prev by Date: Re: Fastcode MM B&V 0.48
- Next by Date: Re: Fastcode MM B&V 0.48
- Previous by thread: Well done to Fastcode project
- Next by thread: Re: improvement of index-calculation
- Index(es):