From 676651dea6c22895b0bc8de18d724d716089d798 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 6 Oct 2024 19:06:03 -0400 Subject: Clarify atom forge buffer dereferencing code --- src/AtomForge.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/AtomForge.cpp b/src/AtomForge.cpp index ed54142a..6a62a609 100644 --- a/src/AtomForge.cpp +++ b/src/AtomForge.cpp @@ -103,11 +103,12 @@ AtomForge::deref(const intptr_t ref) /* Make some assumptions and do unnecessary math to appease -Wcast-align. This is questionable at best, though the forge should only dereference references to aligned atoms. */ + LV2_Atom* const ptr = _buf.get(); assert((ref - 1) % sizeof(LV2_Atom) == 0); - return static_cast(_buf.get() + (ref - 1) / sizeof(LV2_Atom)); + return static_cast(ptr + (ref - 1) / sizeof(LV2_Atom)); // Alternatively: - // return (LV2_Atom*)((uint8_t*)_buf + ref - 1); + // return (LV2_Atom*)((uint8_t*)_buf.get() + ref - 1); } LV2_Atom_Forge_Ref -- cgit v1.2.1