1/*
2File:       icns_debug.c
3Copyright (C) 2001-2012 Mathew Eis <mathew@eisbox.net>
4
5This library is free software; you can redistribute it and/or
6modify it under the terms of the GNU Lesser General Public
7License as published by the Free Software Foundation; either
8version 2.1 of the License, or (at your option) any later version.
9
10This library is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13Lesser General Public License for more details.
14
15You should have received a copy of the GNU Lesser General Public
16License along with this library; if not, write to the
17Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18Boston, MA 02110-1301, USA.
19*/
20
21#include <stdio.h>
22#include <stdlib.h>
23#include <stdint.h>
24#include <string.h>
25
26#include "icns.h"
27#include "icns_internals.h"
28#ifdef ICNS_DEBUG
29void bin_print_byte(int x)
30{
31   int n;
32   for(n=0; n<8; n++)
33   {
34	if((x & 0x80) !=0)
35	{
36	printf("1");
37	}
38	else
39	{
40   	printf("0");
41   	}
42	if(n==3)
43	{
44	printf(" "); /* insert a space between nybbles */
45	}
46	x = x<<1;
47   }
48}
49
50void bin_print_int(int x)
51{
52   int hi, lo;
53   hi=(x>>8) & 0xff;
54   lo=x&0xff;
55   bin_print_byte(hi);
56   printf(" ");
57   bin_print_byte(lo);
58}
59#endif /* ifdef ICNS_DEBUG */
60
61
62