Index: kernel/generic/include/align.h
===================================================================
--- kernel/generic/include/align.h	(revision bec63799120b9ca58aeb87488126bc2768a57ee9)
+++ kernel/generic/include/align.h	(revision 096c0786530d26ecc60b3c63b61e396df267c704)
@@ -39,4 +39,9 @@
 #define KERN_ALIGN_H_
 
+#ifdef __ASSEMBLER__
+#define ALIGN_DOWN(s, a)  ((s) & ~((a) - 1))
+#define ALIGN_UP(s, a)    (((s) + ((a) - 1)) & ~((a) - 1))
+#else
+
 /** Align to the nearest lower address.
  *
@@ -44,5 +49,5 @@
  * @param a Size of alignment, must be a power of 2.
  */
-#define ALIGN_DOWN(s, a)  ((s) & ~((a) - 1))
+#define ALIGN_DOWN(s, a)  ((s) & ~((typeof(s))(a) - 1))
 
 /** Align to the nearest higher address.
@@ -51,5 +56,7 @@
  * @param a Size of alignment, must be a power of 2.
  */
-#define ALIGN_UP(s, a)  (((s) + ((a) - 1)) & ~((a) - 1))
+#define ALIGN_UP(s, a)  (((s) + ((a) - 1)) & ~((typeof(s))(a) - 1))
+
+#endif
 
 /** Check alignment.
Index: uspace/lib/c/include/align.h
===================================================================
--- uspace/lib/c/include/align.h	(revision bec63799120b9ca58aeb87488126bc2768a57ee9)
+++ uspace/lib/c/include/align.h	(revision 096c0786530d26ecc60b3c63b61e396df267c704)
@@ -41,5 +41,5 @@
  * @param a		Size of alignment, must be power of 2.
  */
-#define ALIGN_DOWN(s, a)	((s) & ~((a) - 1))
+#define ALIGN_DOWN(s, a)	((s) & ~((typeof(s))(a) - 1))
 
 /** Align to the nearest higher address which is a power of two.
@@ -48,5 +48,5 @@
  * @param a		Size of alignment, must be power of 2.
  */
-#define ALIGN_UP(s, a)		((long)((s) + ((a) - 1)) & ~((long) (a) - 1))
+#define ALIGN_UP(s, a)		((((s) + ((a) - 1)) & ~((typeof(s))(a) - 1)))
 
 /** Round up to the nearest higher boundary.
