From 17fc34a391b9e2cb9954fef3953d07f39d3df4b6 Mon Sep 17 00:00:00 2001 From: Alec Miller Date: Wed, 3 Mar 2021 16:09:30 -0800 Subject: [PATCH] bc7enc - fix code to not use anonymous structs. On VS, these cannot contain functions. --- libkram/bc7enc/bc7enc.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libkram/bc7enc/bc7enc.cpp b/libkram/bc7enc/bc7enc.cpp index 1a511d51..a8e32f15 100644 --- a/libkram/bc7enc/bc7enc.cpp +++ b/libkram/bc7enc/bc7enc.cpp @@ -33,11 +33,11 @@ static inline int32_t iabs32(int32_t v) { uint32_t msk = v >> 31; return (v ^ ms static inline void swapu(uint32_t* a, uint32_t* b) { uint32_t t = *a; *a = *b; *b = t; } //static inline void swapf(float* a, float* b) { float t = *a; *a = *b; *b = t; } -typedef struct { +struct color_quad_u8 { uint8_t r, g, b, a; inline const uint8_t& operator[](int index) const { return *(&r + index); } inline uint8_t& operator[](int index) { return *(&r + index); } -} color_quad_u8; +}; static inline color_quad_u8 *color_quad_u8_set_clamped(color_quad_u8 *pRes, int32_t r, int32_t g, int32_t b, int32_t a) { pRes->r = (uint8_t)clampi(r, 0, 255); pRes->g = (uint8_t)clampi(g, 0, 255); pRes->b = (uint8_t)clampi(b, 0, 255); pRes->a = (uint8_t)clampi(a, 0, 255); return pRes; } static inline color_quad_u8 *color_quad_u8_set(color_quad_u8 *pRes, int32_t r, int32_t g, int32_t b, int32_t a) { assert((uint32_t)(r | g | b | a) <= 255); pRes->r = (uint8_t)r; pRes->g = (uint8_t)g; pRes->b = (uint8_t)b; pRes->a = (uint8_t)a; return pRes; } @@ -60,11 +60,11 @@ static inline vec4F vec4F_mul(const vec4F *pLHS, float s) { vec4F res = *pLHS * static inline vec4F *vec4F_normalize_in_place(vec4F *pV) { *pV = normalize(*pV); return pV; } #else -typedef struct { +struct vec4F { float r, g, b, a; inline const float& operator[](int index) const { return *(&r + index); } inline float& operator[](int index) { return *(&r + index); } -} vec4F; +}; static inline vec4F *vec4F_set_scalar(vec4F *pV, float x) { pV->r = x; pV->g = x; pV->b = x; pV->a = x; return pV; } static inline vec4F *vec4F_set(vec4F *pV, float x, float y, float z, float w) { pV->r = x; pV->g = y; pV->b = z; pV->a = w; return pV; }