Skip to content

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

C

Use alignas instead of DV_ALIGNED (#2437)

otakuto2647ec5f3f57
diff --git a/toonz/sources/common/trop/tresample.cpp b/toonz/sources/common/trop/tresample.cpp
index b1fc6f3d5..1f3cee2be 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 {
-DV_ALIGNED(16) class TPixelFloat {
+class alignas(16) 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 706adba92..73e2b4a64 100644
--- a/toonz/sources/common/trop/tropcm.cpp
+++ b/toonz/sources/common/trop/tropcm.cpp
@@ -34,7 +34,7 @@ extern "C" {
namespace {
-DV_ALIGNED(16) class TPixelFloat {
+class alignas(16) 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 a5dec3d33..d08803a1e 100644
--- a/toonz/sources/include/tcommon.h
+++ b/toonz/sources/include/tcommon.h
@@ -149,12 +149,6 @@ 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 5dd25b09c..5b633f2da 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 DV_ALIGNED(4) TPixelRGBM32 {
+class DVAPI alignas(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 DV_ALIGNED(4) TPixelRGBM64 {
+class DVAPI alignas(4) TPixelRGBM64 {
#else
-class DVAPI DV_ALIGNED(8) TPixelRGBM64 {
+class DVAPI alignas(8) TPixelRGBM64 {
#endif
public:
static const int maxChannelValue;