diff mbox

[i-g-t,5/8] lib/igt_draw: Use igt_bitops

Message ID 20170209021828.22813-6-michel.thierry@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michel Thierry Feb. 9, 2017, 2:18 a.m. UTC
Moving bit operations to the new header file.

Signed-off-by: Michel Thierry <michel.thierry@intel.com>
---
 lib/igt_bitops.h | 1 +
 lib/igt_draw.c   | 3 +--
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Joonas Lahtinen Feb. 9, 2017, 7:38 a.m. UTC | #1
On ke, 2017-02-08 at 18:18 -0800, Michel Thierry wrote:
> Moving bit operations to the new header file.
> 
> Signed-off-by: Michel Thierry <michel.thierry@intel.com>

> #define BIT_GET(num, bit)      (((num) >> (bit)) & 1)

Maybe name the args (val, nr) for consistency with BIT()

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
diff mbox

Patch

diff --git a/lib/igt_bitops.h b/lib/igt_bitops.h
index 11e0d8b5..331946f6 100644
--- a/lib/igt_bitops.h
+++ b/lib/igt_bitops.h
@@ -31,6 +31,7 @@ 
 #define BIT_ULL(nr)		(1ULL << (nr))
 #define BITS_PER_CHAR		8
 #define BITS_PER_LONG		(sizeof(long)*BITS_PER_CHAR)
+#define BIT_GET(num, bit)	(((num) >> (bit)) & 1)
 
 static inline unsigned long __bit__(unsigned long nr)
 {
diff --git a/lib/igt_draw.c b/lib/igt_draw.c
index 2b321715..3f81161c 100644
--- a/lib/igt_draw.c
+++ b/lib/igt_draw.c
@@ -28,6 +28,7 @@ 
 
 #include "drmtest.h"
 #include "intel_chipset.h"
+#include "igt_bitops.h"
 #include "igt_core.h"
 #include "igt_fb.h"
 #include "ioctl_wrappers.h"
@@ -96,8 +97,6 @@  const char *igt_draw_get_method_name(enum igt_draw_method method)
 	}
 }
 
-#define BIT_GET(num, bit) ((num >> bit) & 1)
-
 static int swizzle_addr(int addr, int swizzle)
 {
 	int bit6;