Artifact 9576fec64ba9bab51027d586bb1a269a6e77263c541782522e94250d825be677:
- File libtommath/bn_mp_get_double.c — part of check-in [94cf70186e] at 2019-06-13 19:07:13 on branch libtommath — Update to latest libtommath's "develop" branch. On the way to 1.2.0 (user: jan.nijtmans, size: 436) [annotate] [blame] [check-ins using] [more...]
#include "tommath_private.h" #ifdef BN_MP_GET_DOUBLE_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ double mp_get_double(const mp_int *a) { int i; double d = 0.0, fac = 1.0; for (i = 0; i < MP_DIGIT_BIT; ++i) { fac *= 2.0; } for (i = a->used; i --> 0;) { d = (d * fac) + (double)a->dp[i]; } return (a->sign == MP_NEG) ? -d : d; } #endif