All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amd/display: Remove use of division operator for long longs
@ 2018-05-24 14:40 sunpeng.li-5C7GfCeVMHo
       [not found] ` <1527172812-19164-1-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: sunpeng.li-5C7GfCeVMHo @ 2018-05-24 14:40 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: alexdeucher-Re5JQEeQqe8AvxtiuMwx3w, David Francis,
	Dmytro.Laktyushkin-5C7GfCeVMHo, harry.wentland-5C7GfCeVMHo

From: David Francis <David.Francis@amd.com>

In fixed31_32.h, in dc_fixpt_shl,'/' was used for division of one long
long int by another long long int.  As there is no inbuilt long long
int division function in c, gcc inserted its own.  However, gcc does not
link the library that contains this function.  To avoid this, use
bitwise operators instead of /

Signed-off-by: David Francis <David.Francis@amd.com>
Reviewed-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
---
 drivers/gpu/drm/amd/display/include/fixed31_32.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/include/fixed31_32.h b/drivers/gpu/drm/amd/display/include/fixed31_32.h
index 76f64e9..bb0d4eb 100644
--- a/drivers/gpu/drm/amd/display/include/fixed31_32.h
+++ b/drivers/gpu/drm/amd/display/include/fixed31_32.h
@@ -209,7 +209,7 @@ static inline struct fixed31_32 dc_fixpt_clamp(
 static inline struct fixed31_32 dc_fixpt_shl(struct fixed31_32 arg, unsigned char shift)
 {
 	ASSERT(((arg.value >= 0) && (arg.value <= LLONG_MAX >> shift)) ||
-		((arg.value < 0) && (arg.value >= (LLONG_MIN / (1LL << shift)))));
+		((arg.value < 0) && (arg.value >= ~(LLONG_MAX >> shift))));
 
 	arg.value = arg.value << shift;
 
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/amd/display: Remove use of division operator for long longs
       [not found] ` <1527172812-19164-1-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org>
@ 2018-05-24 14:43   ` Alex Deucher
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2018-05-24 14:43 UTC (permalink / raw)
  To: Leo (Sunpeng) Li
  Cc: David Francis, Dmytro Laktyushkin, Wentland, Harry, amd-gfx list

On Thu, May 24, 2018 at 10:40 AM,  <sunpeng.li@amd.com> wrote:
> From: David Francis <David.Francis@amd.com>
>
> In fixed31_32.h, in dc_fixpt_shl,'/' was used for division of one long
> long int by another long long int.  As there is no inbuilt long long
> int division function in c, gcc inserted its own.  However, gcc does not
> link the library that contains this function.  To avoid this, use
> bitwise operators instead of /
>
> Signed-off-by: David Francis <David.Francis@amd.com>
> Reviewed-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/amd/display/include/fixed31_32.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/include/fixed31_32.h b/drivers/gpu/drm/amd/display/include/fixed31_32.h
> index 76f64e9..bb0d4eb 100644
> --- a/drivers/gpu/drm/amd/display/include/fixed31_32.h
> +++ b/drivers/gpu/drm/amd/display/include/fixed31_32.h
> @@ -209,7 +209,7 @@ static inline struct fixed31_32 dc_fixpt_clamp(
>  static inline struct fixed31_32 dc_fixpt_shl(struct fixed31_32 arg, unsigned char shift)
>  {
>         ASSERT(((arg.value >= 0) && (arg.value <= LLONG_MAX >> shift)) ||
> -               ((arg.value < 0) && (arg.value >= (LLONG_MIN / (1LL << shift)))));
> +               ((arg.value < 0) && (arg.value >= ~(LLONG_MAX >> shift))));
>
>         arg.value = arg.value << shift;
>
> --
> 2.7.4
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-24 14:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-24 14:40 [PATCH] drm/amd/display: Remove use of division operator for long longs sunpeng.li-5C7GfCeVMHo
     [not found] ` <1527172812-19164-1-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org>
2018-05-24 14:43   ` Alex Deucher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.