From 328330c55218824a62ddce9560067996d33ca6b5 Mon Sep 17 00:00:00 2001 From: Radovan Kofira Date: Tue, 10 Nov 2020 19:57:03 +0100 Subject: [PATCH] nieco viac --- cv6/a_station.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cv6/a_station.c b/cv6/a_station.c index dc6eb1b..6339ef3 100644 --- a/cv6/a_station.c +++ b/cv6/a_station.c @@ -27,13 +27,16 @@ void destroy_station(struct station* station){ } int select_track(struct station* station, const char* target){ - unsigned long hash = 0; + unsigned char *str; + { + unsigned long hash = 0; int c; - unsigned char *str; + while (c = *str++) - hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ + hash = c + (hash << 6) + (hash << 16) - hash; return hash; + } /* int i,len; for(hash = i = 0; i <'\0' ; ++i) {