printf(" advan: %3d reser: %3d\n", glyph->advance, glyph->reserved);
}
-#define MAX2(x, y) ((x) > (y) ? (x) : (y))
-#define MAX3(x, y, z) (MAX2(MAX2((x), (y)), (z)))
-
void calcAlpha(ImBuf *ibuf)
{
int i;
#endif
/* min/max */
+#if defined(__GNUC__) || defined(__clang__)
+
+#define MIN2(x, y) ({ \
+ typeof(x) x_ = (x); \
+ typeof(y) y_ = (y); \
+ ((x_) < (y_) ? (x_) : (y_)); })
+
+#define MAX2(x, y) ({ \
+ typeof(x) x_ = (x); \
+ typeof(y) y_ = (y); \
+ ((x_) > (y_) ? (x_) : (y_)); })
+
+#else
#define MIN2(x, y) ((x) < (y) ? (x) : (y))
+#define MAX2(x, y) ((x) > (y) ? (x) : (y))
+#endif
+
#define MIN3(x, y, z) (MIN2(MIN2((x), (y)), (z)))
#define MIN4(x, y, z, a) (MIN2(MIN2((x), (y)), MIN2((z), (a))))
-#define MAX2(x, y) ((x) > (y) ? (x) : (y))
#define MAX3(x, y, z) (MAX2(MAX2((x), (y)), (z)))
#define MAX4(x, y, z, a) (MAX2(MAX2((x), (y)), MAX2((z), (a))))
{
Heap *heap = (Heap *)MEM_callocN(sizeof(Heap), __func__);
/* ensure we have at least one so we can keep doubling it */
- heap->bufsize = MAX2(1, tot_reserve);
+ heap->bufsize = MAX2(1u, tot_reserve);
heap->tree = (HeapNode **)MEM_mallocN(heap->bufsize * sizeof(HeapNode *), "BLIHeapTree");
heap->arena = BLI_memarena_new(MEM_SIZE_OPTIMAL(1 << 16), "heap arena");
}
if (flag & BLI_MEMPOOL_ALLOW_ITER) {
- pool->esize = MAX2(esize, (int)sizeof(BLI_freenode));
+ pool->esize = MAX2(esize, (unsigned int)sizeof(BLI_freenode));
}
else {
pool->esize = esize;
/* Duplicated code since we can't link in blenkernel or blenlib */
-#ifndef MIN2
-#define MIN2(x, y) ((x) < (y) ? (x) : (y))
-#define MAX2(x, y) ((x) > (y) ? (x) : (y))
-#endif
-
/* pedantic check for '.', do this since its a hassle for translators */
#ifndef NDEBUG
# define DESCR_CHECK(description, id1, id2) \