mirror of https://github.com/status-im/leopard.git
constify the data chunks themselves
This commit is contained in:
parent
cc0b02b4e8
commit
e078197da2
|
@ -1019,7 +1019,7 @@ void ReedSolomonEncode(
|
||||||
unsigned original_count,
|
unsigned original_count,
|
||||||
unsigned recovery_count,
|
unsigned recovery_count,
|
||||||
unsigned m,
|
unsigned m,
|
||||||
void* const * data,
|
const void* const * data,
|
||||||
void** work)
|
void** work)
|
||||||
{
|
{
|
||||||
// work <- data
|
// work <- data
|
||||||
|
@ -1296,8 +1296,8 @@ void ReedSolomonDecode(
|
||||||
unsigned recovery_count,
|
unsigned recovery_count,
|
||||||
unsigned m, // NextPow2(recovery_count)
|
unsigned m, // NextPow2(recovery_count)
|
||||||
unsigned n, // NextPow2(m + original_count) = work_count
|
unsigned n, // NextPow2(m + original_count) = work_count
|
||||||
void* const * const original, // original_count entries
|
const void* const * const original, // original_count entries
|
||||||
void* const * const recovery, // recovery_count entries
|
const void* const * const recovery, // recovery_count entries
|
||||||
void** work) // n entries
|
void** work) // n entries
|
||||||
{
|
{
|
||||||
// Fill in error locations
|
// Fill in error locations
|
||||||
|
|
|
@ -170,7 +170,7 @@ void ReedSolomonEncode(
|
||||||
unsigned original_count,
|
unsigned original_count,
|
||||||
unsigned recovery_count,
|
unsigned recovery_count,
|
||||||
unsigned m, // = NextPow2(recovery_count) * 2 = work_count
|
unsigned m, // = NextPow2(recovery_count) * 2 = work_count
|
||||||
void* const * const data,
|
const void* const * const data,
|
||||||
void** work); // Size of GetEncodeWorkCount()
|
void** work); // Size of GetEncodeWorkCount()
|
||||||
|
|
||||||
|
|
||||||
|
@ -183,8 +183,8 @@ void ReedSolomonDecode(
|
||||||
unsigned recovery_count,
|
unsigned recovery_count,
|
||||||
unsigned m, // = NextPow2(recovery_count)
|
unsigned m, // = NextPow2(recovery_count)
|
||||||
unsigned n, // = NextPow2(m + original_count) = work_count
|
unsigned n, // = NextPow2(m + original_count) = work_count
|
||||||
void* const * const original, // original_count entries
|
const void* const * const original, // original_count entries
|
||||||
void* const * const recovery, // recovery_count entries
|
const void* const * const recovery, // recovery_count entries
|
||||||
void** work); // n entries
|
void** work); // n entries
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -814,7 +814,7 @@ static void IFFT_DIT4(
|
||||||
|
|
||||||
void IFFT_DIT(
|
void IFFT_DIT(
|
||||||
const uint64_t bytes,
|
const uint64_t bytes,
|
||||||
void* const* data,
|
const void* const* data,
|
||||||
const unsigned m_truncated,
|
const unsigned m_truncated,
|
||||||
void** work,
|
void** work,
|
||||||
void** xor_result,
|
void** xor_result,
|
||||||
|
@ -1405,7 +1405,7 @@ void ReedSolomonEncode(
|
||||||
unsigned original_count,
|
unsigned original_count,
|
||||||
unsigned recovery_count,
|
unsigned recovery_count,
|
||||||
unsigned m,
|
unsigned m,
|
||||||
void* const* data,
|
const void* const* data,
|
||||||
void** work)
|
void** work)
|
||||||
{
|
{
|
||||||
// work <- IFFT(data, m, m)
|
// work <- IFFT(data, m, m)
|
||||||
|
@ -1552,8 +1552,8 @@ void ReedSolomonDecode(
|
||||||
unsigned recovery_count,
|
unsigned recovery_count,
|
||||||
unsigned m, // NextPow2(recovery_count)
|
unsigned m, // NextPow2(recovery_count)
|
||||||
unsigned n, // NextPow2(m + original_count) = work_count
|
unsigned n, // NextPow2(m + original_count) = work_count
|
||||||
void* const * const original, // original_count entries
|
const void* const * const original, // original_count entries
|
||||||
void* const * const recovery, // recovery_count entries
|
const void* const * const recovery, // recovery_count entries
|
||||||
void** work) // n entries
|
void** work) // n entries
|
||||||
{
|
{
|
||||||
// Fill in error locations
|
// Fill in error locations
|
||||||
|
|
|
@ -129,7 +129,7 @@ void ReedSolomonEncode(
|
||||||
unsigned original_count,
|
unsigned original_count,
|
||||||
unsigned recovery_count,
|
unsigned recovery_count,
|
||||||
unsigned m, // = NextPow2(recovery_count) * 2 = work_count
|
unsigned m, // = NextPow2(recovery_count) * 2 = work_count
|
||||||
void* const * const data,
|
const void* const * const data,
|
||||||
void** work); // Size of GetEncodeWorkCount()
|
void** work); // Size of GetEncodeWorkCount()
|
||||||
|
|
||||||
|
|
||||||
|
@ -142,8 +142,8 @@ void ReedSolomonDecode(
|
||||||
unsigned recovery_count,
|
unsigned recovery_count,
|
||||||
unsigned m, // = NextPow2(recovery_count)
|
unsigned m, // = NextPow2(recovery_count)
|
||||||
unsigned n, // = NextPow2(m + original_count) = work_count
|
unsigned n, // = NextPow2(m + original_count) = work_count
|
||||||
void* const * const original, // original_count entries
|
const void* const * const original, // original_count entries
|
||||||
void* const * const recovery, // recovery_count entries
|
const void* const * const recovery, // recovery_count entries
|
||||||
void** work); // n entries
|
void** work); // n entries
|
||||||
|
|
||||||
|
|
||||||
|
|
34
leopard.cpp
34
leopard.cpp
|
@ -105,7 +105,7 @@ LEO_EXPORT unsigned leo_encode_work_count(
|
||||||
static void EncodeM1(
|
static void EncodeM1(
|
||||||
uint64_t buffer_bytes,
|
uint64_t buffer_bytes,
|
||||||
unsigned original_count,
|
unsigned original_count,
|
||||||
void* const * const original_data,
|
const void* const * const original_data,
|
||||||
void* recovery_data)
|
void* recovery_data)
|
||||||
{
|
{
|
||||||
memcpy(recovery_data, original_data[0], buffer_bytes);
|
memcpy(recovery_data, original_data[0], buffer_bytes);
|
||||||
|
@ -120,13 +120,13 @@ static void EncodeM1(
|
||||||
}
|
}
|
||||||
|
|
||||||
LEO_EXPORT LeopardResult leo_encode(
|
LEO_EXPORT LeopardResult leo_encode(
|
||||||
uint64_t buffer_bytes, // Number of bytes in each data buffer
|
uint64_t buffer_bytes, // Number of bytes in each data buffer
|
||||||
unsigned original_count, // Number of original_data[] buffer pointers
|
unsigned original_count, // Number of original_data[] buffer pointers
|
||||||
unsigned recovery_count, // Number of recovery_data[] buffer pointers
|
unsigned recovery_count, // Number of recovery_data[] buffer pointers
|
||||||
unsigned work_count, // Number of work_data[] buffer pointers, from leo_encode_work_count()
|
unsigned work_count, // Number of work_data[] buffer pointers, from leo_encode_work_count()
|
||||||
void* const * const original_data, // Array of pointers to original data buffers
|
const void* const * const original_data, // Array of pointers to original data buffers
|
||||||
void** work_data, // Array of work buffers
|
void** work_data, // Array of work buffers
|
||||||
unsigned flags) // Operation flags
|
unsigned flags) // Operation flags
|
||||||
{
|
{
|
||||||
if (buffer_bytes <= 0 || buffer_bytes % 64 != 0)
|
if (buffer_bytes <= 0 || buffer_bytes % 64 != 0)
|
||||||
return Leopard_InvalidSize;
|
return Leopard_InvalidSize;
|
||||||
|
@ -216,7 +216,7 @@ LEO_EXPORT unsigned leo_decode_work_count(
|
||||||
static void DecodeM1(
|
static void DecodeM1(
|
||||||
uint64_t buffer_bytes,
|
uint64_t buffer_bytes,
|
||||||
unsigned original_count,
|
unsigned original_count,
|
||||||
void* const * const original_data,
|
const void* const * original_data,
|
||||||
const void* recovery_data,
|
const void* recovery_data,
|
||||||
void* work_data)
|
void* work_data)
|
||||||
{
|
{
|
||||||
|
@ -233,14 +233,14 @@ static void DecodeM1(
|
||||||
}
|
}
|
||||||
|
|
||||||
LEO_EXPORT LeopardResult leo_decode(
|
LEO_EXPORT LeopardResult leo_decode(
|
||||||
uint64_t buffer_bytes, // Number of bytes in each data buffer
|
uint64_t buffer_bytes, // Number of bytes in each data buffer
|
||||||
unsigned original_count, // Number of original_data[] buffer pointers
|
unsigned original_count, // Number of original_data[] buffer pointers
|
||||||
unsigned recovery_count, // Number of recovery_data[] buffer pointers
|
unsigned recovery_count, // Number of recovery_data[] buffer pointers
|
||||||
unsigned work_count, // Number of buffer pointers in work_data[]
|
unsigned work_count, // Number of buffer pointers in work_data[]
|
||||||
void* const * const original_data, // Array of original data buffers
|
const void* const * const original_data, // Array of original data buffers
|
||||||
void* const * const recovery_data, // Array of recovery data buffers
|
const void* const * const recovery_data, // Array of recovery data buffers
|
||||||
void** work_data, // Array of work data buffers
|
void** work_data, // Array of work data buffers
|
||||||
unsigned flags) // Operation flags
|
unsigned flags) // Operation flags
|
||||||
{
|
{
|
||||||
if (buffer_bytes <= 0 || buffer_bytes % 64 != 0)
|
if (buffer_bytes <= 0 || buffer_bytes % 64 != 0)
|
||||||
return Leopard_InvalidSize;
|
return Leopard_InvalidSize;
|
||||||
|
|
30
leopard.h
30
leopard.h
|
@ -187,13 +187,13 @@ LEO_EXPORT unsigned leo_encode_work_count(
|
||||||
Returns other values on errors.
|
Returns other values on errors.
|
||||||
*/
|
*/
|
||||||
LEO_EXPORT LeopardResult leo_encode(
|
LEO_EXPORT LeopardResult leo_encode(
|
||||||
uint64_t buffer_bytes, // Number of bytes in each data buffer
|
uint64_t buffer_bytes, // Number of bytes in each data buffer
|
||||||
unsigned original_count, // Number of original_data[] buffer pointers
|
unsigned original_count, // Number of original_data[] buffer pointers
|
||||||
unsigned recovery_count, // Number of recovery_data[] buffer pointers
|
unsigned recovery_count, // Number of recovery_data[] buffer pointers
|
||||||
unsigned work_count, // Number of work_data[] buffer pointers, from leo_encode_work_count()
|
unsigned work_count, // Number of work_data[] buffer pointers, from leo_encode_work_count()
|
||||||
void* const * const original_data, // Array of pointers to original data buffers
|
const void* const * const original_data, // Array of pointers to original data buffers
|
||||||
void** work_data, // Array of work buffers
|
void** work_data, // Array of work buffers
|
||||||
unsigned flags); // Operation flags
|
unsigned flags); // Operation flags
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
@ -236,14 +236,14 @@ LEO_EXPORT unsigned leo_decode_work_count(
|
||||||
Returns other values on errors.
|
Returns other values on errors.
|
||||||
*/
|
*/
|
||||||
LEO_EXPORT LeopardResult leo_decode(
|
LEO_EXPORT LeopardResult leo_decode(
|
||||||
uint64_t buffer_bytes, // Number of bytes in each data buffer
|
uint64_t buffer_bytes, // Number of bytes in each data buffer
|
||||||
unsigned original_count, // Number of original_data[] buffer pointers
|
unsigned original_count, // Number of original_data[] buffer pointers
|
||||||
unsigned recovery_count, // Number of recovery_data[] buffer pointers
|
unsigned recovery_count, // Number of recovery_data[] buffer pointers
|
||||||
unsigned work_count, // Number of buffer pointers in work_data[]
|
unsigned work_count, // Number of buffer pointers in work_data[]
|
||||||
void* const * const original_data, // Array of original data buffers
|
const void* const * const original_data, // Array of original data buffers
|
||||||
void* const * const recovery_data, // Array of recovery data buffers
|
const void* const * const recovery_data, // Array of recovery data buffers
|
||||||
void** work_data, // Array of work data buffers
|
void** work_data, // Array of work data buffers
|
||||||
unsigned flags); // Operation flags
|
unsigned flags); // Operation flags
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
Loading…
Reference in New Issue