From 32f02287e7364667a6defb97aae2d8be2c906fe5 Mon Sep 17 00:00:00 2001 From: Randy Lai Date: Tue, 3 Jan 2023 13:14:24 -0800 Subject: [PATCH] dict_hash is for debug only --- R/collections.R | 2 +- src/collections.c | 2 +- src/dict.c | 20 ++++++++++---------- src/dict.h | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/R/collections.R b/R/collections.R index a4a6f22..e14fa79 100644 --- a/R/collections.R +++ b/R/collections.R @@ -2,7 +2,7 @@ #' @useDynLib collections, .registration = TRUE, .fixes = "C_" "_PACKAGE" -dict_hash <- function(key) .Call(C_dict_hash, key) +# dict_hash <- function(key) .Call(C_dict_hash, key) #' @title Inspect objects #' @description diff --git a/src/collections.c b/src/collections.c index b775c54..5329de7 100644 --- a/src/collections.c +++ b/src/collections.c @@ -27,7 +27,7 @@ static const R_CallMethodDef CallEntries[] = { {"deque_peek", (DL_FUNC) &deque_peek, 1}, {"deque_remove", (DL_FUNC) &deque_remove, 2}, {"deque_clear", (DL_FUNC) &deque_clear, 1}, - {"dict_hash", (DL_FUNC) &dict_hash, 1}, + // {"dict_hash", (DL_FUNC) &dict_hash, 1}, {"dict_get", (DL_FUNC) &dict_get, 2}, {"dict_set", (DL_FUNC) &dict_set, 3}, {"dict_remove", (DL_FUNC) &dict_remove, 3}, diff --git a/src/dict.c b/src/dict.c index fb07e34..a6e3742 100644 --- a/src/dict.c +++ b/src/dict.c @@ -89,16 +89,16 @@ tommy_hash_t key_to_u64(SEXP key) { } -SEXP dict_hash(SEXP key) { - tommy_hash_t h = key_to_u64(key); - char* p = R_alloc(17, sizeof(char)); - char* c = (char*) &h; - for(int j = 0; j < 8; j++) { - sprintf(p + 2*j, "%02x", c[j]); - } - p[16] = 0; - return Rf_mkString(p); -} +// SEXP dict_hash(SEXP key) { +// tommy_hash_t h = key_to_u64(key); +// char* p = R_alloc(17, sizeof(char)); +// char* c = (char*) &h; +// for(int j = 0; j < 8; j++) { +// sprintf(p + 2*j, "%02x", c[j]); +// } +// p[16] = 0; +// return Rf_mkString(p); +// } static tommy_hashlin* init_hashlin(SEXP self, SEXP ht_xptr) { diff --git a/src/dict.h b/src/dict.h index 797467c..316a01c 100644 --- a/src/dict.h +++ b/src/dict.h @@ -6,7 +6,7 @@ #include -SEXP dict_hash(SEXP key); +// SEXP dict_hash(SEXP key); SEXP dict_get(SEXP self, SEXP _key);