Browse Source
Merge pull request #926 from trapexit/modzero
pfrd: fix mod by zero error when all branches are filtered
pull/938/head
trapexit
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
9 additions and
0 deletions
-
src/policy_eppfrd.cpp
-
src/policy_msppfrd.cpp
-
src/policy_pfrd.cpp
|
@ -155,6 +155,9 @@ namespace eppfrd |
|
|
uint64_t idx; |
|
|
uint64_t idx; |
|
|
uint64_t threshold; |
|
|
uint64_t threshold; |
|
|
|
|
|
|
|
|
|
|
|
if(sum_ == 0) |
|
|
|
|
|
return NULL; |
|
|
|
|
|
|
|
|
idx = 0; |
|
|
idx = 0; |
|
|
threshold = RND::rand64(sum_); |
|
|
threshold = RND::rand64(sum_); |
|
|
for(size_t i = 0; i < branchinfo_.size(); i++) |
|
|
for(size_t i = 0; i < branchinfo_.size(); i++) |
|
|
|
@ -114,6 +114,9 @@ namespace msppfrd |
|
|
uint64_t idx; |
|
|
uint64_t idx; |
|
|
uint64_t threshold; |
|
|
uint64_t threshold; |
|
|
|
|
|
|
|
|
|
|
|
if(sum_ == 0) |
|
|
|
|
|
return NULL; |
|
|
|
|
|
|
|
|
idx = 0; |
|
|
idx = 0; |
|
|
threshold = RND::rand64(sum_); |
|
|
threshold = RND::rand64(sum_); |
|
|
for(size_t i = 0; i < branchinfo_.size(); i++) |
|
|
for(size_t i = 0; i < branchinfo_.size(); i++) |
|
|
|
@ -84,6 +84,9 @@ namespace pfrd |
|
|
uint64_t idx; |
|
|
uint64_t idx; |
|
|
uint64_t threshold; |
|
|
uint64_t threshold; |
|
|
|
|
|
|
|
|
|
|
|
if(sum_ == 0) |
|
|
|
|
|
return NULL; |
|
|
|
|
|
|
|
|
idx = 0; |
|
|
idx = 0; |
|
|
threshold = RND::rand64(sum_); |
|
|
threshold = RND::rand64(sum_); |
|
|
for(size_t i = 0; i < branchinfo_.size(); i++) |
|
|
for(size_t i = 0; i < branchinfo_.size(); i++) |
|
|