Skip to content
Snippets Groups Projects
Commit 2b593e13 authored by Maíra Canal's avatar Maíra Canal
Browse files

drm/amd/display: Move bw_fixed macros to header file


The macros defined at bw_fixed are important mathematical definitions,
specifying masks to get the fractional part and the maximum and minimum
values of I64. In order to enable unit tests for bw_fixed, it is
relevant to have access to those macros. This commit moves the macros to
the header file, making it accessible to future unit tests.

Signed-off-by: default avatarMaíra Canal <maira.canal@usp.br>
parent 57674166
1 merge request!2drm/amd/display: Introduce KUnit to DML
...@@ -26,19 +26,7 @@ ...@@ -26,19 +26,7 @@
#include "bw_fixed.h" #include "bw_fixed.h"
#define MIN_I64 \ uint64_t abs_i64(int64_t arg)
(int64_t)(-(1LL << 63))
#define MAX_I64 \
(int64_t)((1ULL << 63) - 1)
#define FRACTIONAL_PART_MASK \
((1ULL << BW_FIXED_BITS_PER_FRACTIONAL_PART) - 1)
#define GET_FRACTIONAL_PART(x) \
(FRACTIONAL_PART_MASK & (x))
static uint64_t abs_i64(int64_t arg)
{ {
if (arg >= 0) if (arg >= 0)
return (uint64_t)(arg); return (uint64_t)(arg);
......
...@@ -33,12 +33,26 @@ struct bw_fixed { ...@@ -33,12 +33,26 @@ struct bw_fixed {
int64_t value; int64_t value;
}; };
#define MIN_I64 \
(int64_t)(-(1ULL << 63))
#define MAX_I64 \
(int64_t)((1ULL << 63) - 1)
#define FRACTIONAL_PART_MASK \
((1ULL << BW_FIXED_BITS_PER_FRACTIONAL_PART) - 1)
#define GET_FRACTIONAL_PART(x) \
(FRACTIONAL_PART_MASK & (x))
#define BW_FIXED_MIN_I32 \ #define BW_FIXED_MIN_I32 \
(int64_t)(-(1LL << (63 - BW_FIXED_BITS_PER_FRACTIONAL_PART))) (int64_t)(-(1LL << (63 - BW_FIXED_BITS_PER_FRACTIONAL_PART)))
#define BW_FIXED_MAX_I32 \ #define BW_FIXED_MAX_I32 \
(int64_t)((1ULL << (63 - BW_FIXED_BITS_PER_FRACTIONAL_PART)) - 1) (int64_t)((1ULL << (63 - BW_FIXED_BITS_PER_FRACTIONAL_PART)) - 1)
uint64_t abs_i64(int64_t arg);
static inline struct bw_fixed bw_min2(const struct bw_fixed arg1, static inline struct bw_fixed bw_min2(const struct bw_fixed arg1,
const struct bw_fixed arg2) const struct bw_fixed arg2)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment