bswap modified implementation acc. to Peter's review comments