summaryrefslogtreecommitdiffstats
path: root/libtommath/bn_mp_is_square.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2017-09-20 09:07:35 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2017-09-20 09:07:35 (GMT)
commit88b282766104841d47f9878536605bc08ae4c599 (patch)
tree57406e965f588883b917e212fb93e93ac84f72cc /libtommath/bn_mp_is_square.c
parent7a4fe54c26332c21cd95b01cc07bd74714d060ae (diff)
downloadtcl-88b282766104841d47f9878536605bc08ae4c599.zip
tcl-88b282766104841d47f9878536605bc08ae4c599.tar.gz
tcl-88b282766104841d47f9878536605bc08ae4c599.tar.bz2
Further astyle formatting of libtommath. No functional changes.
Diffstat (limited to 'libtommath/bn_mp_is_square.c')
-rw-r--r--libtommath/bn_mp_is_square.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libtommath/bn_mp_is_square.c b/libtommath/bn_mp_is_square.c
index 4d8612f..dd5150e 100644
--- a/libtommath/bn_mp_is_square.c
+++ b/libtommath/bn_mp_is_square.c
@@ -38,7 +38,7 @@ static const char rem_105[105] = {
};
/* Store non-zero to ret if arg is square, and zero if not */
-int mp_is_square(const mp_int *arg,int *ret)
+int mp_is_square(const mp_int *arg, int *ret)
{
int res;
mp_digit c;
@@ -58,12 +58,12 @@ int mp_is_square(const mp_int *arg,int *ret)
}
/* First check mod 128 (suppose that DIGIT_BIT is at least 7) */
- if (rem_128[127 & DIGIT(arg,0)] == 1) {
+ if (rem_128[127 & DIGIT(arg, 0)] == 1) {
return MP_OKAY;
}
/* Next check mod 105 (3*5*7) */
- if ((res = mp_mod_d(arg,105,&c)) != MP_OKAY) {
+ if ((res = mp_mod_d(arg, 105, &c)) != MP_OKAY) {
return res;
}
if (rem_105[c] == 1) {
@@ -71,10 +71,10 @@ int mp_is_square(const mp_int *arg,int *ret)
}
- if ((res = mp_init_set_int(&t,11L*13L*17L*19L*23L*29L*31L)) != MP_OKAY) {
+ if ((res = mp_init_set_int(&t, 11L*13L*17L*19L*23L*29L*31L)) != MP_OKAY) {
return res;
}
- if ((res = mp_mod(arg,&t,&t)) != MP_OKAY) {
+ if ((res = mp_mod(arg, &t, &t)) != MP_OKAY) {
goto ERR;
}
r = mp_get_int(&t);
@@ -91,14 +91,14 @@ int mp_is_square(const mp_int *arg,int *ret)
if (((1L<<(r%31)) & 0x6DE2B848L) != 0L) goto ERR;
/* Final check - is sqr(sqrt(arg)) == arg ? */
- if ((res = mp_sqrt(arg,&t)) != MP_OKAY) {
+ if ((res = mp_sqrt(arg, &t)) != MP_OKAY) {
goto ERR;
}
- if ((res = mp_sqr(&t,&t)) != MP_OKAY) {
+ if ((res = mp_sqr(&t, &t)) != MP_OKAY) {
goto ERR;
}
- *ret = (mp_cmp_mag(&t,arg) == MP_EQ) ? MP_YES : MP_NO;
+ *ret = (mp_cmp_mag(&t, arg) == MP_EQ) ? MP_YES : MP_NO;
ERR:
mp_clear(&t);
return res;