1
0
Fork 0
forked from len0rd/rockbox

Slightly more typesafe ALIGN_DOWN/UP macros.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30004 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2011-06-14 14:21:43 +00:00
parent 50be1a8c4c
commit d43e8ea5a2

View file

@ -110,7 +110,7 @@ int get_cpu_boost_counter(void);
#define ALIGN_UP_P2(n, p2) ALIGN_DOWN_P2((n) + P2_M1(p2),p2) #define ALIGN_UP_P2(n, p2) ALIGN_DOWN_P2((n) + P2_M1(p2),p2)
/* align up or down to nearest integer multiple of a */ /* align up or down to nearest integer multiple of a */
#define ALIGN_DOWN(n, a) ((n)/(a)*(a)) #define ALIGN_DOWN(n, a) ((typeof(n))((typeof(a))(n)/(a)*(a)))
#define ALIGN_UP(n, a) ALIGN_DOWN((n)+((a)-1),a) #define ALIGN_UP(n, a) ALIGN_DOWN((n)+((a)-1),a)
/* align start and end of buffer to nearest integer multiple of a */ /* align start and end of buffer to nearest integer multiple of a */