bswap: make generic implementation more compiler-friendly