mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
Change the compiler's big integer library to use libTomMath
This now replaces Bill's crappy big int implementation
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
#include "tommath_private.h"
|
||||
#ifdef S_MP_GET_BIT_C
|
||||
|
||||
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
|
||||
/* SPDX-License-Identifier: Unlicense */
|
||||
|
||||
/* Get bit at position b and return true if the bit is 1, false if it is 0 */
|
||||
bool s_mp_get_bit(const mp_int *a, int b)
|
||||
{
|
||||
mp_digit bit;
|
||||
int limb = b / MP_DIGIT_BIT;
|
||||
|
||||
if (limb < 0 || limb >= a->used) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bit = (mp_digit)1 << (b % MP_DIGIT_BIT);
|
||||
return ((a->dp[limb] & bit) != 0u);
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user