nieco viac

This commit is contained in:
Radovan Kofira 2020-11-10 19:54:13 +01:00
parent 8f67113e74
commit 8c611f64bd

View File

@ -27,13 +27,13 @@ void destroy_station(struct station* station){
} }
int select_track(struct station* station, const char* target){ int select_track(struct station* station, const char* target){
unsigned long hash=0; unsigned long hash = 0;
int c;
for(int i=0;target[i]!='\0';i++){ unsigned char *str;
hash= target[i] + (hash << 6) + (hash <<16)-hash; while (c = *str++)
} hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
hash = hash%station->track_count;
return hash; return hash;
/* int i,len; /* int i,len;
for(hash = i = 0; i <'\0' ; ++i) for(hash = i = 0; i <'\0' ; ++i)
{ {