[simd] Add HB_SIMD_VERIFY

This commit is contained in:
Behdad Esfahbod 2019-12-08 22:10:07 -06:00
parent 6bba9d876a
commit 343da74ec6
1 changed files with 24 additions and 0 deletions

View File

@ -350,6 +350,30 @@ struct hb_sorted_array_t :
hb_enable_if (hb_is_same (hb_decay<U>, OT::RangeRecord))>
bool bsearch_impl (hb_codepoint_t x, unsigned *pos, hb_priority<1>) const
{
#ifdef HB_SIMD_VERIFY
unsigned p0;
bool f0 = hb_bsearch_impl (&p0,
x,
this->arrayZ,
this->length,
sizeof (Type),
_hb_cmp_method<hb_codepoint_t, Type>);
unsigned p1;
bool f1 = hb_simd_ksearch_glyphid_range (&p1,
x,
this->arrayZ,
this->length,
sizeof (Type));
if (f0 != f1 || p0 != p1)
{
fprintf (stderr, "FAILED: Searching for %d; expected %d @ %d; got %d @ %d\n",
x, f0, p0, f1, p1);
for (unsigned i = 0; i < this->length; i++)
printf ("Range %d: %d..%d\n", i,
(unsigned) this->arrayZ[i].first,
(unsigned) this->arrayZ[i].last);
}
#endif
return hb_simd_ksearch_glyphid_range (pos,
x,
this->arrayZ,