summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
Diffstat (limited to 'src/base')
-rw-r--r--src/base/bitfield.hh25
-rw-r--r--src/base/stats/mysql.cc5
-rw-r--r--src/base/stats/mysql.hh10
3 files changed, 31 insertions, 9 deletions
diff --git a/src/base/bitfield.hh b/src/base/bitfield.hh
index 0f1233677..83b9138b4 100644
--- a/src/base/bitfield.hh
+++ b/src/base/bitfield.hh
@@ -112,4 +112,29 @@ replaceBits(T& val, int first, int last, B bit_val)
val = insertBits(val, first, last, bit_val);
}
+/**
+ * Returns the bit position of the MSB that is set in the input
+ */
+inline
+int
+findMsbSet(uint64_t val) {
+ int msb = 0;
+ if (!val)
+ return 0;
+ if (bits(val, 63,32)) msb += 32;
+ val >>= 32;
+ if (bits(val, 31,16)) msb += 16;
+ val >>= 16;
+ if (bits(val, 15,8)) msb += 8;
+ val >>= 8;
+ if (bits(val, 7,4)) msb += 4;
+ val >>= 4;
+ if (bits(val, 3,2)) msb += 2;
+ val >>= 2;
+ if (bits(val, 1,1)) msb += 1;
+ return msb;
+}
+
+
+
#endif // __BASE_BITFIELD_HH__
diff --git a/src/base/stats/mysql.cc b/src/base/stats/mysql.cc
index d4035986b..39a687fff 100644
--- a/src/base/stats/mysql.cc
+++ b/src/base/stats/mysql.cc
@@ -930,7 +930,7 @@ MySql::visit(const FormulaData &data)
bool
initMySQL(string host, string user, string password, string database,
- string name, string sample, string project)
+ string project, string name, string sample)
{
extern list<Output *> OutputList;
static MySql mysql;
@@ -938,9 +938,6 @@ initMySQL(string host, string user, string password, string database,
if (mysql.connected())
return false;
- if (user.empty())
- user = username();
-
mysql.connect(host, user, password, database, name, sample, project);
OutputList.push_back(&mysql);
diff --git a/src/base/stats/mysql.hh b/src/base/stats/mysql.hh
index 52f93ac61..0ce381c2f 100644
--- a/src/base/stats/mysql.hh
+++ b/src/base/stats/mysql.hh
@@ -187,15 +187,15 @@ class MySql : public Output
void configure(const FormulaData &data);
};
-bool initMySQL(std::string host, std::string database, std::string user = "",
- std::string passwd = "", std::string name = "test",
- std::string sample = "0", std::string project = "test");
+bool initMySQL(std::string host, std::string database, std::string user,
+ std::string passwd, std::string project, std::string name,
+ std::string sample);
#if !USE_MYSQL
inline bool
initMySQL(std::string host, std::string user, std::string password,
- std::string database, std::string name, std::string sample,
- std::string project)
+ std::string database, std::string project, std::string name,
+ std::string sample)
{
return false;
}