aboutsummaryrefslogtreecommitdiff
path: root/src/libmp/port/mpeuclid.c
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2006-04-01 19:24:03 +0000
committerrsc <devnull@localhost>2006-04-01 19:24:03 +0000
commitcbeb0b26e4c7caa8d1b47de791a7418dc20a4567 (patch)
treee0f7e445de1aa22a42ef873dc4b1118a8105ae93 /src/libmp/port/mpeuclid.c
parent226d80b8213821af0cbf092d1507c52b504fd368 (diff)
downloadplan9port-cbeb0b26e4c7caa8d1b47de791a7418dc20a4567.tar.gz
plan9port-cbeb0b26e4c7caa8d1b47de791a7418dc20a4567.tar.bz2
plan9port-cbeb0b26e4c7caa8d1b47de791a7418dc20a4567.zip
Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms.
Diffstat (limited to 'src/libmp/port/mpeuclid.c')
-rw-r--r--src/libmp/port/mpeuclid.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/libmp/port/mpeuclid.c b/src/libmp/port/mpeuclid.c
index 80b5983b..dda77eab 100644
--- a/src/libmp/port/mpeuclid.c
+++ b/src/libmp/port/mpeuclid.c
@@ -1,12 +1,12 @@
#include "os.h"
#include <mp.h>
-// extended euclid
-//
-// For a and b it solves, d = gcd(a,b) and finds x and y s.t.
-// ax + by = d
-//
-// Handbook of Applied Cryptography, Menezes et al, 1997, pg 67
+/* extended euclid */
+/* */
+/* For a and b it solves, d = gcd(a,b) and finds x and y s.t. */
+/* ax + by = d */
+/* */
+/* Handbook of Applied Cryptography, Menezes et al, 1997, pg 67 */
void
mpeuclid(mpint *a, mpint *b, mpint *d, mpint *x, mpint *y)
@@ -44,16 +44,16 @@ mpeuclid(mpint *a, mpint *b, mpint *d, mpint *x, mpint *y)
r = mpnew(0);
while(b->top != 0 && b->sign > 0){
- // q = a/b
- // r = a mod b
+ /* q = a/b */
+ /* r = a mod b */
mpdiv(a, b, q, r);
- // x0 = x2 - qx1
+ /* x0 = x2 - qx1 */
mpmul(q, x1, x0);
mpsub(x2, x0, x0);
- // y0 = y2 - qy1
+ /* y0 = y2 - qy1 */
mpmul(q, y1, y0);
mpsub(y2, y0, y0);
- // rotate values
+ /* rotate values */
tmp = a;
a = b;
b = r;