station
This commit is contained in:
parent
9934c57259
commit
3734bd0fdb
@ -27,12 +27,11 @@ 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 int hash = 0;
|
unsigned int hash = 0;
|
||||||
for(int i = 0; target[i] != '\0'; i++){
|
for(int i = 0; target[i] != '\0'; i++){
|
||||||
|
//i used "lose lose" function, because it's simple and clear
|
||||||
hash += target[i];
|
hash += target[i];
|
||||||
//hash = target[i] + (hash << 6) + (hash << 16) - hash;
|
|
||||||
}
|
}
|
||||||
//if(hash < 0 || hash > station->track_count){
|
//change hash, so that it will be between 0 and station->track_count
|
||||||
hash = hash % station->track_count;
|
hash = hash % station->track_count;
|
||||||
//}
|
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user