Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 6e1a79c

Browse files
committed
Add u128 PartialEq impl in mini_core.rs
1 parent 77a9eff commit 6e1a79c

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

example/mini_core.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ unsafe impl Copy for u8 {}
5959
unsafe impl Copy for u16 {}
6060
unsafe impl Copy for u32 {}
6161
unsafe impl Copy for u64 {}
62+
unsafe impl Copy for u128 {}
6263
unsafe impl Copy for usize {}
6364
unsafe impl Copy for i8 {}
6465
unsafe impl Copy for i16 {}
@@ -79,6 +80,7 @@ unsafe impl Sync for u8 {}
7980
unsafe impl Sync for u16 {}
8081
unsafe impl Sync for u32 {}
8182
unsafe impl Sync for u64 {}
83+
unsafe impl Sync for u128 {}
8284
unsafe impl Sync for usize {}
8385
unsafe impl Sync for i8 {}
8486
unsafe impl Sync for i16 {}
@@ -294,6 +296,15 @@ impl PartialEq for u64 {
294296
}
295297
}
296298

299+
impl PartialEq for u128 {
300+
fn eq(&self, other: &u128) -> bool {
301+
(*self) == (*other)
302+
}
303+
fn ne(&self, other: &u128) -> bool {
304+
(*self) != (*other)
305+
}
306+
}
307+
297308
impl PartialEq for usize {
298309
fn eq(&self, other: &usize) -> bool {
299310
(*self) == (*other)

example/mini_core_hello_world.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,7 @@ fn main() {
171171
assert_eq!(intrinsics::bitreverse(0xddccu16), 0x33bbu16);
172172
assert_eq!(intrinsics::bitreverse(0xffee_ddccu32), 0x33bb77ffu32);
173173
assert_eq!(intrinsics::bitreverse(0x1234_5678_ffee_ddccu64), 0x33bb77ff1e6a2c48u64);
174-
// != cannot be applied to type u128?
175-
// assert_eq!(intrinsics::bitreverse(0x1234_5678_ffee_ddcc_1234_5678_ffee_ddccu128), 0x33bb77ff1e6a2c4833bb77ff1e6a2c48u128);
174+
assert_eq!(intrinsics::bitreverse(0x1234_5678_ffee_ddcc_1234_5678_ffee_ddccu128), 0x33bb77ff1e6a2c4833bb77ff1e6a2c48u128);
176175

177176
assert_eq!(intrinsics::bswap(0xabu8), 0xabu8);
178177
assert_eq!(intrinsics::bswap(0xddccu16), 0xccddu16);

0 commit comments

Comments
 (0)