Skip to content

Commit

Permalink
Ah messed up formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
NovaSmoof committed Apr 1, 2022
1 parent 10ba431 commit 117d677
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions include/uuid.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ namespace uuids
namespace detail
{
template <typename TChar>
[[nodiscard]] constexpr inline unsigned char hex2char(TChar const ch)
[[nodiscard]] constexpr inline unsigned char hex2char(TChar const ch)
{
if (ch >= static_cast<TChar>('0') && ch <= static_cast<TChar>('9'))
return static_cast<unsigned char>(ch - static_cast<TChar>('0'));
Expand All @@ -74,7 +74,7 @@ namespace uuids
}

template <typename TChar>
[[nodiscard]] constexpr inline bool is_hex(TChar const ch)
[[nodiscard]] constexpr inline bool is_hex(TChar const ch)
{
return
(ch >= static_cast<TChar>('0') && ch <= static_cast<TChar>('9')) ||
Expand All @@ -83,14 +83,14 @@ namespace uuids
}

template <typename TChar>
[[nodiscard]] constexpr std::basic_string_view<TChar> to_string_view(TChar const * str)
[[nodiscard]] constexpr std::basic_string_view<TChar> to_string_view(TChar const * str)
{
if (str) return str;
return {};
}

template <typename StringType>
[[nodiscard]] constexpr std::basic_string_view<
[[nodiscard]] constexpr std::basic_string_view<
typename StringType::value_type,
typename StringType::traits_type>
to_string_view(StringType const & str)
Expand All @@ -106,7 +106,7 @@ namespace uuids

static constexpr unsigned int block_bytes = 64;

[[nodiscard]] inline static uint32_t left_rotate(uint32_t value, size_t const count)
[[nodiscard]] inline static uint32_t left_rotate(uint32_t value, size_t const count)
{
return (value << count) ^ (value >> (32 - count));
}
Expand Down Expand Up @@ -182,7 +182,7 @@ namespace uuids
return digest;
}

uint8_t const * get_digest_bytes(digest8_t digest)
uint8_t const * get_digest_bytes(digest8_t digest)
{
digest32_t d32;
get_digest(d32);
Expand Down Expand Up @@ -296,14 +296,14 @@ namespace uuids
// --------------------------------------------------------------------------------------------------------------------------

// --------------------------------------------------------------------------------------------------------------------------
// Field NDR Data Type Octet # Note
// Field NDR Data Type Octet # Note
// --------------------------------------------------------------------------------------------------------------------------
// time_low unsigned long 0 - 3 The low field of the timestamp.
// time_mid unsigned short 4 - 5 The middle field of the timestamp.
// time_hi_and_version unsigned short 6 - 7 The high field of the timestamp multiplexed with the version number.
// clock_seq_hi_and_reserved unsigned small 8 The high field of the clock sequence multiplexed with the variant.
// clock_seq_low unsigned small 9 The low field of the clock sequence.
// node character 10 - 15 The spatially unique node identifier.
// time_low unsigned long 0 - 3 The low field of the timestamp.
// time_mid unsigned short 4 - 5 The middle field of the timestamp.
// time_hi_and_version unsigned short 6 - 7 The high field of the timestamp multiplexed with the version number.
// clock_seq_hi_and_reserved unsigned small 8 The high field of the clock sequence multiplexed with the variant.
// clock_seq_low unsigned small 9 The low field of the clock sequence.
// node character 10 - 15 The spatially unique node identifier.
// --------------------------------------------------------------------------------------------------------------------------
// 0 1 2 3
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
Expand Down Expand Up @@ -395,7 +395,7 @@ namespace uuids
std::copy(first, last, std::begin(data));
}

[[nodiscard]] constexpr uuid_variant variant() const noexcept
[[nodiscard]] constexpr uuid_variant variant() const noexcept
{
if ((data[8] & 0x80) == 0x00)
return uuid_variant::ncs;
Expand All @@ -407,7 +407,7 @@ namespace uuids
return uuid_variant::reserved;
}

[[nodiscard]] constexpr uuid_version version() const noexcept
[[nodiscard]] constexpr uuid_version version() const noexcept
{
if ((data[6] & 0xF0) == 0x10)
return uuid_version::time_based;
Expand All @@ -423,7 +423,7 @@ namespace uuids
return uuid_version::none;
}

[[nodiscard]] constexpr bool is_nil() const noexcept
[[nodiscard]] constexpr bool is_nil() const noexcept
{
for (size_t i = 0; i < data.size(); ++i) if (data[i] != 0) return false;
return true;
Expand All @@ -434,13 +434,13 @@ namespace uuids
data.swap(other.data);
}

[[nodiscard]] inline span<std::byte const, 16> as_bytes() const
[[nodiscard]] inline span<std::byte const, 16> as_bytes() const
{
return span<std::byte const, 16>(reinterpret_cast<std::byte const*>(data.data()), 16);
}

template <typename StringType>
[[nodiscard]] constexpr static bool is_valid_uuid(StringType const & in_str) noexcept
[[nodiscard]] constexpr static bool is_valid_uuid(StringType const & in_str) noexcept
{
auto str = detail::to_string_view(in_str);
bool firstDigit = true;
Expand Down Expand Up @@ -484,7 +484,7 @@ namespace uuids
}

template <typename StringType>
[[nodiscard]] constexpr static std::optional<uuid> from_string(StringType const & in_str) noexcept
[[nodiscard]] constexpr static std::optional<uuid> from_string(StringType const & in_str) noexcept
{
auto str = detail::to_string_view(in_str);
bool firstDigit = true;
Expand Down Expand Up @@ -517,7 +517,7 @@ namespace uuids
else
{
data[index] = static_cast<uint8_t>(data[index] | detail::hex2char(str[i]));
index++;
index++;
firstDigit = true;
}
}
Expand Down Expand Up @@ -567,7 +567,7 @@ namespace uuids
template <class CharT,
class Traits,
class Allocator>
[[nodiscard]] inline std::basic_string<CharT, Traits, Allocator> to_string(uuid const & id)
[[nodiscard]] inline std::basic_string<CharT, Traits, Allocator> to_string(uuid const & id)
{
std::basic_string<CharT, Traits, Allocator> uustr{detail::empty_guid<CharT>};

Expand Down Expand Up @@ -909,7 +909,7 @@ namespace std
using argument_type = uuids::uuid;
using result_type = std::size_t;

[[nodiscard]] result_type operator()(argument_type const &uuid) const
[[nodiscard]] result_type operator()(argument_type const &uuid) const
{
#ifdef UUID_HASH_STRING_BASED
std::hash<std::string> hasher;
Expand Down

0 comments on commit 117d677

Please sign in to comment.