[DGD]Sizeof arrays...
Michael J. Bacon
mj.bacon at gte.net
Tue Jun 19 23:06:24 CEST 2001
> Close. ;)
>
> For arrays, you are correct; it's (array*)->size
>
> For maps, however, the size can be determined via (*):
>
> unsigned short nSize;
>
> /* Optimized division by 2 (using integer division, of course) */
> nSize = (array*)->size >> 1;
>
> /* This is the part that you are missing */
> if ( (array*)->hashed != NULL )
> {
> nSize += (array*)->hashed->size;
> }
Ah, cool. Thanks! Just out of curiosity, when does the ->hashed != NULL
case kick in? Under what circumstances does a mapping come back where I
could test this? Really big mondo mappings?
Thanks again!
Michael.
List config page: http://list.imaginary.com/mailman/listinfo/dgd
More information about the DGD
mailing list