aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/misc/guid-inl.h
diff options
context:
space:
mode:
authorbabenko <babenko@yandex-team.ru>2022-02-10 16:49:19 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:19 +0300
commitcec37806d8847aa3db53bafc9e251d4aaf325c12 (patch)
tree4a61c191e93e31d9ab423e258c71ab43550ee3d2 /library/cpp/yt/misc/guid-inl.h
parent58cd0b86ed99a72df22479e26a20bc1c1e57e65e (diff)
downloadydb-cec37806d8847aa3db53bafc9e251d4aaf325c12.tar.gz
Restoring authorship annotation for <babenko@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/yt/misc/guid-inl.h')
-rw-r--r--library/cpp/yt/misc/guid-inl.h132
1 files changed, 66 insertions, 66 deletions
diff --git a/library/cpp/yt/misc/guid-inl.h b/library/cpp/yt/misc/guid-inl.h
index 2d94b5701b..3f0768cca2 100644
--- a/library/cpp/yt/misc/guid-inl.h
+++ b/library/cpp/yt/misc/guid-inl.h
@@ -1,76 +1,76 @@
-#ifndef GUID_INL_H_
-#error "Direct inclusion of this file is not allowed, include guid.h"
+#ifndef GUID_INL_H_
+#error "Direct inclusion of this file is not allowed, include guid.h"
// For the sake of sane code completion.
#include "guid.h"
-#endif
-
-namespace NYT {
-
-////////////////////////////////////////////////////////////////////////////////
-
-Y_FORCE_INLINE constexpr TGuid::TGuid()
- : Parts32{}
-{ }
-
-Y_FORCE_INLINE constexpr TGuid::TGuid(ui32 part0, ui32 part1, ui32 part2, ui32 part3)
- : Parts32{part0, part1, part2, part3}
-{ }
-
-Y_FORCE_INLINE constexpr TGuid::TGuid(ui64 part0, ui64 part1)
- : Parts64{part0, part1}
-{ }
-
-Y_FORCE_INLINE bool TGuid::IsEmpty() const
-{
- return Parts64[0] == 0 && Parts64[1] == 0;
-}
-
-Y_FORCE_INLINE TGuid::operator bool() const
+#endif
+
+namespace NYT {
+
+////////////////////////////////////////////////////////////////////////////////
+
+Y_FORCE_INLINE constexpr TGuid::TGuid()
+ : Parts32{}
+{ }
+
+Y_FORCE_INLINE constexpr TGuid::TGuid(ui32 part0, ui32 part1, ui32 part2, ui32 part3)
+ : Parts32{part0, part1, part2, part3}
+{ }
+
+Y_FORCE_INLINE constexpr TGuid::TGuid(ui64 part0, ui64 part1)
+ : Parts64{part0, part1}
+{ }
+
+Y_FORCE_INLINE bool TGuid::IsEmpty() const
+{
+ return Parts64[0] == 0 && Parts64[1] == 0;
+}
+
+Y_FORCE_INLINE TGuid::operator bool() const
{
return !IsEmpty();
}
-////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////////////////
+
Y_FORCE_INLINE bool operator == (TGuid lhs, TGuid rhs)
-{
- return lhs.Parts64[0] == rhs.Parts64[0] &&
- lhs.Parts64[1] == rhs.Parts64[1];
-}
-
+{
+ return lhs.Parts64[0] == rhs.Parts64[0] &&
+ lhs.Parts64[1] == rhs.Parts64[1];
+}
+
Y_FORCE_INLINE bool operator != (TGuid lhs, TGuid rhs)
-{
- return !(lhs == rhs);
-}
-
+{
+ return !(lhs == rhs);
+}
+
Y_FORCE_INLINE bool operator < (TGuid lhs, TGuid rhs)
-{
-#ifdef __GNUC__
- ui64 lhs0 = __builtin_bswap64(lhs.Parts64[0]);
- ui64 rhs0 = __builtin_bswap64(rhs.Parts64[0]);
- if (lhs0 < rhs0) {
- return true;
- }
- if (lhs0 > rhs0) {
- return false;
- }
- ui64 lhs1 = __builtin_bswap64(lhs.Parts64[1]);
- ui64 rhs1 = __builtin_bswap64(rhs.Parts64[1]);
- return lhs1 < rhs1;
-#else
- return memcmp(&lhs, &rhs, sizeof(TGuid)) < 0;
-#endif
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
-} // namespace NYT
-
+{
+#ifdef __GNUC__
+ ui64 lhs0 = __builtin_bswap64(lhs.Parts64[0]);
+ ui64 rhs0 = __builtin_bswap64(rhs.Parts64[0]);
+ if (lhs0 < rhs0) {
+ return true;
+ }
+ if (lhs0 > rhs0) {
+ return false;
+ }
+ ui64 lhs1 = __builtin_bswap64(lhs.Parts64[1]);
+ ui64 rhs1 = __builtin_bswap64(rhs.Parts64[1]);
+ return lhs1 < rhs1;
+#else
+ return memcmp(&lhs, &rhs, sizeof(TGuid)) < 0;
+#endif
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+} // namespace NYT
+
Y_FORCE_INLINE size_t THash<NYT::TGuid>::operator()(const NYT::TGuid& guid) const
-{
- const size_t p = 1000000009; // prime number
- return guid.Parts32[0] +
- guid.Parts32[1] * p +
- guid.Parts32[2] * p * p +
- guid.Parts32[3] * p * p * p;
-}
+{
+ const size_t p = 1000000009; // prime number
+ return guid.Parts32[0] +
+ guid.Parts32[1] * p +
+ guid.Parts32[2] * p * p +
+ guid.Parts32[3] * p * p * p;
+}