summaryrefslogtreecommitdiffstats
path: root/pbn_dump.c
blob: c53adff613bc7a0b73c0f3fe996ae3e530a849a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* ----------------------------------------------------------------------- *
 *
 *   Copyright 2007 H. Peter Anvin - All Rights Reserved
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License as
 *   published by the Free Software Foundation, Inc.,
 *   59 Temple Place Ste 330, Boston MA 02111-1307, USA; version 2.1,
 *   incorporated herein by reference.
 *
 * ----------------------------------------------------------------------- */

/*
 * pbn_dump.c
 *
 * Output an PBN in hexadecimal form, mainly intended for debugging
 */

#include <stdio.h>
#include "pbnint.h"

void pbn_dump(FILE *f, const struct pbn *pbn)
{
    int i;

    putc(pbn->minus ? '-' : '+', f);

    for (i = pbn->len-1; i >= 0; i--) {
	fprintf(f, "%" PBN_LIMB_xFMT, pbn->num[i]);
	if (i)
	    putc('_', f);
    }
    fprintf(f, " (%d)", pbn->bits);
}