summaryrefslogtreecommitdiffstats
path: root/libtommath/bn_mp_get_long.c
diff options
context:
space:
mode:
Diffstat (limited to 'libtommath/bn_mp_get_long.c')
-rw-r--r--libtommath/bn_mp_get_long.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/libtommath/bn_mp_get_long.c b/libtommath/bn_mp_get_long.c
index 7c3d0fe..3fc7c35 100644
--- a/libtommath/bn_mp_get_long.c
+++ b/libtommath/bn_mp_get_long.c
@@ -16,26 +16,26 @@
*/
/* get the lower unsigned long of an mp_int, platform dependent */
-unsigned long mp_get_long(mp_int * a)
+unsigned long mp_get_long(const mp_int *a)
{
- int i;
- unsigned long res;
+ int i;
+ unsigned 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) * 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) * 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 (ULONG_MAX != 0xffffffffuL) || (DIGIT_BIT < 32)
- 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