unsigned int XYf::Hash(const XYf *p) { unsigned int h,temp; temp=HashFloat(p->x); h=sdbm_hash(&temp,sizeof(unsigned int)); temp=HashFloat(p->y); h=sdbm_hash(&temp,sizeof(unsigned int),h); return(h); }
globle int ItemHashValue( int theType, void *theValue, int theRange) { switch(theType) { case FLOAT: return(HashFloat(ValueToDouble(theValue),theRange)); case INTEGER: return(HashInteger(ValueToLong(theValue),theRange)); case SYMBOL: case STRING: #if OBJECT_SYSTEM case INSTANCE_NAME: #endif return(HashSymbol(ValueToString(theValue),theRange)); case MULTIFIELD: return(HashMultifield((struct multifield *) theValue,theRange)); #if DEFTEMPLATE_CONSTRUCT case FACT_ADDRESS: return(HashFact((struct fact *) theValue) % theRange); #endif case EXTERNAL_ADDRESS: #if OBJECT_SYSTEM case INSTANCE_ADDRESS: #endif return(((int) theValue) % theRange); default: SystemError("UTILITY",1); return(-1L); } return(-1L); }