From 516971b13658dea244f458c702828ccd62635b4a Mon Sep 17 00:00:00 2001 From: Vikas Arora Date: Wed, 2 Jul 2014 20:39:47 +0000 Subject: [PATCH] lossless: Remove unaligned read warning (typecast uint32 pointer to uint64). The proposed change is little (0.05%) slower but avoids uint32 to uint64 pointer conversion. Change-Id: I6b8828077ea1324fabd04bfa7e7439e324776250 --- src/enc/backward_references.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/enc/backward_references.c b/src/enc/backward_references.c index 84922b04..a3c30aa0 100644 --- a/src/enc/backward_references.c +++ b/src/enc/backward_references.c @@ -265,10 +265,8 @@ static int HashChainFindCopy(const VP8LHashChain* const p, uint64_t val; uint32_t curr_length; uint32_t distance; - const uint64_t* const ptr1 = - (const uint64_t*)(argb + pos + best_length - 1); - const uint64_t* const ptr2 = - (const uint64_t*)(argb_start + best_length - 1); + const uint32_t* const ptr1 = (argb + pos + best_length - 1); + const uint32_t* const ptr2 = (argb_start + best_length - 1); if (iter_pos < 0) { if (iter_pos < iter_limit || best_val >= 0xff0000) { @@ -279,7 +277,7 @@ static int HashChainFindCopy(const VP8LHashChain* const p, // Before 'expensive' linear match, check if the two arrays match at the // current best length index and also for the succeeding elements. - if (*ptr1 != *ptr2) continue; + if (ptr1[0] != ptr2[0] || ptr1[1] != ptr2[1]) continue; curr_length = FindMatchLength(argb + pos, argb_start, max_len); if (curr_length < best_length) continue;