Skip to content

Commit 30d978d

Browse files
[[ iOS-64bit ]] Revert the change to MCMin/MCMax, and add the needed casts
1 parent 6e6d334 commit 30d978d

2 files changed

Lines changed: 15 additions & 14 deletions

File tree

libcore/include/core.h

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -517,17 +517,18 @@ bool MCBinaryDecoderReadCFString(MCBinaryDecoder *decoder, CFStringRef& r_value)
517517

518518
////////////////////////////////////////////////////////////////////////////////
519519

520-
#if (__cplusplus >= 201103L)
521-
template <class T, class U>
522-
inline auto MCMin(T a, U b) -> decltype(a+b) { return a < b ? a : b; }
523-
template <class T, class U>
524-
inline auto MCMax(T a, U b) -> decltype(a+b) { return a < b ? b : a; }
525-
#else
526-
template <class T, class U>
527-
inline T MCMin(T a, U b) { return a < b ? a : b; }
528-
template <class T, class U, class R = T>
529-
inline T MCMax(T a, U b) { return a < b ? b : a; }
530-
#endif
520+
inline uint32_t MCMin(uint32_t a, uint32_t b) { return a < b ? a : b; }
521+
inline uint32_t MCMax(uint32_t a, uint32_t b) { return a > b ? a : b; }
522+
inline int32_t MCMin(int32_t a, int32_t b) { return a < b ? a : b; }
523+
inline int32_t MCMax(int32_t a, int32_t b) { return a > b ? a : b; }
524+
inline int64_t MCMin(int64_t a, int64_t b) { return a < b ? a : b; }
525+
inline int64_t MCMax(int64_t a, int64_t b) { return a > b ? a : b; }
526+
inline int64_t MCMin(uint64_t a, uint64_t b) { return a < b ? a : b; }
527+
inline int64_t MCMax(uint64_t a, uint64_t b) { return a > b ? a : b; }
528+
inline double MCMin(double a, double b) { return a < b ? a : b; }
529+
inline double MCMax(double a, double b) { return a > b ? a : b; }
530+
inline float MCMin(float a, float b) { return a < b ? a : b; }
531+
inline float MCMax(float a, float b) { return a > b ? a : b; }
531532

532533
inline uint32_t MCAbs(int32_t a) { return a < 0 ? -a : a; }
533534
inline uint64_t MCAbs(int64_t a) { return a < 0 ? -a : a; }

libgraphics/src/coretext.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,16 +173,16 @@ void MCGContextDrawPlatformText(MCGContextRef self, const unichar_t *p_text, uin
173173
{
174174
CGRect t_image_bounds;
175175
t_image_bounds = CTLineGetImageBounds(t_line, s_measure_context);
176-
t_width = MCMax(t_width, t_image_bounds . size . width) + t_font_bounds . size . width;
176+
t_width = MCMax(t_width, (MCGFloat)t_image_bounds . size . width) + t_font_bounds . size . width;
177177
}
178178

179179
// MW-2014-06-25: [[ Bug 12690 ]] I suspect ascent/descent will always be less than font
180180
// bounds calcs, but let's just err on the side of caution.
181181
MCGRectangle t_float_text_bounds;
182182
t_float_text_bounds . origin . x = 0;
183-
t_float_text_bounds . origin . y = MCMin(-t_font_bounds_top, -t_ascent);
183+
t_float_text_bounds . origin . y = MCMin((MCGFloat)-t_font_bounds_top, -t_ascent);
184184
t_float_text_bounds . size . width = t_width;
185-
t_float_text_bounds . size . height = MCMax(t_font_bounds_top - t_font_bounds_bottom, t_ascent + t_descent);
185+
t_float_text_bounds . size . height = MCMax((MCGFloat)(t_font_bounds_top - t_font_bounds_bottom), t_ascent + t_descent);
186186

187187
t_transform = MCGContextGetDeviceTransform(self);
188188
t_device_location = MCGPointApplyAffineTransform(p_location, t_transform);

0 commit comments

Comments
 (0)