2 * util.c: Assorted utilities for the dissasembler
5 * Miguel de Icaza (miguel@ximian.com)
7 * (C) 2001 Ximian, Inc (http://www.ximian.com)
17 * @code: code to lookup in table
18 * @table: table to decode code
20 * Warning: returns static buffer.
23 map (guint32 code, map_t *table)
27 for (i = 0; table [i].str != NULL; i++)
28 if (table [i].code == code)
30 g_assert_not_reached ();
37 * @table: table to decode bitfield
39 * Warning: returns static buffer.
42 flags (guint32 code, map_t *table)
44 static char buffer [1024];
49 for (i = 0; table [i].str != NULL; i++)
50 if (table [i].code & code) {
53 strcat (buffer, table [i].str);
61 * @buffer: pointer to buffer to dump
62 * @base: numbering base to use
63 * @count: number of bytes to dump
66 hex_dump (const char *buffer, int base, int count)
76 for (i = 0; i < count; i++){
79 printf ("\n0x%08x: ", (unsigned char) base + i);
81 printf ("%02x ", (unsigned char) (buffer [i]));