mirror of
https://github.com/monero-project/monero.git
synced 2025-01-07 10:17:53 -05:00
Touch up merge for cross-compilation fixes
This commit is contained in:
parent
23be5f6c28
commit
aadea07b51
@ -176,7 +176,7 @@ pub extern "C" fn hash_trim_helios(
|
||||
offset: usize,
|
||||
children: HeliosScalarSlice,
|
||||
child_to_grow_back: HeliosScalar,
|
||||
) -> CResult<HeliosPoint, io::Error> {
|
||||
) -> CResult<HeliosPoint, ()> {
|
||||
let hash = hash_trim(
|
||||
helios_generators(),
|
||||
existing_hash,
|
||||
@ -188,10 +188,7 @@ pub extern "C" fn hash_trim_helios(
|
||||
if let Some(hash) = hash {
|
||||
CResult::ok(hash)
|
||||
} else {
|
||||
CResult::err(
|
||||
HeliosPoint::identity(),
|
||||
io::Error::new(io::ErrorKind::Other, "failed to trim hash"),
|
||||
)
|
||||
CResult::err(())
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,7 +220,7 @@ pub extern "C" fn hash_trim_selene(
|
||||
offset: usize,
|
||||
children: SeleneScalarSlice,
|
||||
child_to_grow_back: SeleneScalar,
|
||||
) -> CResult<SelenePoint, io::Error> {
|
||||
) -> CResult<SelenePoint, ()> {
|
||||
let hash = hash_trim(
|
||||
selene_generators(),
|
||||
existing_hash,
|
||||
@ -235,10 +232,7 @@ pub extern "C" fn hash_trim_selene(
|
||||
if let Some(hash) = hash {
|
||||
CResult::ok(hash)
|
||||
} else {
|
||||
CResult::err(
|
||||
SelenePoint::identity(),
|
||||
io::Error::new(io::ErrorKind::Other, "failed to trim hash"),
|
||||
)
|
||||
CResult::err(())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ Helios::Point Helios::hash_grow(
|
||||
}
|
||||
|
||||
typename Helios::Point res;
|
||||
memcpy(&res, result.value, sizeof(typename Selene::Point));
|
||||
memcpy(&res, result.value, sizeof(typename Helios::Point));
|
||||
free(result.value);
|
||||
return res;
|
||||
}
|
||||
@ -75,15 +75,22 @@ Helios::Point Helios::hash_trim(
|
||||
const Helios::Chunk &children,
|
||||
const Helios::Scalar &child_to_grow_back) const
|
||||
{
|
||||
fcmp_rust::CResult<Helios::Point> res = fcmp_rust::hash_trim_helios(
|
||||
auto result = fcmp_rust::hash_trim_helios(
|
||||
existing_hash,
|
||||
offset,
|
||||
children,
|
||||
child_to_grow_back);
|
||||
if (res.err != 0) {
|
||||
throw std::runtime_error("failed to hash trim");
|
||||
|
||||
if (result.err != nullptr)
|
||||
{
|
||||
free(result.err);
|
||||
throw std::runtime_error("failed to hash trim");
|
||||
}
|
||||
return res.value;
|
||||
|
||||
typename Helios::Point res;
|
||||
memcpy(&res, result.value, sizeof(typename Helios::Point));
|
||||
free(result.value);
|
||||
return res;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
Selene::Point Selene::hash_grow(
|
||||
@ -116,15 +123,22 @@ Selene::Point Selene::hash_trim(
|
||||
const Selene::Chunk &children,
|
||||
const Selene::Scalar &child_to_grow_back) const
|
||||
{
|
||||
fcmp_rust::CResult<Selene::Point> res = fcmp_rust::hash_trim_selene(
|
||||
auto result = fcmp_rust::hash_trim_selene(
|
||||
existing_hash,
|
||||
offset,
|
||||
children,
|
||||
child_to_grow_back);
|
||||
if (res.err != 0) {
|
||||
throw std::runtime_error("failed to hash trim");
|
||||
|
||||
if (result.err != nullptr)
|
||||
{
|
||||
free(result.err);
|
||||
throw std::runtime_error("failed to hash trim");
|
||||
}
|
||||
return res.value;
|
||||
|
||||
typename Selene::Point res;
|
||||
memcpy(&res, result.value, sizeof(typename Selene::Point));
|
||||
free(result.value);
|
||||
return res;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
Helios::Scalar Helios::zero_scalar() const
|
||||
|
Loading…
Reference in New Issue
Block a user