mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-13 14:34:33 +02:00
Refactor VP8LColorCacheContains()
Return key/index if the query is found, and -1 otherwise. The benefit of this is to save a hashing computation. Change-Id: Iff056be330f5fb8204011259ac814f7677dd40fe
This commit is contained in:
@ -53,10 +53,11 @@ static WEBP_INLINE int VP8LColorCacheGetIndex(const VP8LColorCache* const cc,
|
||||
return (kHashMul * argb) >> cc->hash_shift_;
|
||||
}
|
||||
|
||||
// Return the key if cc contains argb, and -1 otherwise.
|
||||
static WEBP_INLINE int VP8LColorCacheContains(const VP8LColorCache* const cc,
|
||||
uint32_t argb) {
|
||||
const uint32_t key = (kHashMul * argb) >> cc->hash_shift_;
|
||||
return (cc->colors_[key] == argb);
|
||||
return (cc->colors_[key] == argb) ? (int)key : -1;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user