Skip to content

Commit cef5102

Browse files
committed
Do not override alignment for reference C builds
1 parent bbb6c47 commit cef5102

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

Source/astcenc_entry.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ astcenc_error astcenc_context_alloc(
712712

713713
size_t worksize = sizeof(compression_working_buffers) * thread_count;
714714
ctx->working_buffers = aligned_malloc<compression_working_buffers>(worksize, ASTCENC_VECALIGN);
715-
static_assert((sizeof(compression_working_buffers) % ASTCENC_VECALIGN) == 0,
715+
static_assert((ASTCENC_VECALIGN == 0) || ((sizeof(compression_working_buffers) % ASTCENC_VECALIGN) == 0),
716716
"compression_working_buffers size must be multiple of vector alignment");
717717
if (!ctx->working_buffers)
718718
{

Source/astcenc_mathlib.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// ----------------------------------------------------------------------------
3-
// Copyright 2011-2021 Arm Limited
3+
// Copyright 2011-2023 Arm Limited
44
//
55
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
66
// use this file except in compliance with the License. You may obtain a copy
@@ -73,10 +73,14 @@
7373
#endif
7474
#endif
7575

76+
// Force vector-sized SIMD alignment
7677
#if ASTCENC_AVX
7778
#define ASTCENC_VECALIGN 32
78-
#else
79+
#elif ASTCENC_SSE || ASTCENC_NEON
7980
#define ASTCENC_VECALIGN 16
81+
// Use default alignment for non-SIMD builds
82+
#else
83+
#define ASTCENC_VECALIGN 0
8084
#endif
8185

8286
#if ASTCENC_SSE != 0 || ASTCENC_AVX != 0 || ASTCENC_POPCNT != 0

0 commit comments

Comments
 (0)