fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4.  
  5.  
  6. long strhash(char* str){
  7. ssize_t len = strlen(str) - 1;
  8. ssize_t i = len;
  9. unsigned char* p = (unsigned char*) str;
  10.  
  11. long x = *p << 7;
  12.  
  13. while (--i >= 0)
  14. x = (1000003*x) ^ *p++;
  15.  
  16. x ^= (len);
  17.  
  18. return (x == -1)? -2 : x;
  19. }
  20.  
  21. int main(){
  22. char *gameId="SCUS94199";
  23. printf("%ld\n",strhash(gameId));
  24.  
  25. return 0;
  26. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function 'strhash':
prog.c:7:2: error: unknown type name 'ssize_t'
  ssize_t len = strlen(str) - 1;
  ^
prog.c:8:2: error: unknown type name 'ssize_t'
  ssize_t i = len;
  ^
stdout
Standard output is empty