Created
July 22, 2016 09:22
-
-
Save ker2x/3ba9dcaa80782bcb59e68c6944a39273 to your computer and use it in GitHub Desktop.
This file contains 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
unsigned int | |
chars_to_int(char * from, int start, int end) { | |
/* better way : byte copy */ | |
unsigned int value = 0; | |
unsigned char buf; | |
int exp; | |
int pos=start; | |
for( ; pos <= end ; pos ++ ) { | |
exp = (end - pos); | |
buf = from[pos]; | |
value += buf * (1 << (8*exp)) ; | |
} | |
return value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment