aligned for vectorization commor primitives, uint32_t cast for color comparison in batch collection
This commit is contained in:
17
src/util.h
17
src/util.h
@@ -70,6 +70,7 @@ bool strends(const char *str, const char *suffix);
|
||||
|
||||
/* 32-bit color data */
|
||||
typedef struct color {
|
||||
_Alignas(4)
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
@@ -85,14 +86,19 @@ typedef struct vec2 {
|
||||
|
||||
/* a point in some space (floating point) */
|
||||
typedef struct fvec2 {
|
||||
float x, y;
|
||||
_Alignas(8)
|
||||
float x;
|
||||
float y;
|
||||
} t_fvec2;
|
||||
|
||||
|
||||
/* a point in some three dimension space (floating point) */
|
||||
/* y goes up, x goes to the right */
|
||||
typedef struct fvec3 {
|
||||
float x, y, z;
|
||||
_Alignas(8)
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
} t_fvec3;
|
||||
|
||||
|
||||
@@ -111,8 +117,11 @@ typedef struct rect {
|
||||
|
||||
/* a rectangle with the origin at the upper left (floating point) */
|
||||
typedef struct frect {
|
||||
float x, y;
|
||||
float w, h;
|
||||
_Alignas(16)
|
||||
float x;
|
||||
float y;
|
||||
float w;
|
||||
float h;
|
||||
} t_frect;
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user