+ /** Put a key entry into the table. */
+ _Val * ensureptr(_Key key) {
+ if(size > threshold) {
+ //Resize
+ unsigned int newsize = capacity << 1;
+ resize(newsize);
+ }
+
+ struct hashlistnode<_Key,_Val> *ptr = table[(((_KeyInt)key) & mask)>>_Shift];
+ size++;
+ struct hashlistnode<_Key,_Val> *search = ptr;
+
+ while(search!=NULL) {
+ if (search->key==key) {
+ return &search->val;
+ }
+ search=search->next;
+ }
+
+ struct hashlistnode<_Key,_Val> *newptr=(struct hashlistnode<_Key,_Val> *)new struct hashlistnode<_Key,_Val>;
+ newptr->key=key;
+ newptr->next=ptr;
+ table[(((_KeyInt)key)&mask)>>_Shift]=newptr;
+ return &newptr->val;
+ }
+
+ /** Lookup the corresponding value for the given key. */