summaryrefslogtreecommitdiff
path: root/src/util/allocator.h
diff options
context:
space:
mode:
author2lag <96544487+2lag@users.noreply.github.com>2026-08-08 17:33:36 +0200
committer2lag <96544487+2lag@users.noreply.github.com>2026-08-08 17:33:36 +0200
commit2973df584978d9aae6f164ce0204179c8a28b3ae (patch)
treec1b793c8e0d17aeb66c5197bc28acca84b2c98ab /src/util/allocator.h
parente540910745aad31378452eec25aacfb3f346191a (diff)
console, textbox changes, some other shit
Diffstat (limited to 'src/util/allocator.h')
-rw-r--r--src/util/allocator.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/util/allocator.h b/src/util/allocator.h
index 63fc94a..5fc5aa6 100644
--- a/src/util/allocator.h
+++ b/src/util/allocator.h
@@ -312,14 +312,16 @@ struct LIST {
if( idx >= size )
return;
- if constexpr( !__is_trivially_destructible(T) ) {
- data[idx].~T();
- memset( &data[idx], 0, sizeof(T) );
- }
-
- for( U32 i = idx; i < size - 1; i++ )
+ for( U32 i = idx; i + 1 < size; ++i )
data[i] = data[i + 1];
+ U32 last = size - 1;
+
+ if constexpr( !__is_trivially_destructible(T) )
+ data[last].~T();
+
+ memset( &data[last], 0, sizeof(T) );
+
if( --size < capacity / 4 )
shrink();
}