Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Revert "Use alignas instead of DV_ALIGNED (#2437)"

Ivan Mahonin2f0c77374461
diff --git a/toonz/sources/common/trop/tresample.cpp b/toonz/sources/common/trop/tresample.cpp
index 1f3cee2be..b1fc6f3d5 100644
--- a/toonz/sources/common/trop/tresample.cpp
+++ b/toonz/sources/common/trop/tresample.cpp
@@ -1349,7 +1349,7 @@ void resample_main_rgbm(TRasterPT<T> rout, const TRasterPT<T> &rin,
namespace {
-class alignas(16) TPixelFloat {
+DV_ALIGNED(16) class TPixelFloat {
public:
TPixelFloat() : b(0), g(0), r(0), m(0) {}
diff --git a/toonz/sources/common/trop/tropcm.cpp b/toonz/sources/common/trop/tropcm.cpp
index 73e2b4a64..706adba92 100644
--- a/toonz/sources/common/trop/tropcm.cpp
+++ b/toonz/sources/common/trop/tropcm.cpp
@@ -34,7 +34,7 @@ extern "C" {
namespace {
-class alignas(16) TPixelFloat {
+DV_ALIGNED(16) class TPixelFloat {
public:
TPixelFloat() : b(0), g(0), r(0), m(0) {}
diff --git a/toonz/sources/include/tcommon.h b/toonz/sources/include/tcommon.h
index 9ab7690d4..162f3b81a 100644
--- a/toonz/sources/include/tcommon.h
+++ b/toonz/sources/include/tcommon.h
@@ -149,6 +149,12 @@ const unsigned int c_maxuint = (unsigned int)(~0U);
#define DV_IMPORT_VAR
#endif
+#ifdef _MSC_VER
+#define DV_ALIGNED(val) __declspec(align(val))
+#else
+#define DV_ALIGNED(val) __attribute__((aligned(val)))
+#endif
+
inline short swapShort(short val) { return ((val >> 8) & 0x00ff) | (val << 8); }
inline TINT32 swapTINT32(TINT32 val) {
TINT32 appo, aux, aux1;
diff --git a/toonz/sources/include/tpixel.h b/toonz/sources/include/tpixel.h
index 5b633f2da..5dd25b09c 100644
--- a/toonz/sources/include/tpixel.h
+++ b/toonz/sources/include/tpixel.h
@@ -40,7 +40,7 @@ class TPixelGR16;
A set of predefined colors are included as well.
Note that channel ordering is platform depending. */
-class DVAPI alignas(4) TPixelRGBM32 {
+class DVAPI DV_ALIGNED(4) TPixelRGBM32 {
TPixelRGBM32(TUINT32 mask) { *(TUINT32 *)this = mask; };
public:
@@ -154,9 +154,9 @@ dithering
// Since SSE2 mostly require 16 byte aligned, changing 8 byte align to 4 byte
// align will not cause problems.
#if defined(_MSC_VER) && !defined(x64)
-class DVAPI alignas(4) TPixelRGBM64 {
+class DVAPI DV_ALIGNED(4) TPixelRGBM64 {
#else
-class DVAPI alignas(8) TPixelRGBM64 {
+class DVAPI DV_ALIGNED(8) TPixelRGBM64 {
#endif
public:
static const int maxChannelValue;