lib/prime.c: fixed a bug where 2 was not a prime in is_prime().
This commit is contained in:
parent
f22af0ffaf
commit
428e392868
2 changed files with 2 additions and 1 deletions
|
|
@ -6,6 +6,8 @@ int is_prime(uint32_t p) {
|
||||||
|
|
||||||
uint32_t i, l;
|
uint32_t i, l;
|
||||||
|
|
||||||
|
if (p == 2)
|
||||||
|
return 1;
|
||||||
if (p < 2 || (p & 1) == 0)
|
if (p < 2 || (p & 1) == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
|
|
||||||
#ifndef __PRIME_H
|
#ifndef __PRIME_H
|
||||||
|
|
||||||
#define __PRIME_H
|
#define __PRIME_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue