From 9736e22b63f8c1eb820a661fce58211db165cd73 Mon Sep 17 00:00:00 2001 From: James Melville Date: Fri, 4 Jan 2019 08:33:12 -0800 Subject: [PATCH] Update to https://github.com/nmslib/hnswlib/commit/9c2a2e58d264db2bcedc064aa9d2c2944005f187 (fixes https://github.com/nmslib/hnswlib/issues/87). --- inst/include/hnswalg.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/inst/include/hnswalg.h b/inst/include/hnswalg.h index 67e7a38..e350da8 100644 --- a/inst/include/hnswalg.h +++ b/inst/include/hnswalg.h @@ -139,7 +139,9 @@ namespace hnswlib { std::default_random_engine level_generator_; inline labeltype getExternalLabel(tableint internal_id) const { - return *((labeltype *) (data_level0_memory_ + internal_id * size_data_per_element_ + label_offset_)); + labeltype return_label; + memcpy(&return_label,(data_level0_memory_ + internal_id * size_data_per_element_ + label_offset_), sizeof(labeltype)); + return return_label; } inline labeltype *getExternalLabeLp(tableint internal_id) const {