14static inline int fcmp(
double a,
double b) {
25static inline int imax(
int a,
int b) {
return a > b ? a : b; }
28static inline int imin(
int a,
int b) {
return a < b ? a : b; }
45 return memcmp(&a, &b,
sizeof(a)) == 0;
73 assert(original >= 0);
83 return (
int)(original *
scale);
105static inline void argb2rgba(
size_t width,
size_t height,
unsigned char *
data) {
106 assert(
data !=
NULL || (width == 0 && height == 0));
109 enum { Ba = 0, Ga = 1, Ra = 2, Aa = 3 };
110 enum { Rb = 0, Gb = 1, Bb = 2, Ab = 3 };
112 for (
size_t y = 0; y < height; ++y) {
113 for (
size_t x = 0; x < width; ++x) {
114 const unsigned char red =
data[Ra];
115 const unsigned char blue =
data[Ba];
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