aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlukyan <lukyan@yandex-team.com>2022-12-26 13:02:19 +0300
committerlukyan <lukyan@yandex-team.com>2022-12-26 13:02:19 +0300
commit5636efb306871428cb9dfaf1509af9afcbf4dab3 (patch)
tree020b5ab77b010a62f8eb0183559077cac574c336
parent5897bc008c208676c8fc671308eceffd4be21c0c (diff)
downloadydb-5636efb306871428cb9dfaf1509af9afcbf4dab3.tar.gz
Cosmetics in ref counted
-rw-r--r--library/cpp/yt/memory/atomic_intrusive_ptr-inl.h4
-rw-r--r--library/cpp/yt/memory/atomic_intrusive_ptr.h4
-rw-r--r--library/cpp/yt/memory/ref_counted-inl.h6
3 files changed, 7 insertions, 7 deletions
diff --git a/library/cpp/yt/memory/atomic_intrusive_ptr-inl.h b/library/cpp/yt/memory/atomic_intrusive_ptr-inl.h
index f52e5d37da..5442fc1e05 100644
--- a/library/cpp/yt/memory/atomic_intrusive_ptr-inl.h
+++ b/library/cpp/yt/memory/atomic_intrusive_ptr-inl.h
@@ -50,7 +50,7 @@ TAtomicIntrusivePtr<T>& TAtomicIntrusivePtr<T>::operator=(std::nullptr_t)
template <class T>
TIntrusivePtr<T> TAtomicIntrusivePtr<T>::Acquire() const
{
- char* ptr = Ptr_.load();
+ void* ptr = Ptr_.load();
while (true) {
auto [localRefs, obj] = UnpackPointer<T>(ptr);
@@ -156,7 +156,7 @@ TAtomicIntrusivePtr<T>::operator bool() const
}
template <class T>
-char* TAtomicIntrusivePtr<T>::AcquireObject(T* obj, bool consumeRef)
+void* TAtomicIntrusivePtr<T>::AcquireObject(T* obj, bool consumeRef)
{
if (obj) {
Ref(obj, static_cast<int>(ReservedRefCount - consumeRef));
diff --git a/library/cpp/yt/memory/atomic_intrusive_ptr.h b/library/cpp/yt/memory/atomic_intrusive_ptr.h
index bbcfc25e95..d3f5bb16db 100644
--- a/library/cpp/yt/memory/atomic_intrusive_ptr.h
+++ b/library/cpp/yt/memory/atomic_intrusive_ptr.h
@@ -59,7 +59,7 @@ private:
// LocalRefCount is incremented in Acquire method.
// When localRefCount exceeds ReservedRefCount / 2 a new portion of refs are required globally.
// This field is marked mutable in order to make Acquire const-qualified in accordance to its semantics.
- mutable std::atomic<char*> Ptr_ = nullptr;
+ mutable std::atomic<void*> Ptr_ = nullptr;
constexpr static int CounterBits = 64 - PtrBits;
constexpr static int ReservedRefCount = (1 << CounterBits) - 1;
@@ -67,7 +67,7 @@ private:
// Consume ref if ownership is transferred.
// AcquireObject(ptr.Release(), true)
// AcquireObject(ptr.Get(), false)
- static char* AcquireObject(T* obj, bool consumeRef = false);
+ static void* AcquireObject(T* obj, bool consumeRef = false);
static void ReleaseObject(void* packedPtr);
static void DoRelease(T* obj, int refs);
};
diff --git a/library/cpp/yt/memory/ref_counted-inl.h b/library/cpp/yt/memory/ref_counted-inl.h
index 9b30960917..3f034ba7dc 100644
--- a/library/cpp/yt/memory/ref_counted-inl.h
+++ b/library/cpp/yt/memory/ref_counted-inl.h
@@ -14,9 +14,9 @@ constexpr uint16_t PtrBits = 48;
constexpr uintptr_t PtrMask = (1ULL << PtrBits) - 1;
template <class T>
-Y_FORCE_INLINE char* PackPointer(T* ptr, uint16_t data)
+Y_FORCE_INLINE void* PackPointer(T* ptr, uint16_t data)
{
- return reinterpret_cast<char*>((static_cast<uintptr_t>(data) << PtrBits) | reinterpret_cast<uintptr_t>(ptr));
+ return reinterpret_cast<void*>((static_cast<uintptr_t>(data) << PtrBits) | reinterpret_cast<uintptr_t>(ptr));
}
template <class T>
@@ -268,7 +268,7 @@ void TRefCounted::DestroyRefCountedImpl(T* ptr)
YT_ASSERT(offset < std::numeric_limits<uint16_t>::max());
- auto* vTablePtr = reinterpret_cast<char**>(basePtr);
+ auto* vTablePtr = reinterpret_cast<void**>(basePtr);
*vTablePtr = PackPointer(&TMemoryReleaser<T>::Do, offset);
if (refCounter->WeakUnref()) {