2021-12-27 01:00:00 +01:00
|
|
|
// Common/IntToString.h
|
|
|
|
|
|
2023-06-21 02:00:00 +02:00
|
|
|
#ifndef ZIP7_INC_COMMON_INT_TO_STRING_H
|
|
|
|
|
#define ZIP7_INC_COMMON_INT_TO_STRING_H
|
2021-12-27 01:00:00 +01:00
|
|
|
|
|
|
|
|
#include "MyTypes.h"
|
|
|
|
|
|
|
|
|
|
// return: the pointer to the "terminating" null character after written characters
|
|
|
|
|
|
|
|
|
|
char * ConvertUInt32ToString(UInt32 value, char *s) throw();
|
|
|
|
|
char * ConvertUInt64ToString(UInt64 value, char *s) throw();
|
|
|
|
|
|
|
|
|
|
wchar_t * ConvertUInt32ToString(UInt32 value, wchar_t *s) throw();
|
|
|
|
|
wchar_t * ConvertUInt64ToString(UInt64 value, wchar_t *s) throw();
|
2024-05-14 02:00:00 +02:00
|
|
|
void ConvertInt64ToString(Int64 value, char *s) throw();
|
|
|
|
|
void ConvertInt64ToString(Int64 value, wchar_t *s) throw();
|
2021-12-27 01:00:00 +01:00
|
|
|
|
|
|
|
|
void ConvertUInt64ToOct(UInt64 value, char *s) throw();
|
|
|
|
|
|
2024-05-14 02:00:00 +02:00
|
|
|
extern const char k_Hex_Upper[16];
|
|
|
|
|
extern const char k_Hex_Lower[16];
|
|
|
|
|
|
|
|
|
|
#define GET_HEX_CHAR_UPPER(t) (k_Hex_Upper[t])
|
|
|
|
|
#define GET_HEX_CHAR_LOWER(t) (k_Hex_Lower[t])
|
|
|
|
|
/*
|
|
|
|
|
// #define GET_HEX_CHAR_UPPER(t) ((char)(((t < 10) ? ('0' + t) : ('A' + (t - 10)))))
|
|
|
|
|
static inline unsigned GetHex_Lower(unsigned v)
|
|
|
|
|
{
|
|
|
|
|
const unsigned v0 = v + '0';
|
|
|
|
|
v += 'a' - 10;
|
|
|
|
|
if (v < 'a')
|
|
|
|
|
v = v0;
|
|
|
|
|
return v;
|
|
|
|
|
}
|
|
|
|
|
static inline char GetHex_Upper(unsigned v)
|
|
|
|
|
{
|
|
|
|
|
return (char)((v < 10) ? ('0' + v) : ('A' + (v - 10)));
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2021-12-27 01:00:00 +01:00
|
|
|
void ConvertUInt32ToHex(UInt32 value, char *s) throw();
|
|
|
|
|
void ConvertUInt64ToHex(UInt64 value, char *s) throw();
|
|
|
|
|
void ConvertUInt32ToHex8Digits(UInt32 value, char *s) throw();
|
|
|
|
|
// void ConvertUInt32ToHex8Digits(UInt32 value, wchar_t *s) throw();
|
|
|
|
|
|
|
|
|
|
// use RawLeGuid only for RAW bytes that contain stored GUID as Little-endian.
|
|
|
|
|
char *RawLeGuidToString(const Byte *guid, char *s) throw();
|
|
|
|
|
char *RawLeGuidToString_Braced(const Byte *guid, char *s) throw();
|
|
|
|
|
|
2024-05-14 02:00:00 +02:00
|
|
|
void ConvertDataToHex_Lower(char *dest, const Byte *src, size_t size) throw();
|
|
|
|
|
void ConvertDataToHex_Upper(char *dest, const Byte *src, size_t size) throw();
|
|
|
|
|
|
2021-12-27 01:00:00 +01:00
|
|
|
#endif
|