Created
May 23, 2014 20:34
-
-
Save machinaut/6005d11a77e66c9ea35d to your computer and use it in GitHub Desktop.
printx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void printx(char *s, uint8_t *x, int n) { | |
| char buf[PS]; | |
| for (int i = 0; i < PS; i++){ | |
| if(*s == '%'){ | |
| for(int j = n-1; j >= 0; j--){ | |
| buf[i++%128] = ((*(x+j)>>4)&0xf)[ | |
| "0123456789ABCDEF" | |
| ]; | |
| buf[i++%128] = (*(x+j)&0xf)[ | |
| "0123456789ABCDEF" | |
| ]; | |
| } | |
| i--; | |
| } | |
| else{ | |
| buf[i] = *s; | |
| } | |
| s++; | |
| } | |
| puts(buf); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment