diff options
| author | Alasdair Armstrong | 2018-09-06 17:17:23 +0100 |
|---|---|---|
| committer | Alasdair Armstrong | 2018-09-06 17:17:23 +0100 |
| commit | eae01f8c348235ea552c67ce323a1ada3dbc8b08 (patch) | |
| tree | 93248a495e8fb4ce44fc1f00f0722fe3736a3d17 /lib | |
| parent | b04f8c9dfa599b48544bac024eaa78e6b93c29d4 (diff) | |
RISCV: Get enough of the RISCV platform into C to run some tests
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sail.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -1,3 +1,4 @@ +#define _GNU_SOURCE #include<assert.h> #include<inttypes.h> #include<stdbool.h> @@ -1111,9 +1112,13 @@ void string_of_int(sail_string *str, const sail_int i) gmp_asprintf(str, "%Zd", i); } +/* asprinf is a GNU extension, but it should exist on BSD */ void string_of_mach_bits(sail_string *str, const mach_bits op) { - exit(EXIT_FAILURE); + int bytes = asprintf(str, "0x%" PRIx64, op); + if (bytes == -1) { + fprintf(stderr, "Could not print bits 0x%" PRIx64 "\n", op); + } } void string_of_sail_bits(sail_string *str, const sail_bits op) |
