feat: Sum usizes instead of little u16/u32

This commit is contained in:
Clément Renault 2019-01-06 13:18:04 +01:00
parent d899b86603
commit c74caa0f82
No known key found for this signature in database
GPG Key ID: 0151CDAB43460DAE
2 changed files with 4 additions and 4 deletions

View File

@ -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()
}

View File

@ -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()
}