Quote:
Originally Posted by Mauzen
A bitset actually would have little to no advantages compared to the common loop
pawn Код:
// Common attempt for (new i = 0; i < MAX_VEHICLES; i++) { if (!IsVehicleStreamedIn(i, playerid)) continue; }
// Bitset (some pawn/c++ pseudo mixup) for (new i = 0; i < MAX_VEHICLES; i++) { if (!bitset_playervehicles[playerid].test(i)) continue; }
|
I did not mention an advantage over looping with function usage. I mentioned a clear memory consumption advantage vs the regular PAWN array -- 32 times less memory usage (technically, I assume the container keeps some other properties to satisfy the standard requirements). That is, after all, if you're going to have an array around, if someone's an advocate of that approach. So my text about bitset was just in case someone is going to need an array for some situation, there's no need to allocate 32bits for what can fit in 1bit.
Back to the original point, as I said, it is an infrequent algorithm so don't spend time optimizing it if you're not going to get it back from run-time gains.
Good luck.