File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -2658,6 +2658,12 @@ \section{Function Macros}
26582658\end {alltt }
26592659Checks if $ a = 0 $ . It does not check if the amount of memory allocated for $ a$ is also minimal.
26602660
2661+ \index {mp\_ isone}
2662+ \begin {alltt }
2663+ bool mp_isone(mp_int *a)
2664+ \end {alltt }
2665+ Checks if $ a = 1 $ .
2666+
26612667Other macros which are either shortcuts to normal functions or just other names for them do have
26622668their place in a programmer's life, too!
26632669
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;
208208
209209/* ---> Basic Manipulations <--- */
210210#define mp_iszero (a ) ((a)->used == 0)
211+ #define mp_isone (a ) ( ((a)->sign == MP_ZPOS) && ((a)->used == 1u) && ((a)->dp[0] == 1u) )
211212#define mp_isneg (a ) ((a)->sign == MP_NEG)
212213#define mp_iseven (a ) (((a)->used == 0) || (((a)->dp[0] & 1u) == 0u))
213214#define mp_isodd (a ) (!mp_iseven(a))
You can’t perform that action at this time.
0 commit comments