00001 00010 00011 #ifndef _EPUTILS_H_ 00012 #define _EPUTILS_H_ 00013 00014 #include "epDefs.h" 00015 00016 /* "graine" utilisée pour la génération de la valeur de hashage 00017 par défaut d'une chaîne de caractère */ 00018 #define _B_ 128 00019 00020 00021 00022 /* 00023 Generic pointer deallocator function (in fact, it just make a free).<br> 00024 00025 <b>visibility :: <i>public</i></b> 00026 00027 @param ptr the pointer to deallocate 00028 @retval 0 if <b>OK</b>, 00029 @retval -1 else. 00030 */ 00031 int epUtils_ptrDeallocatorFunction(void *ptr); 00032 00033 /* 00034 Estimate if a number is a <b>prime</b> number.<br> 00035 return <true> if so, <false> else.<br> 00036 00037 <b>visibility :: <i>public</i></b> 00038 00039 @param oddNumber a number 00040 @retval <true> if it is prime, 00041 @retval <false> else. 00042 */ 00043 boolean_t epUtils_isProbablePrime(ulong oddNumber); 00044 00045 /* 00046 A Generic string comparison function (which take care of the case).<b> 00047 00048 <b>visibility :: <i>public</i></b> 00049 00050 @param str1 the first string 00051 @param str2 the second string 00052 @retval <true> if they are equals, 00053 @retval <false> else. 00054 */ 00055 boolean_t epUtils_stringComparisonFunction(const void *str1, const void *str2); 00056 00057 /* 00058 A Generic hash function for <i>string-typed</i> keys.<br> 00059 00060 <b>visibility :: <i>public</i></b> 00061 00062 @remarks 00063 1. hash function used is: 00064 <i>h(c) = ( s[0]*b^(n-1) + s[1]*b^(n-2) + ... + s[n-1] )</i> 00065 00066 where: 00067 s is the key 00068 n its length 00069 b = 128 or 256 00070 00071 @param key the key(a string) 00072 @return its hash value. 00073 */ 00074 uint epUtils_stringHashFunction(const void *key); 00075 00076 #endif /* _EPUTILS_H_ */ 00077
1.2.1 written by Dimitri van Heesch,
© 1997-2000