X-Git-Url: https://git.distorted.org.uk/~mdw/mLib/blobdiff_plain/573eadb534c42c4feace5e493cc135dd5e7b00d9..8f45ff6cb9a269fc6f8f631908f93b4c8123419c:/unihash.h diff --git a/unihash.h b/unihash.h index dfc5b79..22cecf9 100644 --- a/unihash.h +++ b/unihash.h @@ -1,13 +1,13 @@ /* -*-c-*- * - * $Id: unihash.h,v 1.2 2003/12/14 14:45:30 mdw Exp $ + * $Id: unihash.h,v 1.4 2004/04/08 01:36:13 mdw Exp $ * * Simple and efficient universal hashing for hashtables * * (c) 2003 Straylight/Edgeware */ -/*----- Licensing notice --------------------------------------------------* +/*----- Licensing notice --------------------------------------------------* * * This file is part of the mLib utilities library. * @@ -15,29 +15,18 @@ * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. - * + * * mLib is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. - * + * * You should have received a copy of the GNU Library General Public * License along with mLib; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: unihash.h,v $ - * Revision 1.2 2003/12/14 14:45:30 mdw - * Test universal hashing and fix bugs. - * - * Revision 1.1 2003/10/12 14:43:24 mdw - * Universal hashing. - * - */ - #ifndef MLIB_UNIHASH_H #define MLIB_UNIHASH_H @@ -138,6 +127,10 @@ typedef struct unihash_info { uint32 s[UNIHASH_NBATCH][4][256]; /* S-tables as described */ } unihash_info; +/*----- A global hash-info table ------------------------------------------*/ + +extern unihash_info unihash_global; /* Key this if you like */ + /*----- Functions provided ------------------------------------------------*/ /* --- @unihash_setkey@ --- * @@ -161,7 +154,7 @@ extern void unihash_setkey(unihash_info */*i*/, uint32 /*k*/); * * Returns: Hash of data so far. * - * Use: Hashes data. Call this as many times as needed. + * Use: Hashes data. Call this as many times as needed. */ #define UNIHASH_INIT(i) ((i)->s[0][0][1]) /* %$k$% */ @@ -178,7 +171,7 @@ extern uint32 unihash_hash(const unihash_info */*i*/, uint32 /*a*/, * Returns: The hash value computed. * * Use: All-in-one hashing function. No faster than using the - * separate calls, but more convenient. + * separate calls, but more convenient. */ #define UNIHASH(i, p, sz) (unihash_hash((i), UNIHASH_INIT((i)), (p), (sz)))