15static inline int fcmp(
double a,
double b) {
26static inline int imax(
int a,
int b) {
return a > b ? a : b; }
29static inline int imin(
int a,
int b) {
return a < b ? a : b; }
46 return memcmp(&a, &b,
sizeof(a)) == 0;
74 assert(original >= 0);
84 return (
int)(original *
scale);
106static inline void argb2rgba(
size_t width,
size_t height,
unsigned char *
data) {
107 assert(
data !=
NULL || (width == 0 && height == 0));
110 enum { Ba = 0, Ga = 1, Ra = 2, Aa = 3 };
111 enum { Rb = 0, Gb = 1, Bb = 2, Ab = 3 };
113 for (
size_t y = 0; y < height; ++y) {
114 for (
size_t x = 0; x < width; ++x) {
115 const unsigned char red =
data[Ra];
116 const unsigned char blue =
data[Ba];
134 (void)((a) == (b)); \
139 char tmp_[sizeof(*(a))]; \
140 memcpy(tmp_, (a), sizeof(*(a))); \
142 memcpy((b), tmp_, sizeof(*(b))); \
154static inline float d2f(
double v) {
static pointf scale(double c, pointf p)
static int scale_clamp(int original, double scale)
scale up or down a non-negative integer, clamping to [0, INT_MAX]
static bool is_exactly_zero(double v)
is a value precisely 0.0?
static bool is_exactly_equal(double a, double b)
are two values precisely the same?
static int imin(int a, int b)
minimum of two integers
static int fcmp(double a, double b)
comparator for doubles
static void argb2rgba(size_t width, size_t height, unsigned char *data)
static int imax(int a, int b)
maximum of two integers
static float d2f(double v)