summaryrefslogtreecommitdiff
path: root/mpq
diff options
context:
space:
mode:
authorMarco Bodrato <bodrato@mail.dm.unipi.it>2018-04-27 00:22:13 +0200
committerMarco Bodrato <bodrato@mail.dm.unipi.it>2018-04-27 00:22:13 +0200
commitdd88362069b5601739c9c6091285229cc5b2fe50 (patch)
tree339eb8ac49e5f7fdbe23c014b9fa0725aaefd315 /mpq
parentd1732e53da16dda91f9e9a43256e494e02413711 (diff)
downloadgmp-dd88362069b5601739c9c6091285229cc5b2fe50.tar.gz
mpq/set_si.c: ABS_CAST only if needed
Diffstat (limited to 'mpq')
-rw-r--r--mpq/set_si.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/mpq/set_si.c b/mpq/set_si.c
index 0a4514463..dbaa85a51 100644
--- a/mpq/set_si.c
+++ b/mpq/set_si.c
@@ -34,8 +34,6 @@ see https://www.gnu.org/licenses/. */
void
mpq_set_si (mpq_t dest, signed long int num, unsigned long int den)
{
- unsigned long int abs_num;
-
if (GMP_NUMB_BITS < BITS_PER_ULONG)
{
if (num == 0) /* Canonicalize 0/d to 0/1. */
@@ -45,8 +43,6 @@ mpq_set_si (mpq_t dest, signed long int num, unsigned long int den)
return;
}
- abs_num = ABS_CAST (unsigned long, num);
-
if (num == 0)
{
/* Canonicalize 0/d to 0/1. */
@@ -55,7 +51,7 @@ mpq_set_si (mpq_t dest, signed long int num, unsigned long int den)
}
else
{
- MPZ_NEWALLOC (NUM(dest), 1)[0] = abs_num;
+ MPZ_NEWALLOC (NUM(dest), 1)[0] = ABS_CAST (unsigned long, num);
SIZ(NUM(dest)) = num > 0 ? 1 : -1;
}