On Fri, 22 Dec 2017 13:34:58 +0100, Chris Wilson <[email protected]> wrote:

Quoting Michal Wajdeczko (2017-12-22 12:25:54)
Zero and One are additional commonly used values that
can have its own definitions.

Signed-off-by: Michal Wajdeczko <[email protected]>
Cc: Chris Wilson <[email protected]>
Cc: Rodrigo Vivi <[email protected]>
Cc: Joonas Lahtinen <[email protected]>
---
 drivers/gpu/drm/i915/fixed16_16.h | 15 ++++++++++++---
 drivers/gpu/drm/i915/intel_pm.c   | 22 +++++++++++-----------
 2 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/i915/fixed16_16.h b/drivers/gpu/drm/i915/fixed16_16.h
index ec859c0..af23997 100644
--- a/drivers/gpu/drm/i915/fixed16_16.h
+++ b/drivers/gpu/drm/i915/fixed16_16.h
@@ -31,9 +31,18 @@
        u32 val;
 } fixed16_16_t;

-#define FP_16_16_MAX ({ \
-       fixed16_16_t fp; \
-       fp.val = UINT_MAX; \
+#define FIXED16_16_ZERO ({ \
+       fixed16_16_t fp = { .val = 0 }; \
+       fp; \
+})

#define TO_FIXED16_16(x) (fixed16_16_t){ .val = (x) }

Earlier I was thinking about __FIXED16_16_INITIALIZER(v)
but decided to not introduce it due potential abuse ;)

#define FIXED16_16_ZERO TO_FIXED16_16(0)
#define FIXED16_16_ONE TO_FIXED16_16(1)

Gotcha! It should be 1 << 16

#define FIXED16_16_MAX TO_FIXED16_16(U32_MAX)

?
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to