From 9ebcfcbd7952985ffc8cf528e70dcfba7ffce9d4 Mon Sep 17 00:00:00 2001 From: Allan Odgaard Date: Fri, 22 Feb 2013 15:52:53 +0100 Subject: [PATCH] Support to_s for most integer types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Here “most” refers to signed and unsigned 16, 32, and 64 bit integers. --- bin/gen_test | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/gen_test b/bin/gen_test index dfddd4e2..eb59a4a9 100755 --- a/bin/gen_test +++ b/bin/gen_test @@ -49,7 +49,12 @@ std::string to_s (bool value) { return value ? "YES" : "NO"; } std::string to_s (char value) { return oak_format("%c", value); } std::string to_s (size_t value) { return oak_format("%zu", value); } std::string to_s (ssize_t value) { return oak_format("%zd", value); } -std::string to_s (int value) { return oak_format("%d", value); } +std::string to_s (int16_t value) { return oak_format("%d", value); } +std::string to_s (uint16_t value) { return oak_format("%u", value); } +std::string to_s (int32_t value) { return oak_format("%d", value); } +std::string to_s (uint32_t value) { return oak_format("%u", value); } +std::string to_s (int64_t value) { return oak_format("%lld", value); } +std::string to_s (uint64_t value) { return oak_format("%llu", value); } std::string to_s (double value) { return oak_format("%g", value); } std::string to_s (char const* value) { return value == NULL ? "«NULL»" : oak_format("\"%s\"", value); } std::string to_s (std::string const& value) { return value == NULL_STR ? "«NULL_STR»" : "\"" + value + "\""; } @@ -113,7 +118,7 @@ std::string oak_format_bad_relation (char const* lhs, char const* op, char const #define OAK_MASSERT_NE(msg, lhs, rhs) if(!((lhs) != (rhs))) oak_assertion_error(msg, __FILE__, __LINE__) <%= user_code %> -#line 117 "<%= $PROGRAM_NAME %>" +#line 122 "<%= $PROGRAM_NAME %>" int main (int argc, char const* argv[]) {