Skip to content

Instantly share code, notes, and snippets.

@monkey413
Last active May 16, 2018 11:19
Show Gist options
  • Save monkey413/e7b53fe74ed0c38afd1ac7d2e5047374 to your computer and use it in GitHub Desktop.
Save monkey413/e7b53fe74ed0c38afd1ac7d2e5047374 to your computer and use it in GitHub Desktop.
I don't know why I am doing.
/* -1 not found */
unsigned int findList(const unsigned int DATA_A, const unsigned int DATA_B){
unsigned int prevEntry = NULL, curEntry = ListHead;
while(curEntry != NULL) {
if (ListArray[curEntry].DataH == DATA_A && ListArray[curEntry].DataL == DATA_B) {
printf("FoundEntry = %d, PreEntry = %d\n", curEntry, prevEntry);
return curEntry;
}
if((ListArray[curEntry].DataH << 16) + ListArray[curEntry].DataL > (DATA_A << 16) + DATA_B) {
puts("not found");
return -1;
}
preEntry = curEntry;
curEntry = ListArray[curEntry].NextPtr;
}
puts("not found");
return -1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment