X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/02069dbbdb943617d7999d12c3506b82ae20a89e..c9ad641b61c6fc5e4b77b181ad9b58b8723f56c6:/client/util.c diff --git a/client/util.c b/client/util.c index 81b2d844..7c70d55d 100644 --- a/client/util.c +++ b/client/util.c @@ -257,6 +257,15 @@ void num_to_bytebitsLSBF(uint64_t n, size_t len, uint8_t *dest) { } } +// Swap bit order on a uint32_t value. Can be limited by nrbits just use say 8bits reversal +// And clears the rest of the bits. +uint32_t SwapBits(uint32_t value, int nrbits) { + uint32_t newvalue = 0; + for(int i = 0; i < nrbits; i++) { + newvalue ^= ((value >> i) & 1) << (nrbits - 1 - i); + } + return newvalue; +} // aa,bb,cc,dd,ee,ff,gg,hh, ii,jj,kk,ll,mm,nn,oo,pp // to