[DGD] Bitwise on Arrays & Efficiency
Michael McKiel
crashnbrn71 at yahoo.ca
Sat Mar 6 17:00:26 CET 2004
I've recently come across bitwise operations on arrays, though I seen them
before in passing never really grasped what they were doing, nor really how
bitwise could be done on an array.
What I was wondering is, are there any other operators that can be used on
arrays, besides '&' '|' ?
Previously I had been using the member_array() that is found in Melville, but
realized that loops thru the array piece by piece til it finds the element.
Regarding efficiency, I'd assume bitwise AND(&) to be better than that,
but...
Wouldn't it in effect have to do the same type of looping - just at the
driver level? ie:
sizeof(someArr & ({ element })) != 0
Or if its not looping at the driver level what then? does each element in an
array wind up with a unique_id that in effect is similiar to doing bitwise on
binary where 1111 & 0001 == 1
And for array concatenation we have:
1/ someArr += ({ element });
2/ someArr = someArr | ({ element });
I take it version one creates a new array in memory to perform its task, and
version 2 doesn't?
And the only way I can find to remove nil's from arrays would be:
1/ someArr -= ({ nil });
2/ someArr = someArr - ({nil});
Again I assume those both make another array, is there some way to do so
without making another array? :)
Anyways hadn't bugged ya's in a while, but working away on Reload, and trying
to keep it as clean as possible.
Thanks,
Zam.
______________________________________________________________________
Post your free ad now! http://personals.yahoo.ca
_________________________________________________________________
List config page: http://list.imaginary.com/mailman/listinfo/dgd
More information about the DGD
mailing list