#include unsignedintgetHashNum(constchar*str,unsignedintlen,unsignedintmaxPrime){registerunsignedintsum=0;registerunsignedinth=0;registerunsignedshort*p=(unsignedshort*)str;registerunsignedshort*s=(unsignedshort*)str;printf("str:%s,len:%d,h:%d,maxPrime:%d\n",p,len,h,maxPrime);while(p-s{ registerunsignedshorta=*(p++)*(p-s);printf("a:%d\n",a);sum+=sum^a;h+=a;}printf("sum:%d\n",sum);return((sum<<16)|h)%maxPrime;}上面那段代码在主进程和子进程中都调用,传入的参数是一样的,但是返回值不一样,谁能看出来点端倪?主进程输出:str:key,len:3,h:0,maxPrime:60a:0a:121a:49900sum:49934子进程输出:str:key,len:3,h:0,maxPrime:60a:0a:121a:29896sum:29994
回首忆惘然
相关分类