From f85c91a04ec7de87e9d2b01e5155f08e7f209144 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Fri, 20 Nov 2009 15:50:49 +0000 Subject: [PATCH] Less confusing message for bitstreams display. --- src/lib/bitutils.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/lib/bitutils.c b/src/lib/bitutils.c index be9a5a1..71dc29a 100644 --- a/src/lib/bitutils.c +++ b/src/lib/bitutils.c @@ -160,8 +160,14 @@ void print_hex_bits(const byte_t* pbtData, const size_t szBits) printf("%02x ",pbtData[szPos]); } - // Print the rest bits, these cannot have no parity bit - if (szBits%8 != 0) printf("%02x",pbtData[szBytes]); + // Print the rest bits + if (szBits%8 != 0) + { + if (szBits%8 < 5) + printf("%01x (%i bits)",pbtData[szBytes], szBits%8); + else + printf("%02x (%i bits)",pbtData[szBytes], szBits%8); + } printf("\n"); } @@ -182,8 +188,14 @@ void print_hex_par(const byte_t* pbtData, const size_t szBits, const byte_t* pbt } } - // Print the rest bits, these cannot have no parity bit - if (szBits%8 != 0) printf("%02x",pbtData[szBytes]); + // Print the rest bits, these cannot have parity bit + if (szBits%8 != 0) + { + if (szBits%8 < 5) + printf("%01x (%i bits)",pbtData[szBytes], szBits%8); + else + printf("%02x (%i bits)",pbtData[szBytes], szBits%8); + } printf("\n"); }