Skip to content

Instantly share code, notes, and snippets.

@aristote
Created December 11, 2013 08:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aristote/7906718 to your computer and use it in GitHub Desktop.
Save aristote/7906718 to your computer and use it in GitHub Desktop.
Gist test with crappy code.
int charToInt32(char * clearText, char * int32result[])
{
int i = 0, j = 0, pos = 0, clearSize;
int dec[4] = {24, 16, 8, 0};
unsigned int valeurRetour = 0;
printf(">> 1\n");
clearSize = strlen(clearText);
int32result = realloc(int32result, sizeof(int)*(clearSize+1));
for (i=0; i<clearSize; i+=4) {
valeurRetour = 0;
pos++;
for (j=0; j <= 3 ; j++)
valeurRetour |= (unsigned int)(clearText[i+j] << dec[j]) ;
//printf("%u\n", valeurRetour);
sprintf(int32result[pos], "%d", valeurRetour,15);
}
return pos;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment