translate alias align from C to D
Dakota
dakota at gmail.com
Mon Jan 13 11:36:45 UTC 2025
```c
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L)
# include <stdalign.h>
#endif
#if defined(_MSC_VER)
/* do not use alignment for older visual studio versions */
# if _MSC_VER < 1913 /* Visual Studio 2017 version 15.6 */
# define CGLM_ALL_UNALIGNED
# define CGLM_ALIGN(X) /* no alignment */
# else
# define CGLM_ALIGN(X) __declspec(align(X))
# endif
#else
# define CGLM_ALIGN(X) __attribute((aligned(X)))
#endif
#ifndef CGLM_ALL_UNALIGNED
# define CGLM_ALIGN_IF(X) CGLM_ALIGN(X)
#else
# define CGLM_ALIGN_IF(X) /* no alignment */
#endif
#ifdef __AVX__
# define CGLM_ALIGN_MAT CGLM_ALIGN(32)
#else
# define CGLM_ALIGN_MAT CGLM_ALIGN(16)
#endif
typedef CGLM_ALIGN_IF(16) float vec4[4];
typedef CGLM_ALIGN_IF(16) vec2 mat2[2];
typedef CGLM_ALIGN_MAT vec4 mat4[4];
```
I want tranlate this into d without importC, what is the best way
to do it?
More information about the Digitalmars-d-learn
mailing list