Discontinue manual inline hinting

Compiler knows better than we do.

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2022-02-03 14:20:51 +01:00
parent 4521ea8f00
commit 76a90a203c

View File

@ -20,7 +20,7 @@ namespace stdex
/// ///
/// Constructs blank encoding session /// Constructs blank encoding session
/// ///
inline base64_enc() noexcept : num(0) base64_enc() noexcept : num(0)
{ {
buf[0] = 0; buf[0] = 0;
buf[1] = 0; buf[1] = 0;
@ -37,7 +37,7 @@ namespace stdex
/// \param[in ] is_last Is this the last block of data? /// \param[in ] is_last Is this the last block of data?
/// ///
template<class _Elem, class _Traits, class _Ax> template<class _Elem, class _Traits, class _Ax>
inline void encode(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &out, _In_bytecount_(size) const void *data, _In_ size_t size, _In_opt_ bool is_last = true) void encode(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &out, _In_bytecount_(size) const void *data, _In_ size_t size, _In_opt_ bool is_last = true)
{ {
assert(data || !size); assert(data || !size);
@ -68,7 +68,7 @@ namespace stdex
/// ///
/// Resets encoding session /// Resets encoding session
/// ///
inline void clear() noexcept void clear() noexcept
{ {
num = 0; num = 0;
} }
@ -81,7 +81,7 @@ namespace stdex
/// ///
/// \returns Maximum number of bytes for the encoded data of `size` length /// \returns Maximum number of bytes for the encoded data of `size` length
/// ///
inline size_t enc_size(size_t size) const noexcept size_t enc_size(size_t size) const noexcept
{ {
return ((num + size + 2)/3)*4; return ((num + size + 2)/3)*4;
} }
@ -92,7 +92,7 @@ namespace stdex
/// Encodes one complete internal buffer of data /// Encodes one complete internal buffer of data
/// ///
template<class _Elem, class _Traits, class _Ax> template<class _Elem, class _Traits, class _Ax>
inline void encode(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &out) void encode(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &out)
{ {
out += base64_enc_lookup[ buf[0] >> 2 ]; out += base64_enc_lookup[ buf[0] >> 2 ];
out += base64_enc_lookup[((buf[0] << 4) | (buf[1] >> 4)) & 0x3f]; out += base64_enc_lookup[((buf[0] << 4) | (buf[1] >> 4)) & 0x3f];
@ -105,7 +105,7 @@ namespace stdex
/// Encodes partial internal buffer of data /// Encodes partial internal buffer of data
/// ///
template<class _Elem, class _Traits, class _Ax> template<class _Elem, class _Traits, class _Ax>
inline void encode(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &out, _In_ size_t size) void encode(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &out, _In_ size_t size)
{ {
if (size > 0) { if (size > 0) {
out += base64_enc_lookup[buf[0] >> 2]; out += base64_enc_lookup[buf[0] >> 2];
@ -157,7 +157,7 @@ namespace stdex
/// ///
/// Constructs blank decoding session /// Constructs blank decoding session
/// ///
inline base64_dec() noexcept : num(0) base64_dec() noexcept : num(0)
{ {
buf[0] = 0; buf[0] = 0;
buf[1] = 0; buf[1] = 0;
@ -175,7 +175,7 @@ namespace stdex
/// \param[in ] size Length of `data` in bytes /// \param[in ] size Length of `data` in bytes
/// ///
template<class _Ty, class _Ax, class _Tchr> template<class _Ty, class _Ax, class _Tchr>
inline void decode(_Inout_ std::vector<_Ty, _Ax> &out, _Out_ bool &is_last, _In_z_count_(size) const _Tchr *data, _In_ size_t size) void decode(_Inout_ std::vector<_Ty, _Ax> &out, _Out_ bool &is_last, _In_z_count_(size) const _Tchr *data, _In_ size_t size)
{ {
is_last = false; is_last = false;
@ -210,7 +210,7 @@ namespace stdex
/// ///
/// Resets decoding session /// Resets decoding session
/// ///
inline void clear() noexcept void clear() noexcept
{ {
num = 0; num = 0;
} }
@ -223,7 +223,7 @@ namespace stdex
/// ///
/// \returns Maximum number of bytes for the decoded data of `size` length /// \returns Maximum number of bytes for the decoded data of `size` length
/// ///
inline size_t dec_size(size_t size) const noexcept size_t dec_size(size_t size) const noexcept
{ {
return ((num + size + 3)/4)*3; return ((num + size + 3)/4)*3;
} }
@ -234,7 +234,7 @@ namespace stdex
/// Decodes one complete internal buffer of data /// Decodes one complete internal buffer of data
/// ///
template<class _Ty, class _Ax> template<class _Ty, class _Ax>
inline size_t decode(_Inout_ std::vector<_Ty, _Ax> &out) size_t decode(_Inout_ std::vector<_Ty, _Ax> &out)
{ {
out.push_back((_Ty)(((buf[0] << 2) | (buf[1] >> 4)) & 0xff)); out.push_back((_Ty)(((buf[0] << 2) | (buf[1] >> 4)) & 0xff));
if (buf[2] < 64) { if (buf[2] < 64) {