Fast CALLOC

COTTRELL, JAMES cottrell at NBS-VMS.ARPA
Thu Feb 20 07:45:38 AEST 1986


> Here's a version of calloc that breaks every rule of "structured"
> programming ever invented -- and runs about twice as fast as a
> vanilla version:

I was amused the first time I saw this trick. However, your vehicle
is a poor choice to implement it in. Why don't you just round up
the number of int's (long's, whatever) to the next multiple of eight,
allocate that much space, & then you wouldn't need the switch. Nobody
cares about a few extra bytes when they do [mc]alloc's.

	jim		cottrell at nbs
*/
------



More information about the Comp.lang.c mailing list