Belle II Software  release-06-02-00
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  int i;
17  const unsigned int* p = (const unsigned int*)ptr;
18  const size_t _size = size / sizeof(unsigned int);
19 
20 
21  for (i = 0; i < _size; i++) {
22  fprintf(fp, "%08x ", p[i]);
23  if (i % 8 == 7) fprintf(fp, "\n");
24  }
25  if (_size % 8 != 0) fprintf(fp, "\n");
26 }
27