aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/guid.h
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:15 +0300
commit72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch)
treeda2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /util/generic/guid.h
parent778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff)
downloadydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic/guid.h')
-rw-r--r--util/generic/guid.h38
1 files changed, 19 insertions, 19 deletions
diff --git a/util/generic/guid.h b/util/generic/guid.h
index 2bf6c8ad99..9f1adf1f61 100644
--- a/util/generic/guid.h
+++ b/util/generic/guid.h
@@ -3,7 +3,7 @@
#include "fwd.h"
#include <util/str_stl.h>
-
+
/**
* UUID generation
*
@@ -14,16 +14,16 @@
* See https://clubs.at.yandex-team.ru/stackoverflow/10238/10240
* and https://st.yandex-team.ru/IGNIETFERRO-768 for details.
*/
-struct TGUID {
+struct TGUID {
ui32 dw[4] = {};
constexpr bool IsEmpty() const noexcept {
- return (dw[0] | dw[1] | dw[2] | dw[3]) == 0;
- }
-
+ return (dw[0] | dw[1] | dw[2] | dw[3]) == 0;
+ }
+
constexpr explicit operator bool() const noexcept {
- return !IsEmpty();
- }
+ return !IsEmpty();
+ }
// xxxx-xxxx-xxxx-xxxx
TString AsGuidString() const;
@@ -43,29 +43,29 @@ struct TGUID {
**/
static TGUID CreateTimebased();
};
-
+
constexpr bool operator==(const TGUID& a, const TGUID& b) noexcept {
return a.dw[0] == b.dw[0] && a.dw[1] == b.dw[1] && a.dw[2] == b.dw[2] && a.dw[3] == b.dw[3];
-}
-
+}
+
constexpr bool operator!=(const TGUID& a, const TGUID& b) noexcept {
- return !(a == b);
-}
-
-struct TGUIDHash {
+ return !(a == b);
+}
+
+struct TGUIDHash {
constexpr int operator()(const TGUID& a) const noexcept {
- return a.dw[0] + a.dw[1] + a.dw[2] + a.dw[3];
- }
+ return a.dw[0] + a.dw[1] + a.dw[2] + a.dw[3];
+ }
};
-
+
template <>
-struct THash<TGUID> {
+struct THash<TGUID> {
constexpr size_t operator()(const TGUID& g) const noexcept {
return (unsigned int)TGUIDHash()(g);
}
};
-void CreateGuid(TGUID* res);
+void CreateGuid(TGUID* res);
TString GetGuidAsString(const TGUID& g);
TString CreateGuidAsString();
TGUID GetGuid(TStringBuf s);