Merge pull request #209 from mahkoh/factor

prevent infinite loop
This commit is contained in:
Arcterus
2014-06-05 13:47:45 -07:00
2 changed files with 4 additions and 1 deletions
+3
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);