Skip to content

Commit 87d6dfc

Browse files
committed
Fix clang-cl type %x aliasing error
1 parent 89b2604 commit 87d6dfc

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Editor and engineering scratch files
2+
.cache
23
.vs
34
.vscode
45
.DS_Store

Source/astcenc_vecmathlib_avx2_8.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// ----------------------------------------------------------------------------
3-
// Copyright 2019-2024 Arm Limited
3+
// Copyright 2019-2025 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
@@ -1176,8 +1176,12 @@ ASTCENC_SIMD_INLINE void printx(vint8 a)
11761176
{
11771177
alignas(32) int v[8];
11781178
storea(a, v);
1179+
1180+
unsigned int uv[8];
1181+
std::memcpy(uv, v, sizeof(int) * 8);
1182+
11791183
printf("v8_i32:\n %08x %08x %08x %08x %08x %08x %08x %08x\n",
1180-
v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7]);
1184+
uv[0], uv[1], uv[2], uv[3], uv[4], uv[5], uv[6], uv[7]);
11811185
}
11821186

11831187
/**

Source/astcenc_vecmathlib_common_4.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// ----------------------------------------------------------------------------
3-
// Copyright 2020-2024 Arm Limited
3+
// Copyright 2020-2025 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
@@ -380,8 +380,12 @@ ASTCENC_SIMD_INLINE void printx(vint4 a)
380380
{
381381
ASTCENC_ALIGNAS int v[4];
382382
storea(a, v);
383+
384+
unsigned int uv[4];
385+
std::memcpy(uv, v, sizeof(int) * 4);
386+
383387
printf("v4_i32:\n %08x %08x %08x %08x\n",
384-
v[0], v[1], v[2], v[3]);
388+
uv[0], uv[1], uv[2], uv[3]);
385389
}
386390

387391
/**

0 commit comments

Comments
 (0)