[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] [PATCH][2/5] Add ALIGN macro.



This macro is needed by ALLOC_CACHE_ALIGN_BUFFER macro that is added
in a next patch.

Commit message:

Add ALIGN macro to mint/kcompiler.c.
Contributed by David Galvez.
diff -r 0c0a26a764a2 -r 076b9e62def5 sys/mint/kcompiler.h
--- a/sys/mint/kcompiler.h	Mon Nov 17 11:19:29 2014 +0100
+++ b/sys/mint/kcompiler.h	Mon Nov 17 11:31:35 2014 +0100
@@ -119,4 +119,7 @@
 # define ROUNDUP2(a,b)		(((a) + (b) - 1) & ~((b) - 1))		/* if y is power of two */
 # define ROUNDDOWN2(a,b)	((a) & (~((b) - 1)))				/* if y is power of two */
 
+# define ALIGN(x,a)		__ALIGN_MASK((x),(typeof(x))(a) - 1)
+# define __ALIGN_MASK(x,mask)	(((x) + (mask)) & ~(mask))
+
 # endif /* _mint_misc_h */
diff -r 0c0a26a764a2 -r 076b9e62def5 sys/usb/src.km/ucd/ethernat/isp116x-hcd.c
--- a/sys/usb/src.km/ucd/ethernat/isp116x-hcd.c	Mon Nov 17 11:19:29 2014 +0100
+++ b/sys/usb/src.km/ucd/ethernat/isp116x-hcd.c	Mon Nov 17 11:31:35 2014 +0100
@@ -192,7 +192,6 @@
 
 /* ------------------------------------------------------------------------- */
 
-#define ALIGN(x,a)	(((x)+(a)-1UL)&~((a)-1UL))
 #define min1_t(type,x,y)	\
 	({ type __x = (x); type __y = (y); __x < __y ? __x : __y; })
 
diff -r 0c0a26a764a2 -r 076b9e62def5 sys/usb/src.km/ucd/netusbee/isp116x-hcd.c
--- a/sys/usb/src.km/ucd/netusbee/isp116x-hcd.c	Mon Nov 17 11:19:29 2014 +0100
+++ b/sys/usb/src.km/ucd/netusbee/isp116x-hcd.c	Mon Nov 17 11:31:35 2014 +0100
@@ -190,7 +190,6 @@
 
 /* ------------------------------------------------------------------------- */
 
-#define ALIGN(x,a)	(((x)+(a)-1UL)&~((a)-1UL))
 #define min1_t(type,x,y)	\
 	({ type __x = (x); type __y = (y); __x < __y ? __x : __y; })