mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-22 07:21:06 +01:00
[cff-common] Optimize INDEX::operator[]
Previous try showed slowdown in benchmarks, suprisingly. Rewrite it keeping the function, hopefully allowing better optimization.
This commit is contained in:
1 parent
3aace2431b
commit
9033c7f99d
1 file changed
+4
-3
@@ -214,10 +214,11 @@ struct CFFIndex
|
||||
|
||||
unsigned int length_at (unsigned int index) const
|
||||
{
|
||||
if (unlikely ((offset_at (index + 1) < offset_at (index)) ||
|
||||
(offset_at (index + 1) > offset_at (count))))
|
||||
unsigned offset0 = offset_at (index);
|
||||
unsigned offset1 = offset_at (index + 1);
|
||||
if (unlikely (offset1 < offset0 || offset1 > offset_at (count)))
|
||||
return 0;
|
||||
return offset_at (index + 1) - offset_at (index);
|
||||
return offset1 - offset0;
|
||||
}
|
||||
|
||||
const unsigned char *data_base () const
|
||||
|
||||
Reference in new issue
Block a user