ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/util.h
(Generate patch)

Comparing deliantra/server/include/util.h (file contents):
Revision 1.96 by root, Wed Nov 11 03:52:44 2009 UTC vs.
Revision 1.98 by root, Fri Apr 2 03:41:24 2010 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * 5 *
6 * Deliantra is free software: you can redistribute it and/or modify it under 6 * Deliantra is free software: you can redistribute it and/or modify it under
7 * the terms of the Affero GNU General Public License as published by the 7 * the terms of the Affero GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your 8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version. 9 * option) any later version.
573 // FNV-1a is faster on many cpus because the multiplication 573 // FNV-1a is faster on many cpus because the multiplication
574 // runs concurrently with the looping logic. 574 // runs concurrently with the looping logic.
575 uint32_t hash = STRHSH_NULL; 575 uint32_t hash = STRHSH_NULL;
576 576
577 while (*s) 577 while (*s)
578 hash = (hash ^ *s++) * 16777619; 578 hash = (hash ^ *s++) * 16777619U;
579 579
580 return hash; 580 return hash;
581} 581}
582 582
583static inline uint32_t 583static inline uint32_t
584memhsh (const char *s, size_t len) 584memhsh (const char *s, size_t len)
585{ 585{
586 uint32_t hash = STRHSH_NULL; 586 uint32_t hash = STRHSH_NULL;
587 587
588 while (len--) 588 while (len--)
589 hash = (hash ^ *s++) * 16777619; 589 hash = (hash ^ *s++) * 16777619U;
590 590
591 return hash; 591 return hash;
592} 592}
593 593
594struct str_hash 594struct str_hash

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines