diff options
author | 2021-12-23 17:52:56 +0000 | |
---|---|---|
committer | 2021-12-26 09:31:14 -0800 | |
commit | 0a40ca26e4e0781055fded814396de9d1c3980d0 (patch) | |
tree | 153c55b741c226ed6014bbedf59fce54e23c341a | |
parent | 161ef95308f6faf4b47a1425054e0104a0348cbc (diff) | |
download | rust-x86-0a40ca26e4e0781055fded814396de9d1c3980d0.tar.gz rust-x86-0a40ca26e4e0781055fded814396de9d1c3980d0.tar.zst rust-x86-0a40ca26e4e0781055fded814396de9d1c3980d0.zip |
Fix a 32-bit compatibility issue with asm!()
Signed-off-by: Dan Cross <cross@gajendra.net>
-rw-r--r-- | src/lib.rs | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -117,9 +117,12 @@ mod x86testing { /// May fail with #UD if rdpid is not supported (check CPUID). #[inline(always)] pub unsafe fn rdpid() -> u64 { + #[cfg(target_pointer_width = "64")] let mut pid: u64; + #[cfg(target_pointer_width = "32")] + let mut pid: u32; asm!("rdpid {pid}", pid = out(reg) pid, options(att_syntax)); - pid + pid.into() } #[cfg(all(test, feature = "utest"))] |