diff options
| author | Paul Eggert | 2019-06-30 08:08:02 -0700 |
|---|---|---|
| committer | Paul Eggert | 2019-06-30 08:11:01 -0700 |
| commit | fd9ea1e511ba3b1f5d338c3fc8faf0b85df951f9 (patch) | |
| tree | 567d2aec09124f330a34063acd02111a2b16e834 /src/image.c | |
| parent | 6d529b658a9bdfde219fce53b9d37623272fa3e8 (diff) | |
| download | emacs-fd9ea1e511ba3b1f5d338c3fc8faf0b85df951f9.tar.gz emacs-fd9ea1e511ba3b1f5d338c3fc8faf0b85df951f9.zip | |
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
Diffstat (limited to 'src/image.c')
| -rw-r--r-- | src/image.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/src/image.c b/src/image.c index 7f7e9fc160c..1ee74bb8b72 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -2079,16 +2079,6 @@ compute_image_rotation (struct image *img, double *rotation) | |||
| 2079 | *rotation = XFIXNUM (reduced_angle); | 2079 | *rotation = XFIXNUM (reduced_angle); |
| 2080 | } | 2080 | } |
| 2081 | 2081 | ||
| 2082 | static double | ||
| 2083 | divide_double (double a, double b) | ||
| 2084 | { | ||
| 2085 | #if !IEEE_FLOATING_POINT | ||
| 2086 | if (b == 0) | ||
| 2087 | return DBL_MAX; | ||
| 2088 | #endif | ||
| 2089 | return a / b; | ||
| 2090 | } | ||
| 2091 | |||
| 2092 | static void | 2082 | static void |
| 2093 | image_set_transform (struct frame *f, struct image *img) | 2083 | image_set_transform (struct frame *f, struct image *img) |
| 2094 | { | 2084 | { |
| @@ -2116,11 +2106,15 @@ image_set_transform (struct frame *f, struct image *img) | |||
| 2116 | matrix3x3 matrix | 2106 | matrix3x3 matrix |
| 2117 | = { | 2107 | = { |
| 2118 | # if defined USE_CAIRO || defined HAVE_XRENDER | 2108 | # if defined USE_CAIRO || defined HAVE_XRENDER |
| 2119 | [0][0] = divide_double (img->width, width), | 2109 | [0][0] = (!IEEE_FLOATING_POINT && width == 0 ? DBL_MAX |
| 2120 | [1][1] = divide_double (img->height, height), | 2110 | : img->width / (double) width), |
| 2111 | [1][1] = (!IEEE_FLOATING_POINT && height == 0 ? DBL_MAX | ||
| 2112 | : img->height / (double) height), | ||
| 2121 | # elif defined HAVE_NTGUI || defined HAVE_NS | 2113 | # elif defined HAVE_NTGUI || defined HAVE_NS |
| 2122 | [0][0] = divide_double (width, img->width), | 2114 | [0][0] = (!IEEE_FLOATING_POINT && img->width == 0 ? DBL_MAX |
| 2123 | [1][1] = divide_double (height, img->height), | 2115 | : width / (double) img->width), |
| 2116 | [1][1] = (!IEEE_FLOATING_POINT && img->height == 0 ? DBL_MAX | ||
| 2117 | : height / (double) img->height), | ||
| 2124 | # else | 2118 | # else |
| 2125 | [0][0] = 1, [1][1] = 1, | 2119 | [0][0] = 1, [1][1] = 1, |
| 2126 | # endif | 2120 | # endif |
| @@ -2161,7 +2155,7 @@ image_set_transform (struct frame *f, struct image *img) | |||
| 2161 | rotate_flag = 1; | 2155 | rotate_flag = 1; |
| 2162 | } | 2156 | } |
| 2163 | 2157 | ||
| 2164 | if (rotate_flag > 0) | 2158 | if (0 < rotate_flag) |
| 2165 | { | 2159 | { |
| 2166 | # if defined USE_CAIRO || defined HAVE_XRENDER | 2160 | # if defined USE_CAIRO || defined HAVE_XRENDER |
| 2167 | /* 1. Translate so (0, 0) is in the center of the image. */ | 2161 | /* 1. Translate so (0, 0) is in the center of the image. */ |