Update libds.

This commit is contained in:
2017-07-20 21:58:51 -07:00
parent 1399934a24
commit 8d1178788a
3 changed files with 11 additions and 11 deletions

View File

@@ -1,19 +1,19 @@
#include "pairmap.h"
#include <stdlib.h>
unsigned long pairmap_hash_func(void* key){
pairmap_key* new_key = key;
unsigned long pairmap_hash_func(const void* key){
const pairmap_key* new_key = key;
unsigned int hash = 0;
hash |= ((new_key->x & 0xffff) << 8) + (new_key->y & 0xffff);
return hash;
}
int pairmap_cmp_func(void* a, void* b){
pairmap_key* new_key_a = a;
pairmap_key* new_key_b = b;
int pairmap_cmp_func(const void* a, const void* b){
const pairmap_key* new_key_a = a;
const pairmap_key* new_key_b = b;
return (new_key_a->x == new_key_b->x) && (new_key_a->y == new_key_b->y);
}
void* pairmap_copy_func(void* key){
pairmap_key* copy_from = key;
void* pairmap_copy_func(const void* key){
const pairmap_key* copy_from = key;
pairmap_key* new_key = malloc(sizeof(*new_key));
if(new_key){
new_key->x = copy_from->x;