[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r34518 - gnunet/src/scalarproduct
From: |
gnunet |
Subject: |
[GNUnet-SVN] r34518 - gnunet/src/scalarproduct |
Date: |
Tue, 9 Dec 2014 22:17:46 +0100 |
Author: grothoff
Date: 2014-12-09 22:17:46 +0100 (Tue, 09 Dec 2014)
New Revision: 34518
Modified:
gnunet/src/scalarproduct/gnunet-scalarproduct.c
gnunet/src/scalarproduct/scalarproduct_api.c
gnunet/src/scalarproduct/test_scalarproduct_negative.sh
Log:
-handle negative results correctly
Modified: gnunet/src/scalarproduct/gnunet-scalarproduct.c
===================================================================
--- gnunet/src/scalarproduct/gnunet-scalarproduct.c 2014-12-09 21:06:07 UTC
(rev 34517)
+++ gnunet/src/scalarproduct/gnunet-scalarproduct.c 2014-12-09 21:17:46 UTC
(rev 34518)
@@ -138,8 +138,7 @@
{
ret = 0;
fprintf (stdout,
- "%s%s\n",
- (0 > gcry_mpi_cmp_ui (result, 0)) ? "-" : "",
+ "%s\n",
buf);
fflush (stdout);
}
Modified: gnunet/src/scalarproduct/scalarproduct_api.c
===================================================================
--- gnunet/src/scalarproduct/scalarproduct_api.c 2014-12-09 21:06:07 UTC
(rev 34517)
+++ gnunet/src/scalarproduct/scalarproduct_api.c 2014-12-09 21:17:46 UTC
(rev 34518)
@@ -389,9 +389,9 @@
}
else
{
- if (0 < ntohl (msg->range))
+ if (0 < (int32_t) ntohl (msg->range))
gcry_mpi_add (result, result, num);
- else if (0 > ntohl (msg->range))
+ else
gcry_mpi_sub (result, result, num);
gcry_mpi_release (num);
}
Modified: gnunet/src/scalarproduct/test_scalarproduct_negative.sh
===================================================================
--- gnunet/src/scalarproduct/test_scalarproduct_negative.sh 2014-12-09
21:06:07 UTC (rev 34517)
+++ gnunet/src/scalarproduct/test_scalarproduct_negative.sh 2014-12-09
21:17:46 UTC (rev 34518)
@@ -39,6 +39,6 @@
echo "OK"
exit 0
else
- echo "Result $RESULT NOTOK"
+ echo "Result $RESULT, expected $EXPECTED NOTOK"
exit 1
fi
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r34518 - gnunet/src/scalarproduct,
gnunet <=