Skip to content

Commit 440b366

Browse files
fix: minor issue
Use saturating add/mul instead of wrapping bench: 2517656
1 parent e856eb5 commit 440b366

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

engine/src/history_table.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub struct HistoryTable {
1111
}
1212

1313
/// Safe calculation of the bonus applied to quiet moves that are inserted into the history table.
14-
/// This uses `wrapping_mul` and `wrapping_sub` to safely calculate the value.
14+
/// This uses `wrappinag_mul` and `wrapping_sub` to safely calculate the value.
1515
///
1616
/// # Arguments
1717
///
@@ -22,8 +22,8 @@ pub struct HistoryTable {
2222
/// The calculated history score.
2323
pub(crate) fn calculate_bonus_for_depth(depth: i16) -> i16 {
2424
depth
25-
.wrapping_mul(Score::HISTORY_MULT)
26-
.wrapping_sub(Score::HISTORY_OFFSET)
25+
.saturating_mul(Score::HISTORY_MULT)
26+
.saturating_sub(Score::HISTORY_OFFSET)
2727
}
2828

2929
impl HistoryTable {
@@ -122,3 +122,4 @@ mod tests {
122122
}
123123
}
124124
}
125+

0 commit comments

Comments
 (0)