#ifndef TileIndexHash_h
#define TileIndexHash_h
#include "TileIndex.h"
#include <limits>
#include <wtf/HashMap.h>
using BlackBerry::WebKit::TileIndex;
namespace WTF {
template<> struct IntHash<TileIndex> {
static unsigned hash(const TileIndex& key) { return pairIntHash(key.i(), key.j()); }
static bool equal(const TileIndex& a, const TileIndex& b) { return a == b; }
static const bool safeToCompareToEmptyOrDeleted = true;
};
template<> struct DefaultHash<TileIndex> {
typedef IntHash<TileIndex> Hash;
};
template<> struct HashTraits<TileIndex> : GenericHashTraits<TileIndex> {
static const bool emptyValueIsZero = false;
static const bool needsDestruction = false;
static TileIndex emptyValue() { return TileIndex(); }
static void constructDeletedValue(TileIndex& slot)
{
new (&slot) TileIndex(std::numeric_limits<unsigned>::max() - 1, std::numeric_limits<unsigned>::max() - 1);
}
static bool isDeletedValue(const TileIndex& value)
{
return value.i() == (std::numeric_limits<unsigned>::max() - 1) && value.j() == (std::numeric_limits<unsigned>::max() - 1);
}
};
}
#endif // TileIndexHash_h