[algs] Remove passthru declaration
Let compiler figure it out.
This commit is contained in:
parent
ca0b7afee9
commit
881ad720fe
@ -988,32 +988,24 @@ hb_codepoint_parse (const char *s, unsigned int len, int base, hb_codepoint_t *o
|
|||||||
|
|
||||||
struct hb_bitwise_and
|
struct hb_bitwise_and
|
||||||
{ HB_PARTIALIZE(2);
|
{ HB_PARTIALIZE(2);
|
||||||
static constexpr bool passthru_left = false;
|
|
||||||
static constexpr bool passthru_right = false;
|
|
||||||
template <typename T> constexpr auto
|
template <typename T> constexpr auto
|
||||||
operator () (const T &a, const T &b) const HB_AUTO_RETURN (a & b)
|
operator () (const T &a, const T &b) const HB_AUTO_RETURN (a & b)
|
||||||
}
|
}
|
||||||
HB_FUNCOBJ (hb_bitwise_and);
|
HB_FUNCOBJ (hb_bitwise_and);
|
||||||
struct hb_bitwise_or
|
struct hb_bitwise_or
|
||||||
{ HB_PARTIALIZE(2);
|
{ HB_PARTIALIZE(2);
|
||||||
static constexpr bool passthru_left = true;
|
|
||||||
static constexpr bool passthru_right = true;
|
|
||||||
template <typename T> constexpr auto
|
template <typename T> constexpr auto
|
||||||
operator () (const T &a, const T &b) const HB_AUTO_RETURN (a | b)
|
operator () (const T &a, const T &b) const HB_AUTO_RETURN (a | b)
|
||||||
}
|
}
|
||||||
HB_FUNCOBJ (hb_bitwise_or);
|
HB_FUNCOBJ (hb_bitwise_or);
|
||||||
struct hb_bitwise_xor
|
struct hb_bitwise_xor
|
||||||
{ HB_PARTIALIZE(2);
|
{ HB_PARTIALIZE(2);
|
||||||
static constexpr bool passthru_left = true;
|
|
||||||
static constexpr bool passthru_right = true;
|
|
||||||
template <typename T> constexpr auto
|
template <typename T> constexpr auto
|
||||||
operator () (const T &a, const T &b) const HB_AUTO_RETURN (a ^ b)
|
operator () (const T &a, const T &b) const HB_AUTO_RETURN (a ^ b)
|
||||||
}
|
}
|
||||||
HB_FUNCOBJ (hb_bitwise_xor);
|
HB_FUNCOBJ (hb_bitwise_xor);
|
||||||
struct hb_bitwise_sub
|
struct hb_bitwise_sub
|
||||||
{ HB_PARTIALIZE(2);
|
{ HB_PARTIALIZE(2);
|
||||||
static constexpr bool passthru_left = true;
|
|
||||||
static constexpr bool passthru_right = false;
|
|
||||||
template <typename T> constexpr auto
|
template <typename T> constexpr auto
|
||||||
operator () (const T &a, const T &b) const HB_AUTO_RETURN (a & ~b)
|
operator () (const T &a, const T &b) const HB_AUTO_RETURN (a & ~b)
|
||||||
}
|
}
|
||||||
|
@ -566,6 +566,9 @@ struct hb_set_t
|
|||||||
template <typename Op>
|
template <typename Op>
|
||||||
void process (const Op& op, const hb_set_t *other)
|
void process (const Op& op, const hb_set_t *other)
|
||||||
{
|
{
|
||||||
|
const bool passthru_left = op (1, 0);
|
||||||
|
const bool passthru_right = op (0, 1);
|
||||||
|
|
||||||
if (unlikely (!successful)) return;
|
if (unlikely (!successful)) return;
|
||||||
|
|
||||||
dirty ();
|
dirty ();
|
||||||
@ -581,13 +584,13 @@ struct hb_set_t
|
|||||||
// Pre-allocate the workspace that compact() will need so we can bail on allocation failure
|
// Pre-allocate the workspace that compact() will need so we can bail on allocation failure
|
||||||
// before attempting to rewrite the page map.
|
// before attempting to rewrite the page map.
|
||||||
hb_vector_t<unsigned> compact_workspace;
|
hb_vector_t<unsigned> compact_workspace;
|
||||||
if (!Op::passthru_left && unlikely (!allocate_compact_workspace (compact_workspace))) return;
|
if (!passthru_left && unlikely (!allocate_compact_workspace (compact_workspace))) return;
|
||||||
|
|
||||||
for (; a < na && b < nb; )
|
for (; a < na && b < nb; )
|
||||||
{
|
{
|
||||||
if (page_map[a].major == other->page_map[b].major)
|
if (page_map[a].major == other->page_map[b].major)
|
||||||
{
|
{
|
||||||
if (!Op::passthru_left)
|
if (!passthru_left)
|
||||||
{
|
{
|
||||||
// Move page_map entries that we're keeping from the left side set
|
// Move page_map entries that we're keeping from the left side set
|
||||||
// to the front of the page_map vector. This isn't necessary if
|
// to the front of the page_map vector. This isn't necessary if
|
||||||
@ -604,23 +607,23 @@ struct hb_set_t
|
|||||||
}
|
}
|
||||||
else if (page_map[a].major < other->page_map[b].major)
|
else if (page_map[a].major < other->page_map[b].major)
|
||||||
{
|
{
|
||||||
if (Op::passthru_left)
|
if (passthru_left)
|
||||||
count++;
|
count++;
|
||||||
a++;
|
a++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Op::passthru_right)
|
if (passthru_right)
|
||||||
count++;
|
count++;
|
||||||
b++;
|
b++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Op::passthru_left)
|
if (passthru_left)
|
||||||
count += na - a;
|
count += na - a;
|
||||||
if (Op::passthru_right)
|
if (passthru_right)
|
||||||
count += nb - b;
|
count += nb - b;
|
||||||
|
|
||||||
if (!Op::passthru_left)
|
if (!passthru_left)
|
||||||
{
|
{
|
||||||
na = write_index;
|
na = write_index;
|
||||||
next_page = write_index;
|
next_page = write_index;
|
||||||
@ -648,7 +651,7 @@ struct hb_set_t
|
|||||||
else if (page_map[a - 1].major > other->page_map[b - 1].major)
|
else if (page_map[a - 1].major > other->page_map[b - 1].major)
|
||||||
{
|
{
|
||||||
a--;
|
a--;
|
||||||
if (Op::passthru_left)
|
if (passthru_left)
|
||||||
{
|
{
|
||||||
count--;
|
count--;
|
||||||
page_map[count] = page_map[a];
|
page_map[count] = page_map[a];
|
||||||
@ -657,7 +660,7 @@ struct hb_set_t
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
b--;
|
b--;
|
||||||
if (Op::passthru_right)
|
if (passthru_right)
|
||||||
{
|
{
|
||||||
count--;
|
count--;
|
||||||
page_map[count].major = other->page_map[b].major;
|
page_map[count].major = other->page_map[b].major;
|
||||||
@ -666,14 +669,14 @@ struct hb_set_t
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Op::passthru_left)
|
if (passthru_left)
|
||||||
while (a)
|
while (a)
|
||||||
{
|
{
|
||||||
a--;
|
a--;
|
||||||
count--;
|
count--;
|
||||||
page_map[count] = page_map [a];
|
page_map[count] = page_map [a];
|
||||||
}
|
}
|
||||||
if (Op::passthru_right)
|
if (passthru_right)
|
||||||
while (b)
|
while (b)
|
||||||
{
|
{
|
||||||
b--;
|
b--;
|
||||||
|
Loading…
Reference in New Issue
Block a user