Bruno Haible <[EMAIL PROTECTED]> wrote: > Jim Meyering wrote: >> + set_uint32 (r + 0 * sizeof ctx->A, SWAP (ctx->A)); >> + set_uint32 (r + 1 * sizeof ctx->B, SWAP (ctx->B)); >> + set_uint32 (r + 2 * sizeof ctx->C, SWAP (ctx->C)); >> + set_uint32 (r + 3 * sizeof ctx->D, SWAP (ctx->D)); > > Now this is confusing.
Now, now. Don't overstate the case. I'm sure you were not confused. > If you assume that A, B, C, D all have the same > size, then it's simpler (more symmetry) to write: I see as much simplicity/symmetry either way. row-based above, column-based below. I did consider what you propose, but still have a slight bias for the approach I chose. > set_uint32 (r + 0 * sizeof ctx->A, SWAP (ctx->A)); > set_uint32 (r + 1 * sizeof ctx->A, SWAP (ctx->B)); > set_uint32 (r + 2 * sizeof ctx->A, SWAP (ctx->C)); > set_uint32 (r + 3 * sizeof ctx->A, SWAP (ctx->D)); The only way that code can be useful is when A, B, C, and D all have the same size, so I chose row-based symmetry. > If you don't want to assume this, then the code above is incorrect (it Good debate technique :-) "If <outrageous condition>, then *UGLY CODE*" > stores the second element at offset sizeof(B) but should store it at the > offset sizeof(A), etc.) and should be corrected like this:
