[dasher: 27/28] Avoid max() and define myint abs(myint) to avoid gcc's
- From: Patrick Welche <pwelche src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dasher: 27/28] Avoid max() and define myint abs(myint) to avoid gcc's
- Date: Tue, 22 Nov 2011 17:04:56 +0000 (UTC)
commit 1faa979ef3aa64a621f4a8f789766cc83b7214e0
Author: Patrick Welche <prlw1 cam ac uk>
Date: Tue Nov 22 16:22:39 2011 +0000
Avoid max() and define myint abs(myint) to avoid gcc's
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
abs(_Tp __x)
{ return __builtin_fabs(__x); }
Src/DasherCore/GameModule.cpp | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/Src/DasherCore/GameModule.cpp b/Src/DasherCore/GameModule.cpp
index 739c0cc..2093eb8 100644
--- a/Src/DasherCore/GameModule.cpp
+++ b/Src/DasherCore/GameModule.cpp
@@ -85,8 +85,8 @@ void CGameModule::HandleEvent(const CEditEvent *evt) {
void CGameModule::HandleEvent(CGameNodeDrawEvent *gmd) {
//game nodes form a single chain, i.e. are strictly nested.
// we want the coordinates of the smallest (innermost) one about which we are told
- m_y1 = max(m_y1, gmd->m_y1);
- m_y2 = min(m_y2, gmd->m_y2);
+ if (gmd->m_y1 > m_y1) m_y1 = gmd->m_y1;
+ if (gmd->m_y2 < m_y1) m_y2 = gmd->m_y2;
}
void CGameModule::HandleEvent(CDasherView *pView) {
@@ -113,6 +113,8 @@ void CGameModule::StartWriting(unsigned long lTime) {
}
}
+static myint abs(myint x) { return (x>0)?x:-x; }
+
void CGameModule::DecorateView(unsigned long lTime, CDasherView *pView, CDasherModel *pModel) {
if (m_dSentenceStartNats == numeric_limits<double>::max())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]