c1dbbbb2d4dca8022f2ea0e1ee636cd6fca8c7af
[bcm963xx.git] / userapps / opensource / sshd / libtommath / bn_mp_dr_setup.c
1 /* LibTomMath, multiple-precision integer library -- Tom St Denis\r
2  *\r
3  * LibTomMath is library that provides for multiple-precision\r
4  * integer arithmetic as well as number theoretic functionality.\r
5  *\r
6  * The library is designed directly after the MPI library by\r
7  * Michael Fromberger but has been written from scratch with\r
8  * additional optimizations in place.\r
9  *\r
10  * The library is free for all purposes without any express\r
11  * guarantee it works.\r
12  *\r
13  * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org\r
14  */\r
15 #include <tommath.h>\r
16 \r
17 /* determines the setup value */\r
18 void mp_dr_setup(mp_int *a, mp_digit *d)\r
19 {\r
20    /* the casts are required if DIGIT_BIT is one less than\r
21     * the number of bits in a mp_digit [e.g. DIGIT_BIT==31]\r
22     */\r
23    *d = (mp_digit)((((mp_word)1) << ((mp_word)DIGIT_BIT)) - \r
24         ((mp_word)a->dp[0]));\r
25 }\r
26 \r