diff options
author | Egor Kochetov <gluk47@gmail.com> | 2022-02-10 16:50:36 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:36 +0300 |
commit | 40896b241c91572ea1369526ee1e6ae0ba340f34 (patch) | |
tree | cb6d8f482e66c136ec128a42417cd5f858520d12 /util/string/hex.h | |
parent | 3889d4c01a589a555fbc33d66279be23e267ab3b (diff) | |
download | ydb-40896b241c91572ea1369526ee1e6ae0ba340f34.tar.gz |
Restoring authorship annotation for Egor Kochetov <gluk47@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'util/string/hex.h')
-rw-r--r-- | util/string/hex.h | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/util/string/hex.h b/util/string/hex.h index af3d2d528f..0cef23cfff 100644 --- a/util/string/hex.h +++ b/util/string/hex.h @@ -2,7 +2,7 @@ #include <util/generic/string.h> #include <util/generic/yexception.h> -#include <util/system/yassert.h> +#include <util/system/yassert.h> inline static char DigitToChar(unsigned char digit) { if (digit < 10) { @@ -20,7 +20,7 @@ inline static int Char2Digit(char ch) { return result; } -//! Convert a hex string of exactly 2 chars to int +//! Convert a hex string of exactly 2 chars to int /*! @example String2Byte("10") => 16 */ inline static int String2Byte(const char* s) { return Char2Digit(*s) * 16 + Char2Digit(*(s + 1)); @@ -34,26 +34,26 @@ inline TString HexEncode(const TStringBuf h) { return HexEncode(h.data(), h.size()); } -//! Convert a hex string @c in of @c len chars (case-insensitive) to array of ints stored at @c ptr and return this array. -/*! @note len must be even (len % 2 == 0), otherwise an exception will be thrown. - * @return @c ptr, which is an array of chars, where each char holds the numeric value - * equal to the corresponding 2 digits of the input stream. - * @warning You must ensure that @c ptr has (len/2) allocated bytes, otherwise SIGSEGV will happen. - * - * @example HexDecode("beef", 4, ptr) => {190, 239} - */ -void* HexDecode(const void* in, size_t len, void* ptr); - -//! Convert a hex string @c in of @c len chars (case-insensitive) to array of ints and return this array. -/*! @note len must be even (len % 2 == 0), otherwise an exception will be thrown. - * @return an array of chars, where each char holds the numeric value equal to the corresponding 2 digits - * of the input stream. - * - * @example HexDecode("beef", 4) => {190, 239} - */ +//! Convert a hex string @c in of @c len chars (case-insensitive) to array of ints stored at @c ptr and return this array. +/*! @note len must be even (len % 2 == 0), otherwise an exception will be thrown. + * @return @c ptr, which is an array of chars, where each char holds the numeric value + * equal to the corresponding 2 digits of the input stream. + * @warning You must ensure that @c ptr has (len/2) allocated bytes, otherwise SIGSEGV will happen. + * + * @example HexDecode("beef", 4, ptr) => {190, 239} + */ +void* HexDecode(const void* in, size_t len, void* ptr); + +//! Convert a hex string @c in of @c len chars (case-insensitive) to array of ints and return this array. +/*! @note len must be even (len % 2 == 0), otherwise an exception will be thrown. + * @return an array of chars, where each char holds the numeric value equal to the corresponding 2 digits + * of the input stream. + * + * @example HexDecode("beef", 4) => {190, 239} + */ TString HexDecode(const void* in, size_t len); -//! Convert an ASCII hex-string (case-insensitive) to the binary form. Note that h.Size() must be even (+h % 2 == 0). +//! Convert an ASCII hex-string (case-insensitive) to the binary form. Note that h.Size() must be even (+h % 2 == 0). inline TString HexDecode(const TStringBuf h) { return HexDecode(h.data(), h.size()); } |