]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/util.c
Attempt to use raw writing capabilities via scripting engine. Not functional yet
[proxmark3-svn] / armsrc / util.c
index 00dbdbb83e29f176792ba9e7eb3352ca34faa3ed..f2298290246b2174101f9175e3df4d58e768dd9f 100644 (file)
 #include "util.h"
 #include "string.h"
 
+size_t nbytes(size_t nbits) {
+       return (nbits/8)+((nbits%8)>0);
+}
+
+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--) {
Impressum, Datenschutz