from M. Kretz: replace two shuffle calls by Mem::permute helper to avoid bogus warning with clang