Fix broken build on MSVC due to size_t being considered equivalent to u64 in _Generic associations

This commit is contained in:
martinfouilleul 2023-09-11 18:09:47 +02:00
parent 3e2f550b68
commit ab4abd28d7
1 changed files with 12 additions and 5 deletions

View File

@ -108,12 +108,19 @@ inline T oc_cube(T a)
#else
//NOTE(martin): this macros helps generate variants of a generic 'template' for all arithmetic types.
// the def parameter must be a macro that takes a type, and optional arguments
#if OC_COMPILER_CL
#define oc_tga_variants(def, ...) \
def(u8, ##__VA_ARGS__) def(i8, ##__VA_ARGS__) def(u16, ##__VA_ARGS__) def(i16, ##__VA_ARGS__) \
def(u32, ##__VA_ARGS__) def(i32, ##__VA_ARGS__) def(u64, ##__VA_ARGS__) def(i64, ##__VA_ARGS__) \
def(f32, ##__VA_ARGS__) def(f64, ##__VA_ARGS__)
#else
#define oc_tga_variants(def, ...) \
def(u8, ##__VA_ARGS__) def(i8, ##__VA_ARGS__) def(u16, ##__VA_ARGS__) def(i16, ##__VA_ARGS__) \
def(u32, ##__VA_ARGS__) def(i32, ##__VA_ARGS__) def(u64, ##__VA_ARGS__) def(i64, ##__VA_ARGS__) \
def(size_t, ##__VA_ARGS__) \
def(f32, ##__VA_ARGS__) def(f64, ##__VA_ARGS__)
#endif
// This macro generates one _Generic association between a type and its variant
#define oc_tga_association(type, name) , type : OC_CAT3(name, _, type)