summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2013-06-28 18:33:19 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2013-06-28 18:33:19 +0000
commita45b375610b24243ad131c96142f7f57c08c2d43 (patch)
tree7c1ee64d9bb4aefbb922044ba0c33a2d1c9fdd6a
parentd7648ff20f8bbc8217a26576ca96addc55e003de (diff)
downloadllvm-a45b375610b24243ad131c96142f7f57c08c2d43.tar.gz
llvm-a45b375610b24243ad131c96142f7f57c08c2d43.tar.bz2
llvm-a45b375610b24243ad131c96142f7f57c08c2d43.tar.xz
Stylistic cleanups, no functional change.
- Use static functions instead of anonymous namespace. - Appease the Doxygen lobby. - Use 0-based induction variable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185185 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Support/BlockFrequency.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/Support/BlockFrequency.cpp b/lib/Support/BlockFrequency.cpp
index 08fa620eb8..6e4d6b1b33 100644
--- a/lib/Support/BlockFrequency.cpp
+++ b/lib/Support/BlockFrequency.cpp
@@ -18,10 +18,8 @@
using namespace llvm;
-namespace {
-
-/// mult96bit - Multiply FREQ by N and store result in W array.
-void mult96bit(uint64_t freq, uint32_t N, uint64_t W[2]) {
+/// Multiply FREQ by N and store result in W array.
+static void mult96bit(uint64_t freq, uint32_t N, uint64_t W[2]) {
uint64_t u0 = freq & UINT32_MAX;
uint64_t u1 = freq >> 32;
@@ -42,15 +40,15 @@ void mult96bit(uint64_t freq, uint32_t N, uint64_t W[2]) {
}
-/// div96bit - Divide 96-bit value stored in W array by D.
+/// Divide 96-bit value stored in W array by D.
/// Return 64-bit quotient, saturated to UINT64_MAX on overflow.
-uint64_t div96bit(uint64_t W[2], uint32_t D) {
+static uint64_t div96bit(uint64_t W[2], uint32_t D) {
uint64_t y = W[0];
uint64_t x = W[1];
- int i;
+ unsigned i;
// This long division algorithm automatically saturates on overflow.
- for (i = 1; i <= 64 && x; ++i) {
+ for (i = 0; i < 64 && x; ++i) {
uint32_t t = (int)x >> 31;
x = (x << 1) | (y >> 63);
y = y << 1;
@@ -60,10 +58,9 @@ uint64_t div96bit(uint64_t W[2], uint32_t D) {
}
}
- return y << (64 - i + 1);
+ return y << (64 - i);
}
-}
void BlockFrequency::scale(uint32_t N, uint32_t D) {
assert(D != 0 && "Division by zero");