On Tue, 2011-08-09 at 08:25 -0700, Richard Henderson wrote: > On 08/08/2011 03:22 PM, Steve Ellcey wrote: > > Oh, so after I declare md5, I call md5_finish_ctx like: > > > > md5_finish_ctx (&md5.ctx, md5.checksum); > > > > Is that what you are proposing? It seems a bit odd to put checksum in a > > a structure with ctx just to guarantee its alignment and not to pass > > them around as one entity, but I guess it's no worse then using a union. > > Yes, that's what I'm proposing. > > > r~
I think I like using a union to ensure the alignment of checksum better. In dwarf2out.c we are always using one md5_ctx structure and one checksum buffer but in fold-const.c there are routines where we use one md5_ctx structure with 4 (fold_build2_stat_loc) or 6 (fold_build3_stat_loc) different checksum buffers. If I use a structure containing one md5_ctx struct and one checksum array then I need to create a lot of extra md5_ctx structures in fold-const.c. If I use the md5_ctx as it currently is and just change checksum from a structure to a union in order to guarantee its alignment then I don't need to increase the space the fold-const routines are using. Steve Ellcey s...@cup.hp.com