Last active
May 16, 2018 11:19
-
-
Save monkey413/e7b53fe74ed0c38afd1ac7d2e5047374 to your computer and use it in GitHub Desktop.
I don't know why I am doing.
This file contains hidden or 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
/* -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