Last active
July 20, 2022 20:18
-
-
Save esutton/e3dc0118f6033814da94fe5d547853e5 to your computer and use it in GitHub Desktop.
Revisions
-
esutton revised this gist
Jul 20, 2022 . No changes.There are no files selected for viewing
-
esutton revised this gist
Jul 20, 2022 . No changes.There are no files selected for viewing
-
esutton created this gist
Jul 20, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,40 @@ /// Debug dump bytes in hexadecimal format 16-bytes per row /// /// \param source /// \param length /// /// Example Output: /// \code /// 0000 bd 7a 32 13 08 1c 1e d9 - c9 48 48 0b 5f 23 1a f5 /// 0010 72 3d 8f 7a e6 2c 07 e4 - 6e 45 79 0f cb 18 13 6f /// \endcode void debugDumpHexBytes(const char* source, int length) { qDebug("------------------------"); int offset = 0; int row = 0; QString line; while(length > offset ) { line = QString::asprintf("%04x ", offset); for(int i = 0; i < 16; ++i) { if(8 == i) { line.append(" - "); } uint8_t value = source[offset++]; line.append(QString::asprintf("%02x ", value)); if(length == offset) { break; } } qDebug("%s", qPrintable(line)); ++row; } qDebug("........................"); }