Browse Source

pfrd: fix mod by zero error when all branches are filtered

pull/926/head
Antonio SJ Musumeci 3 years ago
parent
commit
098f353bf1
  1. 3
      src/policy_eppfrd.cpp
  2. 3
      src/policy_msppfrd.cpp
  3. 3
      src/policy_pfrd.cpp

3
src/policy_eppfrd.cpp

@ -155,6 +155,9 @@ namespace eppfrd
uint64_t idx;
uint64_t threshold;
if(sum_ == 0)
return NULL;
idx = 0;
threshold = RND::rand64(sum_);
for(size_t i = 0; i < branchinfo_.size(); i++)

3
src/policy_msppfrd.cpp

@ -114,6 +114,9 @@ namespace msppfrd
uint64_t idx;
uint64_t threshold;
if(sum_ == 0)
return NULL;
idx = 0;
threshold = RND::rand64(sum_);
for(size_t i = 0; i < branchinfo_.size(); i++)

3
src/policy_pfrd.cpp

@ -84,6 +84,9 @@ namespace pfrd
uint64_t idx;
uint64_t threshold;
if(sum_ == 0)
return NULL;
idx = 0;
threshold = RND::rand64(sum_);
for(size_t i = 0; i < branchinfo_.size(); i++)

Loading…
Cancel
Save