Skip to content

Commit 6aea814

Browse files
committed
Add comments and format the code
1 parent d1e6e17 commit 6aea814

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/librustc_codegen_llvm/builder.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -479,11 +479,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
479479
let llptr = self.struct_gep(place.llval, i as u64);
480480
let load = self.load(llptr, align);
481481
scalar_load_metadata(self, load, scalar);
482-
if scalar.is_bool() {
483-
self.trunc(load, self.type_i1())
484-
} else {
485-
load
486-
}
482+
if scalar.is_bool() { self.trunc(load, self.type_i1()) } else { load }
487483
};
488484

489485
OperandValue::Pair(
@@ -658,6 +654,9 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
658654
}
659655

660656
fn fptoui_sat(&mut self, val: &'ll Value, dest_ty: &'ll Type) -> Option<&'ll Value> {
657+
// WebAssembly has saturating floating point to integer casts if the
658+
// `nontrapping-fptoint` target feature is activated. We'll use those if
659+
// they are available.
661660
if self.sess().target.target.arch == "wasm32"
662661
&& self.sess().target_features.contains(&sym::wasm_nontrapping_fptoint)
663662
{
@@ -680,6 +679,9 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
680679
}
681680

682681
fn fptosi_sat(&mut self, val: &'ll Value, dest_ty: &'ll Type) -> Option<&'ll Value> {
682+
// WebAssembly has saturating floating point to integer casts if the
683+
// `nontrapping-fptoint` target feature is activated. We'll use those if
684+
// they are available.
683685
if self.sess().target.target.arch == "wasm32"
684686
&& self.sess().target_features.contains(&sym::wasm_nontrapping_fptoint)
685687
{

0 commit comments

Comments
 (0)