diff options
Diffstat (limited to 'indra/llcommon/u64.h')
-rw-r--r-- | indra/llcommon/u64.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/indra/llcommon/u64.h b/indra/llcommon/u64.h index ad93ebffe7..f4580513bc 100644 --- a/indra/llcommon/u64.h +++ b/indra/llcommon/u64.h @@ -32,11 +32,41 @@ #ifndef LL_U64_H #define LL_U64_H +/** + * @brief Forgivingly parse a null terminated character array. + * + * @param str The string to parse. + * @return Returns the first U64 value found in the string or 0 on failure. + */ U64 str_to_U64(const char* str); + +/** + * @brief Given a U64 value, return a printable representation. + * + * The client of this function is expected to provide an allocated + * buffer. The function then snprintf() into that buffer, so providing + * NULL has undefined behavior. Providing a buffer which is too small + * will truncate the printable value, so usually you want to declare + * the buffer: + * + * char result[U64_BUF]; + * std::cout << "value: " << U64_to_str(value, result, U64_BUF); + * + * @param value The U64 to turn into a printable character array. + * @param result The buffer to use + * @param result_size The size of the buffer allocated. Use U64_BUF. + * @return Returns the result pointer. + */ char* U64_to_str(U64 value, char* result, S32 result_size); +/** + * @brief Convert a U64 to the closest F64 value. + */ F64 U64_to_F64(const U64 value); +/** + * @brief Helper function to wrap strtoull() which is not available on windows. + */ U64 llstrtou64(const char* str, char** end, S32 base); #endif |