printer: helper macros
This commit is contained in:
parent
d6b0af3be7
commit
fd11cae7be
@ -2,6 +2,20 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//! https://stackoverflow.com/questions/111928/is-there-a-printf-converter-to-print-in-binary-format
|
||||||
|
//! Can be used to print out binary numbers in human-readable format.
|
||||||
|
#define BYTE_TO_BINARY_PATTERN "%c%c%c%c%c%c%c%c"
|
||||||
|
#define BYTE_TO_BINARY(byte) \
|
||||||
|
(byte & 0x80 ? '1' : '0'), \
|
||||||
|
(byte & 0x40 ? '1' : '0'), \
|
||||||
|
(byte & 0x20 ? '1' : '0'), \
|
||||||
|
(byte & 0x10 ? '1' : '0'), \
|
||||||
|
(byte & 0x08 ? '1' : '0'), \
|
||||||
|
(byte & 0x04 ? '1' : '0'), \
|
||||||
|
(byte & 0x02 ? '1' : '0'), \
|
||||||
|
(byte & 0x01 ? '1' : '0')
|
||||||
|
|
||||||
|
|
||||||
namespace sif {
|
namespace sif {
|
||||||
|
|
||||||
enum PrintLevel {
|
enum PrintLevel {
|
||||||
|
Loading…
Reference in New Issue
Block a user