summaryrefslogtreecommitdiff
path: root/src/literal.cc
diff options
context:
space:
mode:
authorBen Smith <binjimin@gmail.com>2017-08-29 23:24:48 -0700
committerGitHub <noreply@github.com>2017-08-29 23:24:48 -0700
commit781e08e3ef857eb738fe54e6ef426717f99f5364 (patch)
treefc613a3e53d576bcb420d94dbaeefcae1051dd4d /src/literal.cc
parent7d33b3f26fc5aead990a35e4d089eaf2d5053202 (diff)
downloadwabt-781e08e3ef857eb738fe54e6ef426717f99f5364.tar.gz
wabt-781e08e3ef857eb738fe54e6ef426717f99f5364.tar.bz2
wabt-781e08e3ef857eb738fe54e6ef426717f99f5364.zip
Move Result to its own file (result.h) (#600)
* Unify all uses of `CHECK_RESULT` * Use `CHECK_RESULT` in a few more places * Add `operator|` and `operator|=` to `Result`, use it instead of `COMBINE_RESULT` * Change a few occurrences of `!Succeeded` to `Failed`
Diffstat (limited to 'src/literal.cc')
-rw-r--r--src/literal.cc9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/literal.cc b/src/literal.cc
index bac59975..8bc04a19 100644
--- a/src/literal.cc
+++ b/src/literal.cc
@@ -225,8 +225,7 @@ Result FloatParser<T>::ParseNan(const char* s,
for (; s < end; ++s) {
uint32_t digit;
- if (Failed(ParseHexdigit(*s, &digit)))
- return Result::Error;
+ CHECK_RESULT(ParseHexdigit(*s, &digit));
tag = tag * 16 + digit;
// Check for overflow.
if (tag > Traits::kSigMask)
@@ -552,8 +551,7 @@ Result ParseUint64(const char* s, const char* end, uint64_t* out) {
uint32_t digit;
if (*s == '_')
continue;
- if (Failed(ParseHexdigit(*s, &digit)))
- return Result::Error;
+ CHECK_RESULT(ParseHexdigit(*s, &digit));
uint64_t old_value = value;
value = value * 16 + digit;
// Check for overflow.
@@ -617,8 +615,7 @@ Result ParseInt32(const char* s,
has_sign = true;
s++;
}
- if (Failed(ParseUint64(s, end, &value)))
- return Result::Error;
+ CHECK_RESULT(ParseUint64(s, end, &value));
if (has_sign) {
// abs(INT32_MIN) == INT32_MAX + 1.