Skip to content

Commit

Permalink
simplify get_chunk_idx to do integer division instead of float
Browse files Browse the repository at this point in the history
  • Loading branch information
fmontoto committed Sep 15, 2016
1 parent 822f144 commit e22fbc3
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions include/sdsl/k2_tree_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,11 @@ int _build_from_matrix(const std::vector<std::vector <int>>& 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<double>(v - r_0) / l) * k +
std::floor(static_cast<double>(u - c_0) / l);
return ((v - r_0) / l) * k + (u - c_0) / l;
}

template<typename t_bv=bit_vector> 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_);
Expand Down

0 comments on commit e22fbc3

Please sign in to comment.