Author: hselasky
Date: Wed Mar 13 19:04:06 2019
New Revision: 345102
URL: https://svnweb.freebsd.org/changeset/base/345102

Log:
  Implement IS_ALIGNED() and DIV_ROUND_DOWN_ULL() function macros in the 
LinuxKPI.
  
  Submitted by:         Johannes Lundberg <johal...@gmail.com>
  MFC after:            1 week
  Sponsored by:         Limelight Networks
  Sponsored by:         Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/kernel.h

Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/kernel.h      Wed Mar 13 
19:01:55 2019        (r345101)
+++ head/sys/compat/linuxkpi/common/include/linux/kernel.h      Wed Mar 13 
19:04:06 2019        (r345102)
@@ -130,9 +130,11 @@
 #define        ALIGN(x, y)             roundup2((x), (y))
 #undef PTR_ALIGN
 #define        PTR_ALIGN(p, a)         ((__typeof(p))ALIGN((uintptr_t)(p), 
(a)))
+#define        IS_ALIGNED(x, a)        (((x) & ((__typeof(x))(a) - 1)) == 0)
 #define        DIV_ROUND_UP(x, n)      howmany(x, n)
 #define        __KERNEL_DIV_ROUND_UP(x, n)     howmany(x, n)
 #define        DIV_ROUND_UP_ULL(x, n)  DIV_ROUND_UP((unsigned long long)(x), 
(n))
+#define        DIV_ROUND_DOWN_ULL(x, n) (((unsigned long long)(x) / (n)) * (n))
 #define        FIELD_SIZEOF(t, f)      sizeof(((t *)0)->f)
 
 #define        printk(...)             printf(__VA_ARGS__)
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to