diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llcommon/u64.h | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/linden/indra/llcommon/u64.h b/linden/indra/llcommon/u64.h index 2b14018..ab06836 100644 --- a/linden/indra/llcommon/u64.h +++ b/linden/indra/llcommon/u64.h | |||
@@ -12,12 +12,12 @@ | |||
12 | * ("GPL"), unless you have obtained a separate licensing agreement | 12 | * ("GPL"), unless you have obtained a separate licensing agreement |
13 | * ("Other License"), formally executed by you and Linden Lab. Terms of | 13 | * ("Other License"), formally executed by you and Linden Lab. Terms of |
14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | 14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or |
15 | * online at http://secondlife.com/developers/opensource/gplv2 | 15 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 |
16 | * | 16 | * |
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlife.com/developers/opensource/flossexception | 20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception |
21 | * | 21 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 22 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 23 | * that you have read and understood your obligations described above, |
@@ -32,11 +32,41 @@ | |||
32 | #ifndef LL_U64_H | 32 | #ifndef LL_U64_H |
33 | #define LL_U64_H | 33 | #define LL_U64_H |
34 | 34 | ||
35 | /** | ||
36 | * @brief Forgivingly parse a null terminated character array. | ||
37 | * | ||
38 | * @param str The string to parse. | ||
39 | * @return Returns the first U64 value found in the string or 0 on failure. | ||
40 | */ | ||
35 | U64 str_to_U64(const char* str); | 41 | U64 str_to_U64(const char* str); |
42 | |||
43 | /** | ||
44 | * @brief Given a U64 value, return a printable representation. | ||
45 | * | ||
46 | * The client of this function is expected to provide an allocated | ||
47 | * buffer. The function then snprintf() into that buffer, so providing | ||
48 | * NULL has undefined behavior. Providing a buffer which is too small | ||
49 | * will truncate the printable value, so usually you want to declare | ||
50 | * the buffer: | ||
51 | * | ||
52 | * char result[U64_BUF]; | ||
53 | * std::cout << "value: " << U64_to_str(value, result, U64_BUF); | ||
54 | * | ||
55 | * @param value The U64 to turn into a printable character array. | ||
56 | * @param result The buffer to use | ||
57 | * @param result_size The size of the buffer allocated. Use U64_BUF. | ||
58 | * @return Returns the result pointer. | ||
59 | */ | ||
36 | char* U64_to_str(U64 value, char* result, S32 result_size); | 60 | char* U64_to_str(U64 value, char* result, S32 result_size); |
37 | 61 | ||
62 | /** | ||
63 | * @brief Convert a U64 to the closest F64 value. | ||
64 | */ | ||
38 | F64 U64_to_F64(const U64 value); | 65 | F64 U64_to_F64(const U64 value); |
39 | 66 | ||
67 | /** | ||
68 | * @brief Helper function to wrap strtoull() which is not available on windows. | ||
69 | */ | ||
40 | U64 llstrtou64(const char* str, char** end, S32 base); | 70 | U64 llstrtou64(const char* str, char** end, S32 base); |
41 | 71 | ||
42 | #endif | 72 | #endif |