File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -142,13 +142,12 @@ impl Not for Choice {
142
142
///
143
143
/// Uses inline asm when available, otherwise it's a no-op.
144
144
#[ cfg( all( feature = "nightly" , not( any( target_arch = "asmjs" , target_arch = "wasm32" ) ) ) ) ]
145
- fn black_box ( input : u8 ) -> u8 {
145
+ #[ inline( always) ]
146
+ fn black_box ( mut input : u8 ) -> u8 {
146
147
debug_assert ! ( ( input == 0u8 ) | ( input == 1u8 ) ) ;
147
148
148
- // Pretend to access a register containing the input. We "volatile" here
149
- // because some optimisers treat assembly templates without output operands
150
- // as "volatile" while others do not.
151
- unsafe { asm ! ( "" :: "r" ( & input) :: "volatile" ) }
149
+ // Move value through assembler, which is opaque to the compiler, even though we don't do anything.
150
+ unsafe { asm ! ( "" : "=r" ( input) : "0" ( input) ) }
152
151
153
152
input
154
153
}
You can’t perform that action at this time.
0 commit comments