mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-08-24 23:25:58 +00:00
PPP, MAGIC: new function: magic_pow
magic_pow() returns a new random number between 0 and (2^pow)-1 included.
This commit is contained in:
parent
3686110ed2
commit
bec199c4a2
@ -100,6 +100,11 @@ void magic_randomize(void);
|
|||||||
*/
|
*/
|
||||||
u32_t magic(void); /* Returns the next magic number */
|
u32_t magic(void); /* Returns the next magic number */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return a new random number between 0 and (2^pow)-1 included.
|
||||||
|
*/
|
||||||
|
u32_t magic_pow(u8_t pow);
|
||||||
|
|
||||||
#if PPP_MD5_RANDM
|
#if PPP_MD5_RANDM
|
||||||
/*
|
/*
|
||||||
* Fill buffer with random bytes
|
* Fill buffer with random bytes
|
||||||
|
@ -264,4 +264,11 @@ u32_t magic() {
|
|||||||
|
|
||||||
#endif /* PPP_MD5_RANDM */
|
#endif /* PPP_MD5_RANDM */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return a new random number between 0 and (2^pow)-1 included.
|
||||||
|
*/
|
||||||
|
u32_t magic_pow(u8_t pow) {
|
||||||
|
return magic() & ~(~0UL<<pow);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* PPP_SUPPORT */
|
#endif /* PPP_SUPPORT */
|
||||||
|
Loading…
Reference in New Issue
Block a user