Closed Ruk33 closed 10 years ago
That still requires an onInit to store 1 into recycler[0], otherwise good job ^)^
You should also store 0 into instance 8191 to allocate the entire array
I personally like the loop since I rely on allocation for extremely heavy algorithms and need it to be as lightweight as possible to prevent threads from crashing ^)^. It'd be even better if it inlined o-o.
it requires if you do -1, but if you use +1, you dont :D
Elaborate please
well there isn't that much to elaborate
http://www.hiveworkshop.com/forums/lab-715/allocation-one-variable-253320/
How is the first instance you allocate not 0? Also, the array will be remade a lot cuz you don't set 8191.
local integer instance = recycler[0] + 1
right, recycle[0] + 1 should avoid first instance to be 0.
also, i was reading about array length on wc3, and apparently yes, its size will be changed several times, so should this matter?, is it an expensive operation?.
other way to avoid this would be set recycle[8190] = 1 || 0 on allocate.
I'm going to implement this with credits to you. It will be standard Alloc.
the + 1 to first instance must be put in onInit or it will go 1, 3, 5 etc. I'll be sure to set last index to 0 too.
There will also be a fast version, or low op, which will be current module.
Thank you Ruk33. Sry i'm a bit slow right now :).
TriggerHappy upset me with his recent comment that he doesn't want to approve anything that requires Alloc -.-.
You're welcome :).
works without the init loop