Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lean on stable Ordering repr(i8) #503

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions rust/bridge/shared/src/protocol.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2021-2022 Signal Messenger, LLC.
// Copyright 2021-2023 Signal Messenger, LLC.
// SPDX-License-Identifier: AGPL-3.0-only
//

Expand Down Expand Up @@ -117,11 +117,8 @@ bridge_get!(ProtocolAddress::name as Name -> &str, ffi = "address_get_name");

#[bridge_fn(ffi = "publickey_compare", node = "PublicKey_Compare")]
fn ECPublicKey_Compare(key1: &PublicKey, key2: &PublicKey) -> i32 {
match key1.cmp(key2) {
std::cmp::Ordering::Less => -1,
std::cmp::Ordering::Equal => 0,
std::cmp::Ordering::Greater => 1,
}
// Rust encodes Ordering::{Less,Equal,Greater} as {-1,0,+1}.
key1.cmp(key2) as i32
}

#[bridge_fn(ffi = "publickey_verify", node = "PublicKey_Verify")]
Expand Down