Belle II Software  release-08-01-10
util.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 /* util.c */
9 
10 #include <stdio.h>
11 
12 
13 void
14 dump_binary(FILE* fp, const void* ptr, const size_t size)
15 {
16  const unsigned int* p = (const unsigned int*)ptr;
17  const size_t _size = size / sizeof(unsigned int);
18 
19 
20  for (unsigned int i = 0; i < _size; ++i) {
21  fprintf(fp, "%08x ", p[i]);
22  if (i % 8 == 7) fprintf(fp, "\n");
23  }
24  if (_size % 8 != 0) fprintf(fp, "\n");
25 }
26