summaryrefslogtreecommitdiff
path: root/src/util.cpp
diff options
context:
space:
mode:
authornavewindre <nw@moneybot.cc>2024-07-12 05:40:41 +0200
committernavewindre <nw@moneybot.cc>2024-07-12 05:40:41 +0200
commit28f41cf689def99fb586bfca47b7e1786227a5a2 (patch)
tree4a843c7785035ca548625ccf988ac924b8815f85 /src/util.cpp
parent2ebf959ec02048c15323e1bbfc63faedcf5067b6 (diff)
base shit
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 576dcbd..81b1192 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -40,3 +40,17 @@ void u_sleep( U64 ns ) {
interval.QuadPart = -1 * ns;
nt_delay_execution64( false, &interval );
}
+
+void u_bin_dump( void* data, U64 size, U32 stride ) {
+ if( stride < 1 )
+ stride = 8;
+
+ U8* bytes = (U8*)data;
+ for( U64 i = 0; i < size; ++i ) {
+ if( i % stride == 0 )
+ clogc( CONFG_LIGHTGREEN, "[0x%02X] | ", i );
+ clogc( bytes[i]? CONFG_WHITE : CONFG_RED, "%02X ", bytes[i] );
+ if( i % stride == (stride - 1) )
+ printf( "\n" );
+ }
+}