code and comment cleanup;

3.0-rcon_maint
Bryan Biedenkapp 3 years ago
parent 92b8897151
commit a2b1f37b56

@ -169,30 +169,55 @@ const uint8_t IP_COMPRESS_RFC1144_UNCOMPRESS = 0x02U;
// Inlines // Inlines
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary>
/// String from boolean.
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
inline std::string __BOOL_STR(const bool& value) { inline std::string __BOOL_STR(const bool& value) {
std::stringstream ss; std::stringstream ss;
ss << std::boolalpha << value; ss << std::boolalpha << value;
return ss.str(); return ss.str();
} }
/// <summary>
/// String from integer number.
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
inline std::string __INT_STR(const int& value) { inline std::string __INT_STR(const int& value) {
std::stringstream ss; std::stringstream ss;
ss << value; ss << value;
return ss.str(); return ss.str();
} }
/// <summary>
/// String from hex integer number.
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
inline std::string __INT_HEX_STR(const int& value) { inline std::string __INT_HEX_STR(const int& value) {
std::stringstream ss; std::stringstream ss;
ss << std::hex << value; ss << std::hex << value;
return ss.str(); return ss.str();
} }
/// <summary>
/// String from floating point number.
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
inline std::string __FLOAT_STR(const float& value) { inline std::string __FLOAT_STR(const float& value) {
std::stringstream ss; std::stringstream ss;
ss << value; ss << value;
return ss.str(); return ss.str();
} }
/// <summary>
/// IP address from ulong64_t value.
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
inline std::string __IP_FROM_ULONG(const ulong64_t& value) { inline std::string __IP_FROM_ULONG(const ulong64_t& value) {
std::stringstream ss; std::stringstream ss;
ss << ((value >> 24) & 0xFFU) << "." << ((value >> 16) & 0xFFU) << "." << ((value >> 8) & 0xFFU) << "." << (value & 0xFFU); ss << ((value >> 24) & 0xFFU) << "." << ((value >> 16) & 0xFFU) << "." << ((value >> 8) & 0xFFU) << "." << (value & 0xFFU);
@ -203,7 +228,11 @@ inline std::string __IP_FROM_ULONG(const ulong64_t& value) {
// Macros // Macros
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary>Pointer magic to get the memory address of a floating point number.</summary>
/// <param name="x">Floating Point Variable</param>
#define __FLOAT_ADDR(x) (*(uint32_t*)& x) #define __FLOAT_ADDR(x) (*(uint32_t*)& x)
/// <summary>Pointer magic to get the memory address of a double precision number.</summary>
/// <param name="x">Double Precision Variable</param>
#define __DOUBLE_ADDR(x) (*(uint64_t*)& x) #define __DOUBLE_ADDR(x) (*(uint64_t*)& x)
#define WRITE_BIT(p, i, b) p[(i) >> 3] = (b) ? (p[(i) >> 3] | BIT_MASK_TABLE[(i) & 7]) : (p[(i) >> 3] & ~BIT_MASK_TABLE[(i) & 7]) #define WRITE_BIT(p, i, b) p[(i) >> 3] = (b) ? (p[(i) >> 3] | BIT_MASK_TABLE[(i) & 7]) : (p[(i) >> 3] & ~BIT_MASK_TABLE[(i) & 7])

@ -98,22 +98,21 @@ const uint8_t ENCODE_MATRIX_362017[20U][36U] = {
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 002, 001, 053, 074, 002, 014, 052, 074, 012, 057, 024, 063, 015, 042, 052, 033 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 002, 001, 053, 074, 002, 014, 052, 074, 012, 057, 024, 063, 015, 042, 052, 033 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 034, 035, 002, 023, 021, 027, 022, 033, 064, 042, 005, 073, 051, 046, 073, 060 } }; { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 034, 035, 002, 023, 021, 027, 022, 033, 064, 042, 005, 073, 051, 046, 073, 060 } };
// /// <summary>Define a reed-solomon codec.</summary>
// __RS( ... ) -- Define a reed-solomon codec /// <param name="TYPE">Data type primitive</param>
// /// <param name="SYMBOLS">Total number of symbols; must be a power of 2 minus 1, eg 2^8-1 == 255</param>
// @TYPE: Data type primitive. /// <param name="PAYLOAD">The maximum number of non-parity symbols, eg 253 ==> 2 parity symbols</param>
// @SYMBOLS: Total number of symbols; must be a power of 2 minus 1, eg 2^8-1 == 255. /// <param name="POLY">A primitive polynomial appropriate to the SYMBOLS size</param>
// @PAYLOAD: The maximum number of non-parity symbols, eg 253 ==> 2 parity symbols. /// <param name="FCR">The first consecutive root of the Reed-Solomon generator polynomial</param>
// @POLY: A primitive polynomial appropriate to the SYMBOLS size. /// <param name="PRIM">The primitive root of the generator polynomial</param>
// @FCR: The first consecutive root of the Reed-Solomon generator polynomial.
// @PRIM: The primitive root of the generator polynomial.
//
#define __RS(TYPE, SYMBOLS, PAYLOAD, POLY, FCR, PRIM) \ #define __RS(TYPE, SYMBOLS, PAYLOAD, POLY, FCR, PRIM) \
edac::rs::reed_solomon<TYPE, \ edac::rs::reed_solomon<TYPE, \
edac::rs::log_<(SYMBOLS) + 1>::value, \ edac::rs::log_<(SYMBOLS) + 1>::value, \
(SYMBOLS) - (PAYLOAD), FCR, PRIM, \ (SYMBOLS) - (PAYLOAD), FCR, PRIM, \
edac::rs::gfpoly<edac::rs::log_<(SYMBOLS) + 1>::value, POLY>> edac::rs::gfpoly<edac::rs::log_<(SYMBOLS) + 1>::value, POLY>>
/// <summary>Define a 63-symbol reed-solomon codec.</summary>
/// <param name="PAYLOAD">The maximum number of non-parity symbols, eg 253 ==> 2 parity symbols</param>
#define __RS_63(PAYLOAD) __RS(uint8_t, 63, PAYLOAD, 0x43, 1, 1) #define __RS_63(PAYLOAD) __RS(uint8_t, 63, PAYLOAD, 0x43, 1, 1)
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

Loading…
Cancel
Save

Powered by TurnKey Linux.