Loading include/utils/JenkinsHash.h +4 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,9 @@ * should still be quite good. **/ #ifndef ANDROID_JENKINS_HASH_H #define ANDROID_JENKINS_HASH_H #include <utils/TypeHelpers.h> namespace android { Loading @@ -42,3 +45,4 @@ uint32_t JenkinsHashMixShorts(uint32_t hash, const uint16_t* shorts, size_t size } #endif // ANDROID_JENKINS_HASH_H include/utils/LruCache.h +24 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,9 @@ public: void setOnEntryRemovedListener(OnEntryRemoved<TKey, TValue>* listener); size_t size() const; const TKey& keyAt(size_t index) const; const TValue& valueAt(size_t index) const; void removeAt(size_t index); const TValue& get(const TKey& key); bool put(const TKey& key, const TValue& value); bool remove(const TKey& key); Loading Loading @@ -85,6 +88,27 @@ size_t LruCache<TKey, TValue>::size() const { return mTable->size(); } template <typename TKey, typename TValue> const TKey& LruCache<TKey, TValue>::keyAt(size_t index) const { const Entry& entry = mTable->entryAt(index); return entry.key; } template <typename TKey, typename TValue> const TValue& LruCache<TKey, TValue>::valueAt(size_t index) const { const Entry& entry = mTable->entryAt(index); return entry.value; } template <typename TKey, typename TValue> void LruCache<TKey, TValue>::removeAt(size_t index) { if (index < 0) { return; } mTable->removeAt(index); } template <typename TKey, typename TValue> const TValue& LruCache<TKey, TValue>::get(const TKey& key) { hash_t hash = hash_type(key); Loading Loading
include/utils/JenkinsHash.h +4 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,9 @@ * should still be quite good. **/ #ifndef ANDROID_JENKINS_HASH_H #define ANDROID_JENKINS_HASH_H #include <utils/TypeHelpers.h> namespace android { Loading @@ -42,3 +45,4 @@ uint32_t JenkinsHashMixShorts(uint32_t hash, const uint16_t* shorts, size_t size } #endif // ANDROID_JENKINS_HASH_H
include/utils/LruCache.h +24 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,9 @@ public: void setOnEntryRemovedListener(OnEntryRemoved<TKey, TValue>* listener); size_t size() const; const TKey& keyAt(size_t index) const; const TValue& valueAt(size_t index) const; void removeAt(size_t index); const TValue& get(const TKey& key); bool put(const TKey& key, const TValue& value); bool remove(const TKey& key); Loading Loading @@ -85,6 +88,27 @@ size_t LruCache<TKey, TValue>::size() const { return mTable->size(); } template <typename TKey, typename TValue> const TKey& LruCache<TKey, TValue>::keyAt(size_t index) const { const Entry& entry = mTable->entryAt(index); return entry.key; } template <typename TKey, typename TValue> const TValue& LruCache<TKey, TValue>::valueAt(size_t index) const { const Entry& entry = mTable->entryAt(index); return entry.value; } template <typename TKey, typename TValue> void LruCache<TKey, TValue>::removeAt(size_t index) { if (index < 0) { return; } mTable->removeAt(index); } template <typename TKey, typename TValue> const TValue& LruCache<TKey, TValue>::get(const TKey& key) { hash_t hash = hash_type(key); Loading