From e22fbc3ba68b68ead2efcee491f2a2188d6ea948 Mon Sep 17 00:00:00 2001 From: fmontoto Date: Tue, 13 Sep 2016 00:32:13 -0300 Subject: [PATCH] simplify get_chunk_idx to do integer division instead of float --- include/sdsl/k2_tree_helper.hpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/include/sdsl/k2_tree_helper.hpp b/include/sdsl/k2_tree_helper.hpp index 7d51386ed..61ac99968 100644 --- a/include/sdsl/k2_tree_helper.hpp +++ b/include/sdsl/k2_tree_helper.hpp @@ -88,14 +88,11 @@ int _build_from_matrix(const std::vector>& matrix, inline uint16_t get_chunk_idx(idx_type v, idx_type u, idx_type c_0, idx_type r_0, size_type l, uint8_t k) { - return std::floor(static_cast(v - r_0) / l) * k + - std::floor(static_cast(u - c_0) / l); + return ((v - r_0) / l) * k + (u - c_0) / l; } template void build_template_vector(bit_vector& k_t_, - bit_vector& k_l_, - t_bv& k_t, - t_bv& k_l) + bit_vector& k_l_, t_bv& k_t, t_bv& k_l) { k_t = t_bv(k_t_); k_l = t_bv(k_l_);