]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/util.c
add bitswap option for lf em 4x05write (#236)
[proxmark3-svn] / client / util.c
index 81b2d844f4376bdda269f6e3850a5c9925915216..7c70d55d5c98bb16d7b6472da681611e4e290d97 100644 (file)
@@ -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
Impressum, Datenschutz