Skip to content

Commit

Permalink
dict_hash is for debug only
Browse files Browse the repository at this point in the history
  • Loading branch information
randy3k committed Jan 3, 2023
1 parent 694684e commit 32f0228
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion R/collections.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/collections.c
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
20 changes: 10 additions & 10 deletions src/dict.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/dict.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <Rinternals.h>


SEXP dict_hash(SEXP key);
// SEXP dict_hash(SEXP key);

SEXP dict_get(SEXP self, SEXP _key);

Expand Down

0 comments on commit 32f0228

Please sign in to comment.