From 8b101ef0fdb36145cbd7afbfe46fdd5a09237170 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 5 Aug 2020 19:02:17 +0200 Subject: grt: import changes from gtkwave to ghwlib --- src/grt/ghwlib.c | 2 +- src/grt/ghwlib.h | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/grt/ghwlib.c b/src/grt/ghwlib.c index 6115ff628..340e12d08 100644 --- a/src/grt/ghwlib.c +++ b/src/grt/ghwlib.c @@ -200,7 +200,7 @@ ghw_read_sleb128 (struct ghw_handler *h, int32_t *res) if ((v & 0x80) == 0) { if ((v & 0x40) && off < 32) - r |= -1 << off; + r |= ~0U << off; break; } } diff --git a/src/grt/ghwlib.h b/src/grt/ghwlib.h index 3c0fecc10..4937da928 100644 --- a/src/grt/ghwlib.h +++ b/src/grt/ghwlib.h @@ -24,6 +24,11 @@ #include #include +/* To be libraries friendly. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + /* The ghwlib uses the standard c99 int32_t and int64_t. They are declared in stdint.h. Header inttypes.h includes stdint.h and provides macro for printf and co specifiers. Use it if known to be available. */ @@ -432,6 +437,8 @@ enum ghw_res { ghw_res_other = 3 }; +enum ghw_res ghw_read_sm_hdr (struct ghw_handler *h, int *list); + int ghw_read_sm (struct ghw_handler *h, enum ghw_sm_type *sm); int ghw_read_dump (struct ghw_handler *h); -- cgit v1.2.3