num.h (d101cdd6edd782f6ec56eef63ed91abd77a8b317) num.h (76238846ad3e9e271a3d1f792f72beab727fd153)
1/*
2 * *****************************************************************************
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 *
6 * Copyright (c) 2018-2023 Gavin D. Howard and contributors.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 57 unchanged lines hidden (view full) ---

66#define BC_BASE_DIGS (9)
67
68/// The max number + 1 that one limb can hold.
69#define BC_BASE_POW (1000000000)
70
71/// An alias for portability.
72#define BC_NUM_BIGDIG_C UINT64_C
73
1/*
2 * *****************************************************************************
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 *
6 * Copyright (c) 2018-2023 Gavin D. Howard and contributors.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 57 unchanged lines hidden (view full) ---

66#define BC_BASE_DIGS (9)
67
68/// The max number + 1 that one limb can hold.
69#define BC_BASE_POW (1000000000)
70
71/// An alias for portability.
72#define BC_NUM_BIGDIG_C UINT64_C
73
74/// The max number + 1 that two limbs can hold. This is used for generating
75/// numbers because the PRNG can generate a number that will fill two limbs.
76#define BC_BASE_RAND_POW (BC_NUM_BIGDIG_C(1000000000000000000))
77
74/// The actual limb type.
75typedef int_least32_t BcDig;
76
77#elif BC_LONG_BIT >= 32
78
79/// The biggest number held by a BcBigDig.
80#define BC_NUM_BIGDIG_MAX ((BcBigDig) UINT32_MAX)
81
82/// The number of decimal digits in one limb.
83#define BC_BASE_DIGS (4)
84
85/// The max number + 1 that one limb can hold.
86#define BC_BASE_POW (10000)
87
88/// An alias for portability.
89#define BC_NUM_BIGDIG_C UINT32_C
90
78/// The actual limb type.
79typedef int_least32_t BcDig;
80
81#elif BC_LONG_BIT >= 32
82
83/// The biggest number held by a BcBigDig.
84#define BC_NUM_BIGDIG_MAX ((BcBigDig) UINT32_MAX)
85
86/// The number of decimal digits in one limb.
87#define BC_BASE_DIGS (4)
88
89/// The max number + 1 that one limb can hold.
90#define BC_BASE_POW (10000)
91
92/// An alias for portability.
93#define BC_NUM_BIGDIG_C UINT32_C
94
95/// The max number + 1 that two limbs can hold. This is used for generating
96/// numbers because the PRNG can generate a number that will fill two limbs.
97#define BC_BASE_RAND_POW (UINT64_C(100000000))
98
91/// The actual limb type.
92typedef int_least16_t BcDig;
93
94#else
95
96/// LONG_BIT must be at least 32 on POSIX. We depend on that.
97#error BC_LONG_BIT must be at least 32
98

--- 807 unchanged lines hidden ---
99/// The actual limb type.
100typedef int_least16_t BcDig;
101
102#else
103
104/// LONG_BIT must be at least 32 on POSIX. We depend on that.
105#error BC_LONG_BIT must be at least 32
106

--- 807 unchanged lines hidden ---