summaryrefslogtreecommitdiffstats
path: root/libtommath/bn_mp_init_size.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2017-09-18 15:13:40 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2017-09-18 15:13:40 (GMT)
commitdb596f769f7d0d74193f88b121b949bce6853ebf (patch)
treefeb67968040c4869b021497e6e8859e0e90e41be /libtommath/bn_mp_init_size.c
parent36098aafd9bbd015808f0607f94acc590d192e0d (diff)
parent7a4fe54c26332c21cd95b01cc07bd74714d060ae (diff)
downloadtcl-z_modifier.zip
tcl-z_modifier.tar.gz
tcl-z_modifier.tar.bz2
Merge trunkz_modifier
Diffstat (limited to 'libtommath/bn_mp_init_size.c')
-rw-r--r--libtommath/bn_mp_init_size.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/libtommath/bn_mp_init_size.c b/libtommath/bn_mp_init_size.c
index 4446773..623a03f 100644
--- a/libtommath/bn_mp_init_size.c
+++ b/libtommath/bn_mp_init_size.c
@@ -16,30 +16,30 @@
*/
/* init an mp_init for a given size */
-int mp_init_size (mp_int * a, int size)
+int mp_init_size(mp_int *a, int size)
{
- int x;
+ int x;
- /* pad size so there are always extra digits */
- size += (MP_PREC * 2) - (size % MP_PREC);
-
- /* alloc mem */
- a->dp = OPT_CAST(mp_digit) XMALLOC (sizeof (mp_digit) * size);
- if (a->dp == NULL) {
- return MP_MEM;
- }
+ /* pad size so there are always extra digits */
+ size += (MP_PREC * 2) - (size % MP_PREC);
- /* set the members */
- a->used = 0;
- a->alloc = size;
- a->sign = MP_ZPOS;
+ /* alloc mem */
+ a->dp = OPT_CAST(mp_digit) XMALLOC(sizeof(mp_digit) * size);
+ if (a->dp == NULL) {
+ return MP_MEM;
+ }
- /* zero the digits */
- for (x = 0; x < size; x++) {
+ /* set the members */
+ a->used = 0;
+ a->alloc = size;
+ a->sign = MP_ZPOS;
+
+ /* zero the digits */
+ for (x = 0; x < size; x++) {
a->dp[x] = 0;
- }
+ }
- return MP_OKAY;
+ return MP_OKAY;
}
#endif