From c74caa0f82ece8abb9179b3cf1416f6ac5e76bbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Sun, 6 Jan 2019 13:18:04 +0100 Subject: [PATCH] feat: Sum usizes instead of little u16/u32 --- src/rank/criterion/sum_of_words_attribute.rs | 4 ++-- src/rank/criterion/sum_of_words_position.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rank/criterion/sum_of_words_attribute.rs b/src/rank/criterion/sum_of_words_attribute.rs index cfcaaec68..aea21c35f 100644 --- a/src/rank/criterion/sum_of_words_attribute.rs +++ b/src/rank/criterion/sum_of_words_attribute.rs @@ -8,11 +8,11 @@ use crate::database::DatabaseView; use crate::rank::criterion::Criterion; #[inline] -fn sum_matches_attributes(matches: &Matches) -> u16 { +fn sum_matches_attributes(matches: &Matches) -> usize { // note that GroupBy will never return an empty group // so we can do this assumption safely matches.query_index_groups().map(|group| { - unsafe { group.get_unchecked(0).attribute.attribute() } + unsafe { group.get_unchecked(0).attribute.attribute() as usize } }).sum() } diff --git a/src/rank/criterion/sum_of_words_position.rs b/src/rank/criterion/sum_of_words_position.rs index e1d650534..0b27184ba 100644 --- a/src/rank/criterion/sum_of_words_position.rs +++ b/src/rank/criterion/sum_of_words_position.rs @@ -8,11 +8,11 @@ use crate::rank::criterion::Criterion; use crate::database::DatabaseView; #[inline] -fn sum_matches_attribute_index(matches: &Matches) -> u32 { +fn sum_matches_attribute_index(matches: &Matches) -> usize { // note that GroupBy will never return an empty group // so we can do this assumption safely matches.query_index_groups().map(|group| { - unsafe { group.get_unchecked(0).attribute.word_index() } + unsafe { group.get_unchecked(0).attribute.word_index() as usize } }).sum() }