Conditional compilation for hash functions.

This commit is contained in:
John Wellbelove 2017-06-12 23:18:16 +01:00
parent 64c8ec3c38
commit 2732f7f68f
4 changed files with 12 additions and 4 deletions

View File

@ -36,7 +36,7 @@ SOFTWARE.
#include "hash.h"
#if defined(ETL_COMPILER_MICROSOFT)
#undef min
#undef min
#endif
namespace etl
@ -185,19 +185,21 @@ namespace etl
//*************************************************************************
/// Hash function.
//*************************************************************************
#if ETL_8BIT_SUPPORT
template <>
struct hash<etl::istring>
{
size_t operator()(const etl::istring& text) const
{
return etl::__private_hash__::generic_hash<>(reinterpret_cast<const uint8_t*>(&text[0]),
reinterpret_cast<const uint8_t*>(&text[text.size()]));
return etl::__private_hash__::generic_hash<>(reinterpret_cast<const uint8_t*>(&text[0]),
reinterpret_cast<const uint8_t*>(&text[text.size()]));
}
};
#endif
}
#if defined(ETL_COMPILER_MICROSOFT)
#define min(a,b) (((a) < (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
#endif

View File

@ -185,6 +185,7 @@ namespace etl
//*************************************************************************
/// Hash function.
//*************************************************************************
#if ETL_8BIT_SUPPORT
template <>
struct hash<etl::iu16string>
{
@ -194,6 +195,7 @@ namespace etl
reinterpret_cast<const uint8_t*>(&text[text.size()]));
}
};
#endif
}
#if defined(ETL_COMPILER_MICROSOFT)

View File

@ -185,6 +185,7 @@ namespace etl
//*************************************************************************
/// Hash function.
//*************************************************************************
#if ETL_8BIT_SUPPORT
template <>
struct hash<etl::iu32string>
{
@ -194,6 +195,7 @@ namespace etl
reinterpret_cast<const uint8_t*>(&text[text.size()]));
}
};
#endif
}
#if defined(ETL_COMPILER_MICROSOFT)

View File

@ -186,6 +186,7 @@ namespace etl
//*************************************************************************
/// Hash function.
//*************************************************************************
#if ETL_8BIT_SUPPORT
template <>
struct hash<etl::iwstring>
{
@ -195,6 +196,7 @@ namespace etl
reinterpret_cast<const uint8_t*>(&text[text.size()]));
}
};
#endif
}
#if defined(ETL_COMPILER_MICROSOFT)