File tree 2 files changed +7
-0
lines changed 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -2658,6 +2658,12 @@ \section{Function Macros}
2658
2658
\end {alltt }
2659
2659
Checks if $ a = 0 $ . It does not check if the amount of memory allocated for $ a$ is also minimal.
2660
2660
2661
+ \index {mp\_ isone}
2662
+ \begin {alltt }
2663
+ bool mp_isone(mp_int *a)
2664
+ \end {alltt }
2665
+ Checks if $ a = 1 $ .
2666
+
2661
2667
Other macros which are either shortcuts to normal functions or just other names for them do have
2662
2668
their place in a programmer's life, too!
2663
2669
Original file line number Diff line number Diff line change @@ -208,6 +208,7 @@ mp_err mp_init_size(mp_int *a, int size) MP_WUR;
208
208
209
209
/* ---> Basic Manipulations <--- */
210
210
#define mp_iszero (a ) ((a)->used == 0)
211
+ #define mp_isone (a ) ( ((a)->sign == MP_ZPOS) && ((a)->used == 1u) && ((a)->dp[0] == 1u) )
211
212
#define mp_isneg (a ) ((a)->sign == MP_NEG)
212
213
#define mp_iseven (a ) (((a)->used == 0) || (((a)->dp[0] & 1u) == 0u))
213
214
#define mp_isodd (a ) (!mp_iseven(a))
You can’t perform that action at this time.
0 commit comments