Skip to content

Commit bf2fa74

Browse files
committed
inline-asm: Update for new style
rust-lang/rust#73364 implemented support for providing multiple lines of assembly as separate arguments to `asm!`; update the blog post to use that new syntax, so that people who find it will use that style as an example.
1 parent a4e773c commit bf2fa74

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

posts/inside-rust/2020-06-08-new-inline-asm.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,16 @@ fn main() {
9494
for value in 0..=1024u64 {
9595
let popcnt;
9696
unsafe {
97-
asm!("
98-
popcnt {popcnt}, {v}
99-
2:
100-
blsi rax, {v}
101-
jz 1f
102-
xor {v}, rax
103-
tzcnt rax, rax
104-
stosb
105-
jmp 2b
106-
1:
107-
",
97+
asm!(
98+
" popcnt {popcnt}, {v}",
99+
"2:",
100+
" blsi rax, {v}",
101+
" jz 1f",
102+
" xor {v}, rax",
103+
" tzcnt rax, rax",
104+
" stosb",
105+
" jmp 2b",
106+
"1:",
108107
v = inout(reg) value => _,
109108
popcnt = out(reg) popcnt,
110109
out("rax") _, // scratch

0 commit comments

Comments
 (0)