Replace ad-hoc or locally defined power-of-2 tests

with isPowerOf2() from intmath.hh.

base/sched_list.hh:
    Use isPowerOf2() from intmath.hh.

--HG--
extra : convert_revision : 7b2409531d8ed194aa7e1cfcd1ecb8460c797a16
This commit is contained in:
Steve Reinhardt 2006-02-08 10:40:43 -05:00
parent ad1e46203b
commit 524da7cd20

View file

@ -30,8 +30,10 @@
#define SCHED_LIST_HH #define SCHED_LIST_HH
#include <list> #include <list>
#include "base/intmath.hh"
#include "base/misc.hh" #include "base/misc.hh"
// Any types you use this class for must be covered here... // Any types you use this class for must be covered here...
namespace { namespace {
void ClearEntry(int &i) { i = 0; }; void ClearEntry(int &i) { i = 0; };
@ -80,7 +82,7 @@ SchedList<T>::SchedList(unsigned _size)
size = _size; size = _size;
// size must be a power of two // size must be a power of two
if (size & (size-1)) { if (!isPowerOf2(size)) {
panic("SchedList: size must be a power of two"); panic("SchedList: size must be a power of two");
} }