grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / filesys / afs / hashing.c
blob62c3f77a4d1739b020713d19f97aa097c7491132
1 /*
2 Copyright © 1995-2008, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <strings.h>
8 #include "extstrings.h"
9 #include "afsblocks.h"
11 ULONG getHashKey(CONST_STRPTR name, ULONG tablesize, UBYTE flags) {
12 ULONG result;
13 UWORD length, i;
15 length=strlen(name);
16 if (length>MAX_NAME_LENGTH)
17 length=MAX_NAME_LENGTH;
18 result=length;
19 for (i=0; i<length; i++)
20 result=(result * 13 + capitalch(*name++,flags)) & 0x7FF;
21 return result%tablesize;