You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
347 B
14 lines
347 B
#pragma once
|
|
|
|
#define min(x, y) ((x < y) ? (x) : (y))
|
|
#define max(x, y) ((x > y) ? (x) : (y))
|
|
|
|
/* Human-readable sizes */
|
|
#define KIB 1024
|
|
#define MIB (1024 * KIB)
|
|
#define GIB (1024 * GIB)
|
|
|
|
/* Rounding */
|
|
#define IS_ROUND(x, k) (!((x) & ((k) - 1)))
|
|
#define ROUND_DOWN(x, k) ((x) & ~((k) - 1))
|
|
#define ROUND_UP(x, k) (((x) + (k) - 1) & ~((k) - 1))
|
|
|