[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master fd9ea1e: Remove divide_double
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] master fd9ea1e: Remove divide_double |
Date: |
Sun, 30 Jun 2019 11:11:05 -0400 (EDT) |
branch: master
commit fd9ea1e511ba3b1f5d338c3fc8faf0b85df951f9
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
Remove divide_double
* src/image.c (divide_double): Remove. All uses replaced
with inline equivalents. Suggested by Eli Zaretskii in:
https://lists.gnu.org/r/emacs-devel/2019-06/msg01067.html
---
src/image.c | 24 +++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/src/image.c b/src/image.c
index 7f7e9fc..1ee74bb 100644
--- a/src/image.c
+++ b/src/image.c
@@ -2079,16 +2079,6 @@ compute_image_rotation (struct image *img, double
*rotation)
*rotation = XFIXNUM (reduced_angle);
}
-static double
-divide_double (double a, double b)
-{
-#if !IEEE_FLOATING_POINT
- if (b == 0)
- return DBL_MAX;
-#endif
- return a / b;
-}
-
static void
image_set_transform (struct frame *f, struct image *img)
{
@@ -2116,11 +2106,15 @@ image_set_transform (struct frame *f, struct image *img)
matrix3x3 matrix
= {
# if defined USE_CAIRO || defined HAVE_XRENDER
- [0][0] = divide_double (img->width, width),
- [1][1] = divide_double (img->height, height),
+ [0][0] = (!IEEE_FLOATING_POINT && width == 0 ? DBL_MAX
+ : img->width / (double) width),
+ [1][1] = (!IEEE_FLOATING_POINT && height == 0 ? DBL_MAX
+ : img->height / (double) height),
# elif defined HAVE_NTGUI || defined HAVE_NS
- [0][0] = divide_double (width, img->width),
- [1][1] = divide_double (height, img->height),
+ [0][0] = (!IEEE_FLOATING_POINT && img->width == 0 ? DBL_MAX
+ : width / (double) img->width),
+ [1][1] = (!IEEE_FLOATING_POINT && img->height == 0 ? DBL_MAX
+ : height / (double) img->height),
# else
[0][0] = 1, [1][1] = 1,
# endif
@@ -2161,7 +2155,7 @@ image_set_transform (struct frame *f, struct image *img)
rotate_flag = 1;
}
- if (rotate_flag > 0)
+ if (0 < rotate_flag)
{
# if defined USE_CAIRO || defined HAVE_XRENDER
/* 1. Translate so (0, 0) is in the center of the image. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master fd9ea1e: Remove divide_double,
Paul Eggert <=