GNU Radio's CCSDS Package
lib/fec/bch/debug.h
Go to the documentation of this file.
1 /*
2  * @author Moses Browne Mwakyanjala
3  * Copyright Feb 2018, Moses Browne Mwakyanjala
4  * May be used under the terms of the GNU Lesser General Public License (LGPL)
5  */
6 #ifndef DEBUG_H
7 #define DEBUG_H
8 #include <stdio.h>
9 #include <ctype.h>
10 #include <stdlib.h>
11 void inline hexdump(void *ptr, int buflen) {
12  unsigned char *buf = (unsigned char*) ptr;
13  int i, j;
14  for (i = 0; i < buflen; i += 16) {
15  printf("%06x: ", i);
16  for (j = 0; j < 16; j++)
17  if (i + j < buflen)
18  printf("%02x ", buf[i + j]);
19  else
20  printf(" ");
21  printf(" ");
22  for (j = 0; j < 16; j++)
23  if (i + j < buflen)
24  printf("%c", isprint(buf[i + j]) ? buf[i + j] : '.');
25  printf("\n");
26  }
27 }
28 #endif
void hexdump(void *ptr, int buflen)
Definition: lib/fec/bch/debug.h:11