We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Cmov
u8
1 parent 6778336 commit 4905af3Copy full SHA for 4905af3
cmov/src/lib.rs
@@ -70,21 +70,21 @@ pub trait CmovEq {
70
}
71
72
73
-// TODO(tarcieri): address truncation lint
74
-#[allow(clippy::cast_possible_truncation)]
75
impl Cmov for u8 {
76
#[inline]
77
fn cmovnz(&mut self, value: &Self, condition: Condition) {
78
let mut tmp = *self as u16;
79
tmp.cmovnz(&(*value as u16), condition);
80
- *self = tmp as u8;
+ debug_assert!(tmp <= u8::MAX as u16);
+ *self = (tmp & 0xFF) as u8;
81
82
83
84
fn cmovz(&mut self, value: &Self, condition: Condition) {
85
86
tmp.cmovz(&(*value as u16), condition);
87
88
89
90
0 commit comments