Skip to content

Commit 01352f0

Browse files
mtak-gnzlbg
authored andcommitted
return u8 from _xtest to more closely match headers (specified to always be 0 or 1)
1 parent c8eaff0 commit 01352f0

File tree

1 file changed

+4
-4
lines changed
  • crates/core_arch/src/x86

1 file changed

+4
-4
lines changed

crates/core_arch/src/x86/rtm.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ pub unsafe fn _xabort(imm8: u32) {
9292
#[inline]
9393
#[target_feature(enable = "rtm")]
9494
#[cfg_attr(test, assert_instr(xtest))]
95-
pub unsafe fn _xtest() -> bool {
96-
x86_xtest() != 0
95+
pub unsafe fn _xtest() -> u8 {
96+
x86_xtest() as _
9797
}
9898

9999
/// Retrieves the parameter passed to [`_xabort`] when [`_xbegin`]'s status has the
@@ -145,7 +145,7 @@ mod tests {
145145

146146
#[simd_test(enable = "rtm")]
147147
unsafe fn test_xtest() {
148-
assert_eq!(_xtest(), false);
148+
assert_eq!(_xtest(), 0);
149149

150150
for _ in 0..10 {
151151
let code = rtm::_xbegin();
@@ -155,7 +155,7 @@ mod tests {
155155

156156
// putting the assert inside the transaction would abort the transaction on fail
157157
// without any output/panic/etc
158-
assert_eq!(in_tx, true);
158+
assert_eq!(in_tx, 1);
159159
break
160160
}
161161
}

0 commit comments

Comments
 (0)