]> git.lizzy.rs Git - rust.git/commitdiff
Fix saturating_{add,sub} for 8bit and 16bit ints
authorbjorn3 <bjorn3@users.noreply.github.com>
Mon, 19 Aug 2019 14:42:56 +0000 (16:42 +0200)
committerbjorn3 <bjorn3@users.noreply.github.com>
Mon, 19 Aug 2019 14:42:56 +0000 (16:42 +0200)
src/intrinsics.rs

index 1c14278866c0874f81ab0857b555dd65b2995700..c12730da7585dedca3d6157d2c6c586dc1486426 100644 (file)
@@ -513,8 +513,8 @@ pub fn codegen_intrinsic_call<'tcx>(
             let max = fx.bcx.ins().iconst(clif_ty, max);
 
             let val = match (intrinsic, signed) {
-                ("saturating_add", false) => fx.bcx.ins().select(has_overflow, max, val),
-                ("saturating_sub", false) => fx.bcx.ins().select(has_overflow, min, val),
+                ("saturating_add", false) => codegen_select(&mut fx.bcx, has_overflow, max, val),
+                ("saturating_sub", false) => codegen_select(&mut fx.bcx, has_overflow, min, val),
                 ("saturating_add", true) => unimplemented!(),
                 ("saturating_sub", true) => unimplemented!(),
                 _ => unreachable!(),