Skip to content

Commit

Permalink
Fix compile on arm-linux-androideabi (32-bit) using a newer NDK
Browse files Browse the repository at this point in the history
- @tobtoht reported err with size_t -> uint64_t
- Also address some PR comments (@vtnerd namespace comment +
@Boog900 freeing unallocated rust type)
- Some cleaning
  • Loading branch information
j-berman committed Sep 3, 2024
1 parent 47d47bd commit 41b1985
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
3 changes: 1 addition & 2 deletions src/fcmp_pp/curve_trees.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -644,8 +644,7 @@ static typename fcmp_pp::curve_trees::LayerReduction<C_PARENT> get_next_layer_re
// CurveTrees public member functions
//----------------------------------------------------------------------------------------------------------------------
template<>
CurveTrees<Helios, Selene>::LeafTuple CurveTrees<Helios, Selene>::leaf_tuple(
const OutputPair &output_pair) const
CurveTrees<Helios, Selene>::LeafTuple CurveTrees<Helios, Selene>::leaf_tuple(const OutputPair &output_pair) const
{
const crypto::public_key &output_pubkey = output_pair.output_pubkey;
const rct::key &commitment = output_pair.commitment;
Expand Down
17 changes: 10 additions & 7 deletions src/fcmp_pp/curve_trees.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,15 @@ template<typename C1, typename C2>
class CurveTrees
{
public:
CurveTrees(std::unique_ptr<C1> &&c1, std::unique_ptr<C2> &&c2, const uint64_t c1_width, const uint64_t c2_width):
m_c1{std::move(c1)},
m_c2{std::move(c2)},
m_c1_width{c1_width},
m_c2_width{c2_width},
m_leaf_layer_chunk_width{LEAF_TUPLE_SIZE * c2_width}
CurveTrees(std::unique_ptr<C1> &&c1,
std::unique_ptr<C2> &&c2,
const std::size_t c1_width,
const std::size_t c2_width):
m_c1{std::move(c1)},
m_c2{std::move(c2)},
m_c1_width{c1_width},
m_c2_width{c2_width},
m_leaf_layer_chunk_width{LEAF_TUPLE_SIZE * c2_width}
{
assert(c1_width > 0);
assert(c2_width > 0);
Expand Down Expand Up @@ -240,7 +243,7 @@ class CurveTrees
//member functions
public:
// Convert output pairs into leaf tuples, from {output pubkey,commitment} -> {O,C} -> {O.x,I.x,C.x}
LeafTuple leaf_tuple(const OutputPair &outpout_pair) const;
LeafTuple leaf_tuple(const OutputPair &output_pair) const;

// Flatten leaves [(O.x, I.x, C.x),(O.x, I.x, C.x),...] -> [O.x, I.x, C.x, O.x, I.x, C.x...]
std::vector<typename C2::Scalar> flatten_leaves(std::vector<LeafTuple> &&leaves) const;
Expand Down
7 changes: 4 additions & 3 deletions src/fcmp_pp/fcmp_pp_rust/fcmp++.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
namespace fcmp_pp_rust {
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
#include <ostream>
#include <new>


namespace fcmp_pp_rust
{
// ----- deps C bindings -----

/// Inner integer type that the [`Limb`] newtype wraps.
Expand Down Expand Up @@ -137,5 +139,4 @@ CResult hash_trim_selene(SelenePoint existing_hash,
SeleneScalar child_to_grow_back);

} // extern "C"

}
}//namespace fcmp_pp
4 changes: 4 additions & 0 deletions src/fcmp_pp/fcmp_pp_rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ pub extern "C" fn hash_grow_helios(
if let Some(hash) = hash {
CResult::ok(hash)
} else {
// TODO: return defined error here: https://github.com/monero-project/monero/pull/9436#discussion_r1720477391
CResult::err(())
}
}
Expand All @@ -174,6 +175,7 @@ pub extern "C" fn hash_trim_helios(
if let Some(hash) = hash {
CResult::ok(hash)
} else {
// TODO: return defined error here: https://github.com/monero-project/monero/pull/9436#discussion_r1720477391
CResult::err(())
}
}
Expand All @@ -196,6 +198,7 @@ pub extern "C" fn hash_grow_selene(
if let Some(hash) = hash {
CResult::ok(hash)
} else {
// TODO: return defined error here: https://github.com/monero-project/monero/pull/9436#discussion_r1720477391
CResult::err(())
}
}
Expand All @@ -218,6 +221,7 @@ pub extern "C" fn hash_trim_selene(
if let Some(hash) = hash {
CResult::ok(hash)
} else {
// TODO: return defined error here: https://github.com/monero-project/monero/pull/9436#discussion_r1720477391
CResult::err(())
}
}
Expand Down

0 comments on commit 41b1985

Please sign in to comment.