summaryrefslogtreecommitdiffhomepage
path: root/libtommath/bn_mp_get_long_long.c
diff options
context:
space:
mode:
Diffstat (limited to 'libtommath/bn_mp_get_long_long.c')
-rw-r--r--libtommath/bn_mp_get_long_long.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/libtommath/bn_mp_get_long_long.c b/libtommath/bn_mp_get_long_long.c
index 4b959e6..587c727 100644
--- a/libtommath/bn_mp_get_long_long.c
+++ b/libtommath/bn_mp_get_long_long.c
@@ -1,4 +1,4 @@
-#include <tommath_private.h>
+#include "tommath_private.h"
#ifdef BN_MP_GET_LONG_LONG_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
@@ -9,33 +9,34 @@
* Michael Fromberger but has been written from scratch with
* additional optimizations in place.
*
- * The library is free for all purposes without any express
- * guarantee it works.
- *
- * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
+ * SPDX-License-Identifier: Unlicense
*/
/* get the lower unsigned long long of an mp_int, platform dependent */
-unsigned long long mp_get_long_long (mp_int * a)
+unsigned long long mp_get_long_long(const mp_int *a)
{
- int i;
- unsigned long long res;
+ int i;
+ unsigned long long res;
- if (a->used == 0) {
- return 0;
- }
+ if (a->used == 0) {
+ return 0;
+ }
- /* get number of digits of the lsb we have to read */
- i = MIN(a->used,(int)(((sizeof(unsigned long long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1;
+ /* get number of digits of the lsb we have to read */
+ i = MIN(a->used, ((((int)sizeof(unsigned long long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1;
- /* get most significant digit of result */
- res = DIGIT(a,i);
+ /* get most significant digit of result */
+ res = DIGIT(a, i);
#if DIGIT_BIT < 64
- while (--i >= 0) {
- res = (res << DIGIT_BIT) | DIGIT(a,i);
- }
+ while (--i >= 0) {
+ res = (res << DIGIT_BIT) | DIGIT(a, i);
+ }
#endif
- return res;
+ return res;
}
#endif
+
+/* ref: HEAD -> master, tag: v1.1.0 */
+/* git commit: 08549ad6bc8b0cede0b357a9c341c5c6473a9c55 */
+/* commit time: 2019-01-28 20:32:32 +0100 */