On 11/15/12 20:50, Solar Designer wrote: > What's the point in having blockmix_salsa8() use externally-provided > temporary space (the X variable)? Is it to ensure X is properly > aligned (regardless of stack (mis)alignment)? Is it to ensure there's > no cache tag conflict between X and other arrays, in case we're on a > machine with low L1 data cache associativity?
I'm pretty sure there was no point. :-) To be honest, I didn't spend a huge amount of time optimizing this code... > I think having X as a local variable lets the compiler fully keep it in > registers, whereas having it passed into the function by reference may > result in unnecessary writes into the provided X array before the > function returns; it may also encourage the compiler to do such writes > inside the loop, especially since its iteration count is determined by r > and thus is not known at compile time (might be low). Makes sense. -- Colin Percival Security Officer Emeritus, FreeBSD | The power to serve Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid
