From a2b1f37b56f78240adbbefd7c5a07181231bc7ae Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Wed, 1 Mar 2023 16:44:21 -0500 Subject: [PATCH] code and comment cleanup; --- Defines.h | 29 +++++++++++++++++++++++++++++ edac/RS634717.cpp | 19 +++++++++---------- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/Defines.h b/Defines.h index 18c3555a..60cc7b37 100644 --- a/Defines.h +++ b/Defines.h @@ -169,30 +169,55 @@ const uint8_t IP_COMPRESS_RFC1144_UNCOMPRESS = 0x02U; // Inlines // --------------------------------------------------------------------------- +/// +/// String from boolean. +/// +/// +/// inline std::string __BOOL_STR(const bool& value) { std::stringstream ss; ss << std::boolalpha << value; return ss.str(); } +/// +/// String from integer number. +/// +/// +/// inline std::string __INT_STR(const int& value) { std::stringstream ss; ss << value; return ss.str(); } +/// +/// String from hex integer number. +/// +/// +/// inline std::string __INT_HEX_STR(const int& value) { std::stringstream ss; ss << std::hex << value; return ss.str(); } +/// +/// String from floating point number. +/// +/// +/// inline std::string __FLOAT_STR(const float& value) { std::stringstream ss; ss << value; return ss.str(); } +/// +/// IP address from ulong64_t value. +/// +/// +/// inline std::string __IP_FROM_ULONG(const ulong64_t& value) { std::stringstream ss; 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 // --------------------------------------------------------------------------- +/// Pointer magic to get the memory address of a floating point number. +/// Floating Point Variable #define __FLOAT_ADDR(x) (*(uint32_t*)& x) +/// Pointer magic to get the memory address of a double precision number. +/// Double Precision Variable #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]) diff --git a/edac/RS634717.cpp b/edac/RS634717.cpp index c7d9ba4e..2e619274 100755 --- a/edac/RS634717.cpp +++ b/edac/RS634717.cpp @@ -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, 0, 1, 034, 035, 002, 023, 021, 027, 022, 033, 064, 042, 005, 073, 051, 046, 073, 060 } }; -// -// __RS( ... ) -- Define a reed-solomon codec -// -// @TYPE: Data type primitive. -// @SYMBOLS: Total number of symbols; must be a power of 2 minus 1, eg 2^8-1 == 255. -// @PAYLOAD: The maximum number of non-parity symbols, eg 253 ==> 2 parity symbols. -// @POLY: A primitive polynomial appropriate to the SYMBOLS size. -// @FCR: The first consecutive root of the Reed-Solomon generator polynomial. -// @PRIM: The primitive root of the generator polynomial. -// +/// Define a reed-solomon codec. +/// Data type primitive +/// Total number of symbols; must be a power of 2 minus 1, eg 2^8-1 == 255 +/// The maximum number of non-parity symbols, eg 253 ==> 2 parity symbols +/// A primitive polynomial appropriate to the SYMBOLS size +/// The first consecutive root of the Reed-Solomon generator polynomial +/// The primitive root of the generator polynomial #define __RS(TYPE, SYMBOLS, PAYLOAD, POLY, FCR, PRIM) \ edac::rs::reed_solomon::value, \ (SYMBOLS) - (PAYLOAD), FCR, PRIM, \ edac::rs::gfpoly::value, POLY>> +/// Define a 63-symbol reed-solomon codec. +/// The maximum number of non-parity symbols, eg 253 ==> 2 parity symbols #define __RS_63(PAYLOAD) __RS(uint8_t, 63, PAYLOAD, 0x43, 1, 1) // ---------------------------------------------------------------------------