Editing PFS
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 196: | Line 196: | ||
<source lang="c"> | <source lang="c"> | ||
uint32_t fptbl_hash( | uint32_t fptbl_hash(char* filename){ | ||
int i; | int i; | ||
// convert to upper case | |||
for(i = 0; filename[i]; i++) { | |||
if(filename[i] >= 'a' && filename[i] <= 'z') | |||
filename[i] -= 32; | |||
} | |||
// compute hash | |||
uint32_t hash = 0; | uint32_t hash = 0; | ||
for(i = 0; filename[i]; i++) { | for(i = 0; filename[i]; i++) { | ||
hash = filename[i] + 31 * hash; | |||
} | } | ||
return hash; | return hash; |