Pointer access to a primiter memory area
Hi,
I would like to be able writing something like this in my scipts :
uint8* p = GetDataPtr();
for( ...; ... ;... )
{
uint n = *p;
p++;
}
I know that pointer are (still :)) not allowed, but is there any other way (using references or such) to do that without registering complex object ?
The reason here is for performance issue : accessing buffer using some GetData( nIdx ) registered method is very very slower than getting a pointer on it and walk through datas (while it's not safe:)), so parsing huge amount of datas (like image processing :)) is a big issue.
Thanks in advance,
Lbas
Lbas
Until AngelScript supports true pointers, the fastest you can get is probably something like this:
Where GetRef() is:
// AngelScriptint p = GetDataPtr();for( ...;...;... ){ uint n = GetRef(p); p++;}
Where GetRef() is:
// C++char *GetRef(char *p) { return p; }engine->RegisterGlobalFunction("uint8 &GetRef(int)", asFUNCTION(GetRef), asCALL_CDECL);
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement