mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
integrating the existing state of TON Storage / TON Payments / CPS Fift development branches
This commit is contained in:
parent
040df63c98
commit
4e2624459b
153 changed files with 10760 additions and 1695 deletions
24
rldp2/FecHelper.cpp
Normal file
24
rldp2/FecHelper.cpp
Normal file
|
@ -0,0 +1,24 @@
|
|||
#include "FecHelper.h"
|
||||
|
||||
#include "td/utils/check.h"
|
||||
|
||||
namespace ton {
|
||||
namespace rldp2 {
|
||||
td::uint32 FecHelper::get_fec_symbols_count() const {
|
||||
constexpr td::uint32 x = 5;
|
||||
constexpr td::uint32 y = 5;
|
||||
// smallest (symbols_count + x + y * i) > received_symbols_count
|
||||
if (symbols_count + x > received_symbols_count) {
|
||||
return symbols_count + x;
|
||||
}
|
||||
td::uint32 i = (received_symbols_count - (symbols_count + x)) / y + 1;
|
||||
return symbols_count + x + i * y;
|
||||
}
|
||||
|
||||
td::uint32 FecHelper::get_left_fec_symbols_count() const {
|
||||
auto fec_symbols_count = get_fec_symbols_count();
|
||||
CHECK(fec_symbols_count > received_symbols_count);
|
||||
return fec_symbols_count - received_symbols_count;
|
||||
}
|
||||
} // namespace rldp2
|
||||
} // namespace ton
|
Loading…
Add table
Add a link
Reference in a new issue