summaryrefslogtreecommitdiff
path: root/lib/Support/APInt.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2009-08-21 04:10:31 +0000
committerEric Christopher <echristo@apple.com>2009-08-21 04:10:31 +0000
commite250f2a5ee2a794e531b159c270b63f5e70dfc27 (patch)
tree80dd9e94f006d4dd082585943bd2d43ae9d7eb92 /lib/Support/APInt.cpp
parentd37eda8c1d152780914fd71eee7d36fff407e1a1 (diff)
downloadllvm-e250f2a5ee2a794e531b159c270b63f5e70dfc27.tar.gz
llvm-e250f2a5ee2a794e531b159c270b63f5e70dfc27.tar.bz2
llvm-e250f2a5ee2a794e531b159c270b63f5e70dfc27.tar.xz
Update error messages for '+'. Fix grammar and make the two
negative checks resemble each other. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79595 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/APInt.cpp')
-rw-r--r--lib/Support/APInt.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp
index 1754baed06..6943d27976 100644
--- a/lib/Support/APInt.cpp
+++ b/lib/Support/APInt.cpp
@@ -623,14 +623,15 @@ unsigned APInt::getBitsNeeded(const StringRef& str, uint8_t radix) {
size_t slen = str.size();
- // Each computation below needs to know if its negative
+ // Each computation below needs to know if it's negative.
StringRef::iterator p = str.begin();
- unsigned isNegative = str.front() == '-';
+ unsigned isNegative = *p == '-';
if (*p == '-' || *p == '+') {
p++;
slen--;
- assert(slen && "string is only a minus!");
+ assert(slen && "String is only a sign, needs a value.");
}
+
// For radixes of power-of-two values, the bits required is accurately and
// easily computed
if (radix == 2)
@@ -2052,7 +2053,7 @@ void APInt::fromString(unsigned numbits, const StringRef& str, uint8_t radix) {
if (*p == '-' || *p == '+') {
p++;
slen--;
- assert(slen && "string is only a minus!");
+ assert(slen && "String is only a sign, needs a value.");
}
assert((slen <= numbits || radix != 2) && "Insufficient bit width");
assert(((slen-1)*3 <= numbits || radix != 8) && "Insufficient bit width");