From 3734bd0fdba91ecf4730a27dac687e134ca742e0 Mon Sep 17 00:00:00 2001 From: Maryna Kravtsova Date: Sat, 7 Nov 2020 16:52:33 +0100 Subject: [PATCH] station --- cv6/a_station.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cv6/a_station.c b/cv6/a_station.c index 494eb1e..9aa8696 100644 --- a/cv6/a_station.c +++ b/cv6/a_station.c @@ -27,12 +27,11 @@ void destroy_station(struct station* station){ int select_track(struct station* station, const char* target){ unsigned int hash = 0; 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 << 6) + (hash << 16) - hash; } - //if(hash < 0 || hash > station->track_count){ - hash = hash % station->track_count; - //} + //change hash, so that it will be between 0 and station->track_count + hash = hash % station->track_count; return hash; }