ogl_beamforming

Ultrasound Beamforming Implemented with OpenGL
git clone anongit@rnpnr.xyz:ogl_beamforming.git
Log | Files | Refs | Feed | Submodules | README | LICENSE

Commit: 2e593e5f54f802dbd3d93eeb509e7ee33acca826
Parent: f6c70b1210ab66f57dc3de8317a44c5cc66acfc8
Author: Randy Palamar
Date:   Wed, 14 Jan 2026 11:13:42 -0700

lib: use likely/unlikely in check_shared_memory

After startup these checks will only fail when the beamformer
closes. Using these hints also reduces the library's binary size
by ~1K since the compiler inlines less of the memory opening code
into each function.

Diffstat:
Mlib/ogl_beamformer_lib.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/ogl_beamformer_lib.c b/lib/ogl_beamformer_lib.c @@ -109,7 +109,7 @@ lib_error_check_(b32 condition, BeamformerLibErrorKind error_kind) function b32 check_shared_memory(void) { - if (!g_beamformer_library_context.bp) { + if unlikely(!g_beamformer_library_context.bp) { g_beamformer_library_context.bp = os_open_shared_memory_area(OS_SHARED_MEMORY_NAME); if (lib_error_check(g_beamformer_library_context.bp != 0, SharedMemory)) { u32 version = g_beamformer_library_context.bp->version; @@ -118,8 +118,8 @@ check_shared_memory(void) } b32 result = 0; - if (g_beamformer_library_context.bp) - result = lib_error_check(!g_beamformer_library_context.bp->invalid, InvalidAccess); + if likely(g_beamformer_library_context.bp) + result = lib_error_check(likely(!g_beamformer_library_context.bp->invalid), InvalidAccess); return result; }