summaryrefslogtreecommitdiff
path: root/number.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'number.cpp')
-rw-r--r--number.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/number.cpp b/number.cpp
index fcc6dc0..ae4b167 100644
--- a/number.cpp
+++ b/number.cpp
@@ -51,6 +51,16 @@ number::to_dec_string() const
return ss.str();
}
+std::uint32_t
+number::to_uint32() const
+{
+ if (*this > UINT32_MAX) {
+ throw std::out_of_range("> UINT32_MAX");
+ }
+
+ return (*this == 0) ? 0 : _operands.front();
+}
+
/* }}} */
/* Operations {{{ */