mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-28 07:17:32 +00:00
Code Cleanup.
(See http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090831/086139.html) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80909 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -32,6 +32,13 @@ static inline unsigned ByteSwap(unsigned Var, bool Really) {
|
|||||||
((Var & (255<<24)) >> 24);
|
((Var & (255<<24)) >> 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const unsigned AddCounts(unsigned A, unsigned B) {
|
||||||
|
// If either value is undefined, use the other.
|
||||||
|
if (A == ~0U) return B;
|
||||||
|
if (B == ~0U) return A;
|
||||||
|
return A + B;
|
||||||
|
}
|
||||||
|
|
||||||
static void ReadProfilingBlock(const char *ToolName, FILE *F,
|
static void ReadProfilingBlock(const char *ToolName, FILE *F,
|
||||||
bool ShouldByteSwap,
|
bool ShouldByteSwap,
|
||||||
std::vector<unsigned> &Data) {
|
std::vector<unsigned> &Data) {
|
||||||
@@ -62,25 +69,11 @@ static void ReadProfilingBlock(const char *ToolName, FILE *F,
|
|||||||
// Accumulate the data we just read into the data.
|
// Accumulate the data we just read into the data.
|
||||||
if (!ShouldByteSwap) {
|
if (!ShouldByteSwap) {
|
||||||
for (unsigned i = 0; i != NumEntries; ++i) {
|
for (unsigned i = 0; i != NumEntries; ++i) {
|
||||||
unsigned data = TempSpace[i];
|
Data[i] = AddCounts(TempSpace[i], Data[i]);
|
||||||
if (data != (unsigned)-1) { // only load data if its not MissingVal
|
|
||||||
if (Data[i] == (unsigned)-1) {
|
|
||||||
Data[i] = data; // if data is still initialised
|
|
||||||
} else {
|
|
||||||
Data[i] += data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (unsigned i = 0; i != NumEntries; ++i) {
|
for (unsigned i = 0; i != NumEntries; ++i) {
|
||||||
unsigned data = ByteSwap(TempSpace[i], true);
|
Data[i] = AddCounts(ByteSwap(TempSpace[i], true), Data[i]);
|
||||||
if (data != (unsigned)-1) { // only load data if its not MissingVal
|
|
||||||
if (Data[i] == (unsigned)-1) {
|
|
||||||
Data[i] = data;
|
|
||||||
} else {
|
|
||||||
Data[i] += data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user