diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-04-10 02:00:58 +0300 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-04-10 03:16:18 +0300 |
commit | c462509adfd68e8b849b8a6713360fb4f9026578 (patch) | |
tree | 98dc8d67d573cef516d405c1f35e1e93dbc771a5 /src | |
parent | 72aa210cc103af971c7a77660f014b11475af3aa (diff) | |
download | sciteco-c462509adfd68e8b849b8a6713360fb4f9026578.tar.gz |
fixed formatting of the smallest possible integer
* In other words, fixed `-9223372036854775808\` on --with-teco-integer=64
(which is the default).
* The reason is that ABS(G_MININT64) == G_MININT64 since -G_MININT64 == G_MININT64.
It is therefore important not to call ABS() on arbitrary teco_int_t's.
Diffstat (limited to 'src')
-rw-r--r-- | src/expressions.c | 4 | ||||
-rw-r--r-- | src/view.c | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/expressions.c b/src/expressions.c index c48e7b0..f802c6e 100644 --- a/src/expressions.c +++ b/src/expressions.c @@ -399,11 +399,11 @@ teco_expressions_format(gchar *buffer, teco_int_t number, teco_qreg_t *qreg) gchar *p = buffer + TECO_EXPRESSIONS_FORMAT_LEN; - teco_int_t v = ABS(number); + teco_int_t v = number; *--p = '\0'; do { - *--p = '0' + (v % radix); + *--p = '0' + ABS(v % radix); if (*p > '9') *p += 'A' - '9' - 1; } while ((v /= radix)); @@ -612,6 +612,7 @@ teco_view_glyphs2bytes_relative(teco_view_t *ctx, gsize pos, teco_int_t n) { if (!n) return pos; + /* NOTE: Does not work for n == G_MININT64. */ if (ABS(n) > TECO_RELATIVE_LIMIT) return teco_view_glyphs2bytes(ctx, teco_view_bytes2glyphs(ctx, pos) + n); |