Skip to content

Commit

Permalink
32-bit platform compatibility in Rust FFI (untested)
Browse files Browse the repository at this point in the history
  • Loading branch information
j-berman committed Aug 8, 2024
1 parent 10c6c12 commit 3a5cf70
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/fcmp/fcmp_rust/fcmp++.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ namespace fcmp_pp_rust {
// ----- deps C bindings -----

/// Inner integer type that the [`Limb`] newtype wraps.
// TODO: This is only valid for 64-bit platforms
using Word = uint64_t;
// TODO: test 32-bit platforms
using Word = uintptr_t;

/// Big integers are represented as an array of smaller CPU word-size integers
/// called "limbs".
Expand Down Expand Up @@ -49,14 +49,16 @@ struct Residue {

/// A constant-time implementation of the Ed25519 field.
struct SeleneScalar {
Residue<4> _0;
Residue<32 / sizeof(uintptr_t)> _0;
};
static_assert(sizeof(SeleneScalar) == 32, "unexpected size of selene scalar");


/// The field novel to Helios/Selene.
struct HeliosScalar {
Residue<4> _0;
Residue<32 / sizeof(uintptr_t)> _0;
};
static_assert(sizeof(HeliosScalar) == 32, "unexpected size of helios scalar");

struct HeliosPoint {
SeleneScalar x;
Expand Down

0 comments on commit 3a5cf70

Please sign in to comment.