X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/8f51ddb0bd8fb7536a07966433061f03d45f65e0..349eabe567c5c66bc95279abfd17f203f2ad697a:/armsrc/util.c?ds=inline diff --git a/armsrc/util.c b/armsrc/util.c index 00dbdbb8..3870a6c6 100644 --- a/armsrc/util.c +++ b/armsrc/util.c @@ -12,6 +12,15 @@ #include "util.h" #include "string.h" +uint32_t SwapBits(uint32_t value, int nrbits) { + int i; + uint32_t newvalue = 0; + for(i = 0; i < nrbits; i++) { + newvalue ^= ((value >> i) & 1) << (nrbits - 1 - i); + } + return newvalue; +} + void num_to_bytes(uint64_t n, size_t len, uint8_t* dest) { while (len--) {