提交 88a399ac 编写于 作者: B Behdad Esfahbod

Optimize IntType comparison to avoid branches for 16bit numbers

上级 37de2d53
......@@ -621,7 +621,14 @@ struct IntType
inline bool operator != (const IntType<Type,Size> &o) const { return v != o.v; }
static inline int cmp (const IntType<Type,Size> *a, const IntType<Type,Size> *b) { return b->cmp (*a); }
inline int cmp (IntType<Type,Size> va) const { Type a = va; return cmp (va); }
inline int cmp (Type a) const { Type b = v; return a < b ? -1 : a == b ? 0 : +1; }
inline int cmp (Type a) const
{
Type b = v;
if (sizeof (Type) < sizeof (int))
return (int) a - (int) b;
else
return a < b ? -1 : a == b ? 0 : +1;
}
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册