Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] Arrays within types

Author
Message
Mr Kohlenstoff
17
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Germany
Posted: 20th Dec 2009 18:15 Edited at: 20th Dec 2009 18:20
Hi,

this topic has been covered several times here I guess (even once by myself), but however, I just wrote a new code (way easier than my first one... not using pointers and stuff, since you do not actually need it), which is relatively fast (~1-2 times slower than dbp-native arrays) and provides the possibility to use primitive ID-based arrays (currently just for integer and float-values).

The principle is quite simple: Since it just works with one-dimensional static arrays (no changes in size allowed), they are simply stored in one dynamic DBP-array. That means, if you create a new "AID-Array" (aid for "ID-based Arrays"... 'ida' or 'idba' just sounded strange), a fixed amount of elements is being added to the DBP-internal array.




Just comment out the Debugging-lines in the 4 set/get-functions to speed it up (but possibly create strange errors, so better just remove these lines when you are absolutely sure that there are no bugs).
Wellll... I'm not that sure if somebody is going to use it anyway. If someone does however, use/modify/whatever the code as you want (I hate restrictions ). That's all I guess - have fun.

Login to post a reply

Server time is: 2024-05-04 04:52:20
Your offset time is: 2024-05-04 04:52:20