diff options
author | David Robillard <d@drobilla.net> | 2024-10-06 19:06:03 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2024-10-11 19:58:27 -0400 |
commit | 676651dea6c22895b0bc8de18d724d716089d798 (patch) | |
tree | affa307ae70d866c5909a5a41d011cd24ba25c3e /src | |
parent | f447448aa3c6c944a27c29793b92f4d7fb5df432 (diff) | |
download | ingen-676651dea6c22895b0bc8de18d724d716089d798.tar.gz ingen-676651dea6c22895b0bc8de18d724d716089d798.tar.bz2 ingen-676651dea6c22895b0bc8de18d724d716089d798.zip |
Clarify atom forge buffer dereferencing code
Diffstat (limited to 'src')
-rw-r--r-- | src/AtomForge.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
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<LV2_Atom*>(_buf.get() + (ref - 1) / sizeof(LV2_Atom)); + return static_cast<LV2_Atom*>(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 |