Skip to content

Commit

Permalink
remove raw_slice eq from core
Browse files Browse the repository at this point in the history
  • Loading branch information
xunilrj committed Jun 25, 2024
1 parent 7159b7e commit 8512164
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 21 deletions.
21 changes: 0 additions & 21 deletions sway-lib-core/src/ops.sw
Original file line number Diff line number Diff line change
Expand Up @@ -608,27 +608,6 @@ impl Eq for raw_ptr {
}
}

impl Eq for raw_slice {
fn eq(self, other: Self) -> bool {
let (l_ptr, l_len) = asm(l: self) {
l: (raw_ptr, u64)
};

let (r_ptr, r_len) = asm(r: self) {
r: (raw_ptr, u64)
};

if l_len != r_len {
return false;
}

asm(result, r2: l_ptr, r3: r_ptr, r4: l_len) {
meq result r2 r3 r4;
result: bool
}
}
}

/// Trait to evaluate if one value is greater or less than another of the same type.
pub trait Ord {
/// Evaluates if one value of the same type is greater than another.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ impl TestInstance for raw_slice {
}
}

impl Eq for raw_slice {
fn eq(self, other: Self) -> bool {
self.ptr() == other.ptr() && self.number_of_bytes() == other.number_of_bytes()
}
}

impl TestInstance for () {
fn new() -> Self {
()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ impl TestInstance for raw_slice {
}
}

impl Eq for raw_slice {
fn eq(self, other: Self) -> bool {
self.ptr() == other.ptr() && self.number_of_bytes() == other.number_of_bytes()
}
}

impl TestInstance for () {
fn new() -> Self {
()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ impl TestInstance for raw_slice {
}
}

impl Eq for raw_slice {
fn eq(self, other: Self) -> bool {
self.ptr() == other.ptr() && self.number_of_bytes() == other.number_of_bytes()
}
}

impl TestInstance for () {
fn new() -> Self {
()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ impl TestInstance for raw_slice {
}
}

impl Eq for raw_slice {
fn eq(self, other: Self) -> bool {
self.ptr() == other.ptr() && self.number_of_bytes() == other.number_of_bytes()
}
}

impl TestInstance for () {
fn new() -> Self {
()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@ impl TestInstance for raw_slice {
}
}

impl Eq for raw_slice {
fn eq(self, other: Self) -> bool {
self.ptr() == other.ptr() && self.number_of_bytes() == other.number_of_bytes()
}
}

impl TestInstance for () {
fn new() -> Self {
()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,12 @@ impl TestInstance for raw_slice {
}
}

impl Eq for raw_slice {
fn eq(self, other: Self) -> bool {
self.ptr() == other.ptr() && self.number_of_bytes() == other.number_of_bytes()
}
}

impl TestInstance for () {
fn new() -> Self {
()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,12 @@ impl TestInstance for raw_slice {
}
}

impl Eq for raw_slice {
fn eq(self, other: Self) -> bool {
self.ptr() == other.ptr() && self.number_of_bytes() == other.number_of_bytes()
}
}

impl TestInstance for () {
fn new() -> Self {
()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,12 @@ impl TestInstance for raw_slice {
}
}

impl Eq for raw_slice {
fn eq(self, other: Self) -> bool {
self.ptr() == other.ptr() && self.number_of_bytes() == other.number_of_bytes()
}
}

impl TestInstance for () {
fn new() -> Self {
()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ impl New for raw_slice {
}
}

impl Eq for raw_slice {
fn eq(self, other: Self) -> bool {
self.ptr() == other.ptr() && self.number_of_bytes() == other.number_of_bytes()
}
}

impl New for () {
fn new() -> Self {
()
Expand Down

0 comments on commit 8512164

Please sign in to comment.