aboutsummaryrefslogtreecommitdiffstats
path: root/src/ctr.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ctr.h')
-rw-r--r--src/ctr.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ctr.h b/src/ctr.h
index b5b56ee2..4032e268 100644
--- a/src/ctr.h
+++ b/src/ctr.h
@@ -16,7 +16,8 @@
// Macro to encode an integer for use with DECL_CTR_INT()
#define _CTR_HEX(H) ((H) > 9 ? (H) - 10 + 'A' : (H) + '0')
-#define _CTR_INT(V, S) _CTR_HEX(((uint32_t)(V) >> (S)) & 0x0f)
+#define _CTR_SHIFT(V, S) _CTR_HEX(((uint32_t)(V) >> (S)) & 0x0f)
+#define _CTR_INT(V, S) ((V) < 0 ? _CTR_SHIFT(-(V), (S)) : _CTR_SHIFT((V), (S)))
#define CTR_INT(VALUE) { \
' ', (VALUE) < 0 ? '-' : '+', '0', 'x', \
_CTR_INT((VALUE),28), _CTR_INT((VALUE),24), \