C++Guns – RoboBlog

07.08.2011

hex to int - 1 Byte

Filed under: Allgemein — Tags: — Thomas @ 10:08

uint8_t hex2int(char str[2])
{
for(uint8_t i=0;i<2;i++) { if(str[i] <= '9') str[i] -= 48; else if(str[i] <= 'F') str[i] -= 55; else if(str[i] <= 'f') str[i] -= 87; } return (str[0]<<4)+str[1]; }

No Comments »

No comments yet.

RSS feed for comments on this post.

Leave a comment

You must be logged in to post a comment.

Powered by WordPress