Remove dead code
With byte_count unsigned, we will never hit the negative path.
Test: m test-art-host-gtest
Change-Id: I6856e133447b38e97118920b03264b554e736a29
diff --git a/libartbase/base/utils.cc b/libartbase/base/utils.cc
index 339cf83..492e737 100644
--- a/libartbase/base/utils.cc
+++ b/libartbase/base/utils.cc
@@ -218,21 +218,16 @@
10*MB, // MB up to...
10ULL*GB // GB from here.
};
- static const int64_t kBytesPerUnit[] = { 1, KB, MB, GB };
+ static const uint64_t kBytesPerUnit[] = { 1, KB, MB, GB };
static const char* const kUnitStrings[] = { "B", "KB", "MB", "GB" };
- const char* negative_str = "";
- if (byte_count < 0) {
- negative_str = "-";
- byte_count = -byte_count;
- }
int i = arraysize(kUnitThresholds);
while (--i > 0) {
if (byte_count >= kUnitThresholds[i]) {
break;
}
}
- return StringPrintf("%s%" PRId64 "%s",
- negative_str, byte_count / kBytesPerUnit[i], kUnitStrings[i]);
+ return StringPrintf("%" PRIu64 "%s",
+ byte_count / kBytesPerUnit[i], kUnitStrings[i]);
}
void Split(const std::string& s, char separator, std::vector<std::string>* result) {