Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

epUtils.c

Go to the documentation of this file.
00001 
00010 
00011 #include <stdio.h>
00012 #include <stdlib.h>
00013 #include <string.h>
00014 #include <math.h>
00015 #include "epDefs.h"
00016 #include "epUtils.h"
00017 
00027 int epUtils_ptrDeallocatorFunction(void *ptr)
00028 {
00029   _DEBUG2("entering...");
00030   free(ptr);
00031   _RETURN(0);
00032 }
00033 
00044 boolean_t epUtils_isProbablePrime(ulong oddNumber) 
00045 {
00046   ulong i;
00047 
00048   _DEBUG2("entering...");
00049   _IF_TRUE_RETURN(oddNumber%2 == 0, 0, _false);
00050 
00051   for(i = 3; i < 51; i += 2)
00052     {
00053       if(oddNumber == i)
00054         { _RETURN(_true); }
00055       else if(oddNumber%i == 0)
00056         { _RETURN(_false); }
00057     }
00058 
00059   _RETURN(_true); /* maybe */
00060 }
00061 
00072 boolean_t epUtils_stringComparisonFunction(const void *str1, const void *str2)
00073 {
00074   _DEBUG2("entering...");
00075   _RETURN((!strcmp((char *)str1, (char *)str2))?_true:_false);
00076 }
00077 
00095 uint epUtils_stringHashFunction(const void *key)
00096 {
00097   int i,
00098       keyLen;
00099   char *strKey =(char *) key;
00100   double hashVal = 0.0;
00101 
00102   _DEBUG2("entering...");
00103   keyLen =(int) strlen(strKey);
00104 
00105   for(i = 0; i < keyLen; i++)
00106     { hashVal += strKey[i] * pow(_B_, (keyLen - i - 1)); }
00107 
00108   _RETURN((int) hashVal);
00109 }

Generated at Sun Nov 25 14:05:07 2001 for ExtendedPersonnalLibrary by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000