Merge pull request #209 from mahkoh/factor

prevent infinite loop
This commit is contained in:
Arcterus 2014-06-05 13:47:45 -07:00
commit 8b64287202
2 changed files with 4 additions and 1 deletions

View file

@ -27,6 +27,9 @@ static NAME: &'static str = "factor";
fn factor(mut num: u64) -> Vec<u64> {
let mut ret = Vec::new();
if num < 2 {
return ret;
}
while num % 2 == 0 {
num /= 2;
ret.push(2);

@ -1 +1 @@
Subproject commit adde85617a776ea98249504d653cb547a2353c98
Subproject commit 1711f3a648a5ee1519963820f742b28693c1ce6d