summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2006-10-26 07:47:41 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2006-10-26 07:47:41 +0000
commit5b0884f621446aab4bed8bcd9da3a2850aaeee7e (patch)
treeb28309489bf6773fa90896a334f8a8199b2616e5
parent34e9eaca4f3e3b70502c7b372d0a8b8e18353133 (diff)
downloadATCD-5b0884f621446aab4bed8bcd9da3a2850aaeee7e.tar.gz
-rw-r--r--ACE/ace/Truncate.h46
1 files changed, 23 insertions, 23 deletions
diff --git a/ACE/ace/Truncate.h b/ACE/ace/Truncate.h
index d434811f426..e1aa152478c 100644
--- a/ACE/ace/Truncate.h
+++ b/ACE/ace/Truncate.h
@@ -289,7 +289,7 @@ namespace ACE_Utils
struct Fast_Comparator
{
ACE_STATIC_CONSTANT (
- bool,
+ bool,
USE_LEFT = ((sizeof (LEFT) > sizeof (RIGHT)
&& (Sign_Check<LEFT>::is_signed == 1
|| Sign_Check<RIGHT>::is_signed == 0))
@@ -412,7 +412,7 @@ namespace ACE_Utils
/// the value is larger than the maximum of value of type @c TO.
TO operator() (FROM val)
{
- return
+ return
(comparator::greater_than (val, ACE_Numeric_Limits<TO>::max ())
? ACE_Numeric_Limits<TO>::max ()
: static_cast<TO> (val));
@@ -491,17 +491,6 @@ namespace ACE_Utils
template<typename FROM, typename TO> struct Truncator;
- // Partial specialization for the case where the types are the same.
- // No truncation is necessary.
-// template<typename T>
-// struct Truncator<T, T>
-// {
-// T operator() (T val)
-// {
-// return val;
-// }
-// };
-
//----------------------------------------------------------
// sizeof(FROM) > sizeof(TO)
//----------------------------------------------------------
@@ -511,7 +500,7 @@ namespace ACE_Utils
{
ACE_INT8 operator() (ACE_INT32 val)
{
- return
+ return
(val > ACE_Numeric_Limits<ACE_INT8>::max ()
? ACE_Numeric_Limits<ACE_INT8>::max ()
: static_cast<ACE_INT8> (val));
@@ -523,7 +512,7 @@ namespace ACE_Utils
{
ACE_UINT8 operator() (ACE_UINT32 val)
{
- return
+ return
(val > static_cast<ACE_UINT32> (ACE_Numeric_Limits<ACE_UINT8>::max ())
? ACE_Numeric_Limits<ACE_UINT8>::max ()
: static_cast<ACE_UINT8> (val));
@@ -535,7 +524,7 @@ namespace ACE_Utils
{
ACE_UINT8 operator() (ACE_INT32 val)
{
- return
+ return
(val > static_cast<ACE_INT32> (ACE_Numeric_Limits<ACE_UINT8>::max ())
? ACE_Numeric_Limits<ACE_UINT8>::max ()
: static_cast<ACE_UINT8> (val));
@@ -547,7 +536,7 @@ namespace ACE_Utils
{
ACE_INT8 operator() (ACE_UINT32 val)
{
- return
+ return
(val > static_cast<ACE_UINT32> (ACE_Numeric_Limits<ACE_INT8>::max ())
? ACE_Numeric_Limits<ACE_INT8>::max ()
: static_cast<ACE_INT8> (val));
@@ -559,7 +548,7 @@ namespace ACE_Utils
{
ACE_INT32 operator() (ACE_INT64 val)
{
- return
+ return
(val > ACE_Numeric_Limits<ACE_INT32>::max ()
? ACE_Numeric_Limits<ACE_INT32>::max ()
: static_cast<ACE_INT32> (val));
@@ -571,7 +560,7 @@ namespace ACE_Utils
{
ACE_UINT32 operator() (ACE_INT64 val)
{
- return
+ return
(val > static_cast<ACE_INT64> (ACE_Numeric_Limits<ACE_UINT32>::max ())
? ACE_Numeric_Limits<ACE_UINT32>::max ()
: static_cast<ACE_UINT32> (val));
@@ -583,7 +572,7 @@ namespace ACE_Utils
{
ACE_UINT32 operator() (ACE_UINT64 val)
{
- return
+ return
(val > static_cast<ACE_UINT64> (ACE_Numeric_Limits<ACE_UINT32>::max ())
? ACE_Numeric_Limits<ACE_UINT32>::max ()
: static_cast<ACE_UINT32> (val));
@@ -595,7 +584,7 @@ namespace ACE_Utils
{
ACE_INT32 operator() (ACE_UINT64 val)
{
- return
+ return
(val > static_cast<ACE_UINT64> (ACE_Numeric_Limits<ACE_INT32>::max ())
? ACE_Numeric_Limits<ACE_INT32>::max ()
: static_cast<ACE_INT32> (val));
@@ -620,7 +609,7 @@ namespace ACE_Utils
{
ACE_INT32 operator() (ACE_UINT32 val)
{
- return
+ return
(val > static_cast<ACE_UINT32> (ACE_Numeric_Limits<ACE_INT32>::max ())
? ACE_Numeric_Limits<ACE_INT32>::max ()
: static_cast<ACE_INT32> (val));
@@ -641,7 +630,7 @@ namespace ACE_Utils
{
ACE_INT64 operator() (ACE_UINT64 val)
{
- return
+ return
(val > static_cast<ACE_UINT64> (ACE_Numeric_Limits<ACE_INT64>::max ())
? ACE_Numeric_Limits<ACE_INT64>::max ()
: static_cast<ACE_INT64> (val));
@@ -724,6 +713,17 @@ namespace ACE_Utils
}
};
+ // Partial specialization for the case where the types are the same.
+ // No truncation is necessary.
+ template<typename T>
+ struct ACE_Export Truncator<T, T>
+ {
+ T operator() (T val)
+ {
+ return val;
+ }
+ };
+
// -------------------------------------
template<typename TO, typename FROM>
inline TO Truncate (FROM val)