Hi Ned,

> The C++ version is also missing a bit of functionality but it would be
> easy to add. I think at the time I didn't fully appreciate what was
> affecting the size and could probably get the C++ one to be as small
> as the C one now that I understand whats going on.

OK, here's a modified version of yours that generates the same size
object file using GCC 4.1.0 (actually, the C++ version is 2 bytes
larger because of a bad register allocation choice, but who's
counting?).

Thanks for the improvements - I'll incorporate them back into my version.

I also made the C interface parameterizable for IndexType and
EntryType, added the missing functions to the C++ version (though I'm
not sure that they should be public at all), and added some comments.

I added CBUF_GetPopEntryPtr and CBUF_AdvancePopIdx for cases where
you're using a circular buffer of structures and don't want to make a
copy outside of the circular buffer.

CBUF_GetPopEntryPtr allows you to snag a pointer to the structure
inside the circular buffer, and once you've finished with it, you can
call CBUF_AdvancePopIdx to "consume" the item.

So, for the intended purposes, the GetEntryPtr and Advance functions
should be public.

--
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/


_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to