mirror of
https://github.com/ETLCPP/etl.git
synced 2026-11-09 14:49:53 +08:00
Conditional compilation for hash functions.
This commit is contained in:
parent
64c8ec3c38
commit
2732f7f68f
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user