Skip to content

Instantly share code, notes, and snippets.

@machinaut
Created May 23, 2014 20:34
Show Gist options
  • Select an option

  • Save machinaut/6005d11a77e66c9ea35d to your computer and use it in GitHub Desktop.

Select an option

Save machinaut/6005d11a77e66c9ea35d to your computer and use it in GitHub Desktop.
printx
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