[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master ecd20b1 04/10: Improve Max() and Min() implem
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master ecd20b1 04/10: Improve Max() and Min() implementations |
Date: |
Mon, 1 Mar 2021 09:39:22 -0500 (EST) |
branch: master
commit ecd20b107ca7a462a43ffdab4fcbd0c5ae445390
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Improve Max() and Min() implementations
libstdc++ thinks it important enough to write std::{max,min}() this
way, and lmi shouldn't disagree without any clear reason.
* tools/pete-2.1.1/PETE/Tools/PeteOps.in: Modified.
* tools/pete-2.1.1/PETE/OperatorTags.h: Automatically regenerated.
* tools/pete-2.1.1/PETE/Tools/PeteOps.cpp: Automatically regenerated.
---
tools/pete-2.1.1/PETE/OperatorTags.h | 4 ++--
tools/pete-2.1.1/PETE/Tools/PeteOps.cpp | 4 ++--
tools/pete-2.1.1/PETE/Tools/PeteOps.in | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/pete-2.1.1/PETE/OperatorTags.h
b/tools/pete-2.1.1/PETE/OperatorTags.h
index ca2b276..799eca0 100644
--- a/tools/pete-2.1.1/PETE/OperatorTags.h
+++ b/tools/pete-2.1.1/PETE/OperatorTags.h
@@ -442,7 +442,7 @@ struct FnMax
inline typename BinaryReturn<T1, T2, FnMax >::Type_t
operator()(const T1 &a, const T2 &b) const
{
- return ((a < b) ? b : a);
+ if(a < b) return b; else return a;
}
};
@@ -453,7 +453,7 @@ struct FnMin
inline typename BinaryReturn<T1, T2, FnMin >::Type_t
operator()(const T1 &a, const T2 &b) const
{
- return ((a < b) ? a : b);
+ if(b < a) return b; else return a;
}
};
diff --git a/tools/pete-2.1.1/PETE/Tools/PeteOps.cpp
b/tools/pete-2.1.1/PETE/Tools/PeteOps.cpp
index 9ba895c..eb50092 100644
--- a/tools/pete-2.1.1/PETE/Tools/PeteOps.cpp
+++ b/tools/pete-2.1.1/PETE/Tools/PeteOps.cpp
@@ -196,12 +196,12 @@ void peteOps(map<string,vector<OperatorDescriptor> > &m)
m["binaryOps"].push_back(
OperatorDescriptor("FnMax",
"Max",
- "return ((a < b) ? b : a);",
+ "if(a < b) return b; else return a;",
""));
m["binaryOps"].push_back(
OperatorDescriptor("FnMin",
"Min",
- "return ((a < b) ? a : b);",
+ "if(b < a) return b; else return a;",
""));
m["binaryStdOps"].push_back(
OperatorDescriptor("ApplyBinary",
diff --git a/tools/pete-2.1.1/PETE/Tools/PeteOps.in
b/tools/pete-2.1.1/PETE/Tools/PeteOps.in
index b6d556f..bc52a4c 100644
--- a/tools/pete-2.1.1/PETE/Tools/PeteOps.in
+++ b/tools/pete-2.1.1/PETE/Tools/PeteOps.in
@@ -150,11 +150,11 @@ binaryOps
-----
TAG = "FnMax"
FUNCTION = "Max"
- EXPR = "return ((a < b) ? b : a);"
+ EXPR = "if(a < b) return b; else return a;"
-----
TAG = "FnMin"
FUNCTION = "Min"
- EXPR = "return ((a < b) ? a : b);"
+ EXPR = "if(b < a) return b; else return a;"
binaryBoolOps
-----
- [lmi-commits] [lmi] master updated (e5b0ac2 -> 8ffc9d2), Greg Chicares, 2021/03/01
- [lmi-commits] [lmi] master e3c0e51 02/10: Improve PETE unit test, Greg Chicares, 2021/03/01
- [lmi-commits] [lmi] master 56f9792 06/10: Turn a member into a local variable, Greg Chicares, 2021/03/01
- [lmi-commits] [lmi] master c695cd7 01/10: Add PETE vector tests, Greg Chicares, 2021/03/01
- [lmi-commits] [lmi] master 4d37390 03/10: Mention lmi's improved unit test, Greg Chicares, 2021/03/01
- [lmi-commits] [lmi] master 53186b7 05/10: Reorder independent blocks, Greg Chicares, 2021/03/01
- [lmi-commits] [lmi] master aab3295 07/10: Rename a local variable, Greg Chicares, 2021/03/01
- [lmi-commits] [lmi] master 3ef5a8e 08/10: Draw attention to an improvement deferred, Greg Chicares, 2021/03/01
- [lmi-commits] [lmi] master ecd20b1 04/10: Improve Max() and Min() implementations,
Greg Chicares <=
- [lmi-commits] [lmi] master 8ffc9d2 10/10: Calculate 7702 'ig' more carefully, Greg Chicares, 2021/03/01
- [lmi-commits] [lmi] master f135b80 09/10: Assert correspondence between DB_GuarInt and DB_NaarDiscount, Greg Chicares, 2021/03/01