aboutsummaryrefslogtreecommitdiff
path: root/llvm/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
commit43a1decc8c1d1bd6579d683ed0465b2126ddcf62 (patch)
treed6322c2a5459dde333854e2711384fa0b718999e /llvm/lib/Support/APInt.cpp
parent820256bc99dfe9b23a9fd4a5a81b3acc88ed51b2 (diff)
downloadllvm-43a1decc8c1d1bd6579d683ed0465b2126ddcf62.zip
llvm-43a1decc8c1d1bd6579d683ed0465b2126ddcf62.tar.gz
llvm-43a1decc8c1d1bd6579d683ed0465b2126ddcf62.tar.bz2
Update error messages for '+'. Fix grammar and make the two
negative checks resemble each other. llvm-svn: 79595
Diffstat (limited to 'llvm/lib/Support/APInt.cpp')
-rw-r--r--llvm/lib/Support/APInt.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp
index 1754bae..6943d27 100644
--- a/llvm/lib/Support/APInt.cpp
+++ b/llvm/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");