summaryrefslogtreecommitdiff
path: root/source/luametatex/source/tex/texarithmetic.c
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2023-06-01 11:20:49 +0200
committerContext Git Mirror Bot <phg@phi-gamma.net>2023-06-01 11:20:49 +0200
commite2ffa186c8e622ce9235533b91bb2399dd051672 (patch)
tree6e1e9ef371a8b26e6eb4120041762bf3d9fdf2f3 /source/luametatex/source/tex/texarithmetic.c
parent9111ac6d97d7931a2a9bbdad69f5c54de4172318 (diff)
downloadcontext-e2ffa186c8e622ce9235533b91bb2399dd051672.tar.gz
2023-05-30 22:24:00
Diffstat (limited to 'source/luametatex/source/tex/texarithmetic.c')
-rw-r--r--source/luametatex/source/tex/texarithmetic.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/source/luametatex/source/tex/texarithmetic.c b/source/luametatex/source/tex/texarithmetic.c
index d9cf9859d..3a53985d5 100644
--- a/source/luametatex/source/tex/texarithmetic.c
+++ b/source/luametatex/source/tex/texarithmetic.c
@@ -196,13 +196,13 @@ scaled tex_xn_over_d_r(scaled x, int n, int d, int *remainder)
}
xx = (unsigned int) x;
dd = (unsigned int) d;
- t = ((xx % 0100000) * (unsigned int) n);
- u = ((xx / 0100000) * (unsigned int) n + (t / 0100000));
- v = (u % dd) * 0100000 + (t % 0100000);
- if (u / dd >= 0100000) {
+ t = ((xx % 0x8000) * (unsigned int) n);
+ u = ((xx / 0x8000) * (unsigned int) n + (t / 0x8000));
+ v = (u % dd) * 0x8000 + (t % 0x8000);
+ if (u / dd >= 0x8000) {
lmt_scanner_state.arithmic_error = 1;
} else {
- u = 0100000 * (u / dd) + (v / dd);
+ u = 0x8000 * (u / dd) + (v / dd);
}
if (positive) {
if (remainder) {
@@ -245,13 +245,13 @@ scaled tex_xn_over_d(scaled x, int n, int d)
}
xx = (unsigned int) x;
dd = (unsigned int) d;
- t = ((xx % 0100000) * (unsigned int) n);
- u = ((xx / 0100000) * (unsigned int) n + (t / 0100000));
- v = (u % dd) * 0100000 + (t % 0100000);
- if (u / dd >= 0100000) {
+ t = ((xx % 0x8000) * (unsigned int) n);
+ u = ((xx / 0x8000) * (unsigned int) n + (t / 0x8000));
+ v = (u % dd) * 0x8000 + (t % 0x8000);
+ if (u / dd >= 0x8000) {
lmt_scanner_state.arithmic_error = 1;
} else {
- u = 0100000 * (u / dd) + (v / dd);
+ u = 0x8000 * (u / dd) + (v / dd);
}
if (positive) {
return (scaled) u;
@@ -306,13 +306,13 @@ scaled tex_round_xn_over_d(scaled x, int n, unsigned int d)
positive = ! positive;
n = -n;
}
- t = (unsigned) ((x % 0100000) * n);
- u = (unsigned) (((unsigned) (x) / 0100000) * (unsigned) n + (t / 0100000));
- v = (u % d) * 0100000 + (t % 0100000);
- if (u / d >= 0100000) {
+ t = (unsigned) ((x % 0x8000) * n);
+ u = (unsigned) (((unsigned) (x) / 0x8000) * (unsigned) n + (t / 0x8000));
+ v = (u % d) * 0x8000 + (t % 0x8000);
+ if (u / d >= 0x8000) {
scanner_state.arithmic_error = 1;
} else {
- u = 0100000 * (u / d) + (v / d);
+ u = 0x8000 * (u / d) + (v / d);
}
v = v % d;
if (2 * v >= d) {