Merge pull request #5776 from harfbuzz/packtab-updates

Packtab updates
This commit is contained in:
Behdad Esfahbod authored and GitHub committed 2026-03-02 12:22:15 -07:00
commit 4c55f5166d
7 files changed
+57 -24

No files matched your search

+2
View File
@@ -100,10 +100,12 @@ static inline uint8_t _hb_arabic_pua_b4 (const uint8_t* a, unsigned i)
}
static inline uint16_t _hb_arabic_pua_simp_map (unsigned u)
{
/* packtab: [2^2,2^4,2^4,2^3] */
return u<65277u ? (uint16_t)(_hb_arabic_pua_u16[((_hb_arabic_pua_u8[31u+((_hb_arabic_pua_b4(_hb_arabic_pua_u8,((((13835058055282164225ULL>>((((((((u)>>3))>>4))>>4))<<1))&3))<<4)+((((((u)>>3))>>4))&15)))<<4)+((((u)>>3))&15)])<<3)+((u)&7)]) : 0;
}
static inline uint16_t _hb_arabic_pua_trad_map (unsigned u)
{
/* packtab: [2^4,2^4,2^4,2^2] */
return u<65277u ? (uint16_t)(_hb_arabic_pua_u16[317u+((_hb_arabic_pua_u8[197u+((_hb_arabic_pua_b4(_hb_arabic_pua_u8+159u,((_hb_arabic_pua_b4(_hb_arabic_pua_u8+127u,((((((u)>>2))>>4))>>4)))<<4)+((((((u)>>2))>>4))&15)))<<4)+((((u)>>2))&15)])<<2)+((u)&3)]) : 0;
}
+1
View File
@@ -77,6 +77,7 @@ static inline uint8_t _hb_arabic_joining_b4 (const uint8_t* a, unsigned i)
}
static inline uint8_t _hb_arabic_joining_joining_type (unsigned u)
{
/* packtab: [2^4,2^3,2^3,2^3] */
return u<125260u ? (uint8_t)(_hb_arabic_joining_b4(_hb_arabic_joining_u8+441u,((_hb_arabic_joining_u8[209u+_hb_arabic_joining_u8[123u+((_hb_arabic_joining_b4(_hb_arabic_joining_u8,((((((u)>>3))>>3))>>3)))<<3)+((((((u)>>3))>>3))&7)]+((((u)>>3))&7)])<<3)+((u)&7))) : 7;
}
+1
View File
@@ -228,6 +228,7 @@ static inline uint8_t _hb_indic_b4 (const uint8_t* a, unsigned i)
}
static inline uint8_t _hb_indic_get_categories_index (unsigned u)
{
/* packtab: [2^4,2^3,2^3,2^2,2^1] */
return u<71396u ? (uint8_t)(_hb_indic_u8[996u+_hb_indic_u8[488u+((_hb_indic_u8[186u+((_hb_indic_u8[70u+((_hb_indic_b4(_hb_indic_u8,((((((((u)>>1))>>2))>>3))>>3)))<<3)+((((((((u)>>1))>>2))>>3))&7)])<<3)+((((((u)>>1))>>2))&7)])<<2)+((((u)>>1))&3)]+((u)&1)]) : 37;
}
+4 -2
View File
@@ -379,7 +379,8 @@ static inline uint8_t hb_use_b4 (const uint8_t* a, unsigned i)
}
static inline uint8_t hb_use_get_category (unsigned u)
{
return u<921600 ? (uint8_t)(hb_use_u8[2953u+((hb_use_u8[625u+hb_use_u16[((hb_use_u8[113u+((hb_use_b4(hb_use_u8,((((((((u)>>1))>>3))>>3))>>5)))<<5)+((((((((u)>>1))>>3))>>3))&31)])<<3)+((((((u)>>1))>>3))&7)]+((((u)>>1))&7)])<<1)+((u)&1)]) : O;
/* packtab: [2^4,2^5,2^3,2^3,2^1] */
return u<921600u ? (uint8_t)(hb_use_u8[2953u+((hb_use_u8[625u+hb_use_u16[((hb_use_u8[113u+((hb_use_b4(hb_use_u8,((((((((u)>>1))>>3))>>3))>>5)))<<5)+((((((((u)>>1))>>3))>>3))&31)])<<3)+((((((u)>>1))>>3))&7)]+((((u)>>1))&7)])<<1)+((u)&1)]) : O;
}
@@ -660,7 +661,8 @@ static inline uint8_t hb_use_b4 (const uint8_t* a, unsigned i)
}
static inline uint8_t hb_use_get_category (unsigned u)
{
return u<921600 ? (uint8_t)(hb_use_u8[3273u+((hb_use_u8[945u+hb_use_u16[((hb_use_u8[369u+((hb_use_u8[113u+((hb_use_b4(hb_use_u8,((((((((((u)>>1))>>3))>>1))>>3))>>4)))<<4)+((((((((((u)>>1))>>3))>>1))>>3))&15)])<<3)+((((((((u)>>1))>>3))>>1))&7)])<<1)+((((((u)>>1))>>3))&1)]+((((u)>>1))&7)])<<1)+((u)&1)]) : O;
/* packtab: [2^4,2^4,2^3,2^1,2^3,2^1] */
return u<921600u ? (uint8_t)(hb_use_u8[3273u+((hb_use_u8[945u+hb_use_u16[((hb_use_u8[369u+((hb_use_u8[113u+((hb_use_b4(hb_use_u8,((((((((((u)>>1))>>3))>>1))>>3))>>4)))<<4)+((((((((((u)>>1))>>3))>>1))>>3))&15)])<<3)+((((((((u)>>1))>>3))>>1))&7)])<<1)+((((((u)>>1))>>3))&1)]+((((u)>>1))&7)])<<1)+((u)&1)]) : O;
}
+30 -15
View File
@@ -2703,11 +2703,13 @@ static const int16_t _hb_ucd_i16[196]=
static inline uint8_t _hb_ucd_gc (unsigned u)
{
return u<1114110 ? (uint8_t)(_hb_ucd_u8[7912u+((_hb_ucd_u8[2176u+_hb_ucd_u16[((_hb_ucd_u8[((((((u)>>1))>>3))>>5)])<<5)+((((((u)>>1))>>3))&31)]+((((u)>>1))&7)])<<1)+((u)&1)]) : 2;
/* packtab: [2^8,2^5,2^3,2^1] */
return u<1114110u ? (uint8_t)(_hb_ucd_u8[7912u+((_hb_ucd_u8[2176u+_hb_ucd_u16[((_hb_ucd_u8[((((((u)>>1))>>3))>>5)])<<5)+((((((u)>>1))>>3))&31)]+((((u)>>1))&7)])<<1)+((u)&1)]) : 2;
}
static inline uint8_t _hb_ucd_ccc (unsigned u)
{
return u<125259 ? (uint8_t)(_hb_ucd_u8[10370u+((_hb_ucd_u8[9270u+((_hb_ucd_u8[8539u+((_hb_ucd_u8[8294u+((((((u)>>2))>>3))>>4)])<<4)+((((((u)>>2))>>3))&15)])<<3)+((((u)>>2))&7)])<<2)+((u)&3)]) : 0;
/* packtab: [2^8,2^4,2^3,2^2] */
return u<125259u ? (uint8_t)(_hb_ucd_u8[10370u+((_hb_ucd_u8[9270u+((_hb_ucd_u8[8539u+((_hb_ucd_u8[8294u+((((((u)>>2))>>3))>>4)])<<4)+((((((u)>>2))>>3))&15)])<<3)+((((u)>>2))&7)])<<2)+((u)&3)]) : 0;
}
static inline uint8_t _hb_ucd_b4 (const uint8_t* a, unsigned i)
{
@@ -2715,15 +2717,18 @@ static inline uint8_t _hb_ucd_b4 (const uint8_t* a, unsigned i)
}
static inline int16_t _hb_ucd_bmg (unsigned u)
{
return u<65380 ? (int16_t)(_hb_ucd_i16[_hb_ucd_u8[11118u+((_hb_ucd_u8[11002u+((_hb_ucd_b4(_hb_ucd_u8+10874u,((((((u)>>2))>>3))>>3)))<<3)+((((((u)>>2))>>3))&7)])<<3)+((((u)>>2))&7)]+((u)&3)]) : 0;
/* packtab: [2^4,2^3,2^3,2^2] */
return u<65380u ? (int16_t)(_hb_ucd_i16[_hb_ucd_u8[11118u+((_hb_ucd_u8[11002u+((_hb_ucd_b4(_hb_ucd_u8+10874u,((((((u)>>2))>>3))>>3)))<<3)+((((((u)>>2))>>3))&7)])<<3)+((((u)>>2))&7)]+((u)&3)]) : 0;
}
static inline uint8_t _hb_ucd_sc (unsigned u)
{
return u<918000 ? (uint8_t)(_hb_ucd_u8[12639u+_hb_ucd_u16[3296u+((_hb_ucd_u8[11903u+((_hb_ucd_u8[11454u+((((((u)>>3))>>4))>>4)])<<4)+((((((u)>>3))>>4))&15)])<<4)+((((u)>>3))&15)]+((u)&7)]) : 2;
/* packtab: [2^8,2^4,2^4,2^3] */
return u<918000u ? (uint8_t)(_hb_ucd_u8[12639u+_hb_ucd_u16[3296u+((_hb_ucd_u8[11903u+((_hb_ucd_u8[11454u+((((((u)>>3))>>4))>>4)])<<4)+((((((u)>>3))>>4))&15)])<<4)+((((u)>>3))&15)]+((u)&7)]) : 2;
}
static inline uint16_t _hb_ucd_dm (unsigned u)
{
return u<195102 ? (uint16_t)(_hb_ucd_u16[7360u+((_hb_ucd_u8[18949u+((_hb_ucd_u8[18567u+((((u)>>4))>>5)])<<5)+((((u)>>4))&31)])<<4)+((u)&15)]) : 0;
/* packtab: [2^8,2^5,2^4] */
return u<195102u ? (uint16_t)(_hb_ucd_u16[7360u+((_hb_ucd_u8[18949u+((_hb_ucd_u8[18567u+((((u)>>4))>>5)])<<5)+((((u)>>4))&31)])<<4)+((u)&15)]) : 0;
}
@@ -4352,11 +4357,13 @@ static const int16_t _hb_ucd_i16[92]=
static inline uint8_t _hb_ucd_gc (unsigned u)
{
return u<1114110 ? (uint8_t)(_hb_ucd_u8[6536u+((_hb_ucd_u8[800u+_hb_ucd_u16[((_hb_ucd_u8[272u+((_hb_ucd_u8[((((((((u)>>1))>>3))>>4))>>4)])<<4)+((((((((u)>>1))>>3))>>4))&15)])<<4)+((((((u)>>1))>>3))&15)]+((((u)>>1))&7)])<<1)+((u)&1)]) : 2;
/* packtab: [2^8,2^4,2^4,2^3,2^1] */
return u<1114110u ? (uint8_t)(_hb_ucd_u8[6536u+((_hb_ucd_u8[800u+_hb_ucd_u16[((_hb_ucd_u8[272u+((_hb_ucd_u8[((((((((u)>>1))>>3))>>4))>>4)])<<4)+((((((((u)>>1))>>3))>>4))&15)])<<4)+((((((u)>>1))>>3))&15)]+((((u)>>1))&7)])<<1)+((u)&1)]) : 2;
}
static inline uint8_t _hb_ucd_ccc (unsigned u)
{
return u<125259 ? (uint8_t)(_hb_ucd_u8[8589u+((_hb_ucd_u8[8006u+((_hb_ucd_u8[7529u+((_hb_ucd_u8[7163u+((_hb_ucd_u8[6918u+((((((((u)>>2))>>2))>>2))>>3)])<<3)+((((((((u)>>2))>>2))>>2))&7)])<<2)+((((((u)>>2))>>2))&3)])<<2)+((((u)>>2))&3)])<<2)+((u)&3)]) : 0;
/* packtab: [2^8,2^3,2^2,2^2,2^2] */
return u<125259u ? (uint8_t)(_hb_ucd_u8[8589u+((_hb_ucd_u8[8006u+((_hb_ucd_u8[7529u+((_hb_ucd_u8[7163u+((_hb_ucd_u8[6918u+((((((((u)>>2))>>2))>>2))>>3)])<<3)+((((((((u)>>2))>>2))>>2))&7)])<<2)+((((((u)>>2))>>2))&3)])<<2)+((((u)>>2))&3)])<<2)+((u)&3)]) : 0;
}
static inline uint8_t _hb_ucd_b4 (const uint8_t* a, unsigned i)
{
@@ -4364,15 +4371,18 @@ static inline uint8_t _hb_ucd_b4 (const uint8_t* a, unsigned i)
}
static inline int16_t _hb_ucd_bmg (unsigned u)
{
return u<65380 ? (int16_t)(_hb_ucd_i16[_hb_ucd_u8[9480u+_hb_ucd_u8[9251u+_hb_ucd_u8[9157u+((_hb_ucd_b4(_hb_ucd_u8+9093u,((((((((u)>>1))>>2))>>3))>>3)))<<3)+((((((((u)>>1))>>2))>>3))&7)]+((((((u)>>1))>>2))&7)]+((((u)>>1))&3)]+((u)&1)]) : 0;
/* packtab: [2^4,2^3,2^3,2^2,2^1] */
return u<65380u ? (int16_t)(_hb_ucd_i16[_hb_ucd_u8[9480u+_hb_ucd_u8[9251u+_hb_ucd_u8[9157u+((_hb_ucd_b4(_hb_ucd_u8+9093u,((((((((u)>>1))>>2))>>3))>>3)))<<3)+((((((((u)>>1))>>2))>>3))&7)]+((((((u)>>1))>>2))&7)]+((((u)>>1))&3)]+((u)&1)]) : 0;
}
static inline uint8_t _hb_ucd_sc (unsigned u)
{
return u<918000 ? (uint8_t)(_hb_ucd_u8[10913u+_hb_ucd_u16[4624u+_hb_ucd_u16[2592u+((_hb_ucd_u8[10177u+((_hb_ucd_u8[9728u+((((((((u)>>2))>>2))>>3))>>4)])<<4)+((((((((u)>>2))>>2))>>3))&15)])<<3)+((((((u)>>2))>>2))&7)]+((((u)>>2))&3)]+((u)&3)]) : 2;
/* packtab: [2^8,2^4,2^3,2^2,2^2] */
return u<918000u ? (uint8_t)(_hb_ucd_u8[10913u+_hb_ucd_u16[4624u+_hb_ucd_u16[2592u+((_hb_ucd_u8[10177u+((_hb_ucd_u8[9728u+((((((((u)>>2))>>2))>>3))>>4)])<<4)+((((((((u)>>2))>>2))>>3))&15)])<<3)+((((((u)>>2))>>2))&7)]+((((u)>>2))&3)]+((u)&3)]) : 2;
}
static inline uint16_t _hb_ucd_dm (unsigned u)
{
return u<195102 ? (uint16_t)(_hb_ucd_u16[7453u+((_hb_ucd_u8[13867u+((_hb_ucd_u8[13485u+((((u)>>4))>>5)])<<5)+((((u)>>4))&31)])<<4)+((u)&15)]) : 0;
/* packtab: [2^8,2^5,2^4] */
return u<195102u ? (uint16_t)(_hb_ucd_u16[7453u+((_hb_ucd_u8[13867u+((_hb_ucd_u8[13485u+((((u)>>4))>>5)])<<5)+((((u)>>4))&31)])<<4)+((u)&15)]) : 0;
}
@@ -5587,11 +5597,13 @@ static const int16_t _hb_ucd_i16[92]=
static inline uint8_t _hb_ucd_gc (unsigned u)
{
return u<1114112 ? (uint8_t)(_hb_ucd_u8[5288u+((_hb_ucd_u8[1160u+_hb_ucd_u16[((_hb_ucd_u8[544u+((_hb_ucd_u8[((((((((u)>>1))>>3))>>3))>>4)])<<4)+((((((((u)>>1))>>3))>>3))&15)])<<3)+((((((u)>>1))>>3))&7)]+((((u)>>1))&7)])<<1)+((u)&1)]) : 2;
/* packtab: [2^8,2^4,2^3,2^3,2^1] */
return u<1114112u ? (uint8_t)(_hb_ucd_u8[5288u+((_hb_ucd_u8[1160u+_hb_ucd_u16[((_hb_ucd_u8[544u+((_hb_ucd_u8[((((((((u)>>1))>>3))>>3))>>4)])<<4)+((((((((u)>>1))>>3))>>3))&15)])<<3)+((((((u)>>1))>>3))&7)]+((((u)>>1))&7)])<<1)+((u)&1)]) : 2;
}
static inline uint8_t _hb_ucd_ccc (unsigned u)
{
return u<125259 ? (uint8_t)(_hb_ucd_u8[7307u+((_hb_ucd_u8[6724u+((_hb_ucd_u8[6247u+((_hb_ucd_u8[5881u+((_hb_ucd_u8[5636u+((((((((u)>>2))>>2))>>2))>>3)])<<3)+((((((((u)>>2))>>2))>>2))&7)])<<2)+((((((u)>>2))>>2))&3)])<<2)+((((u)>>2))&3)])<<2)+((u)&3)]) : 0;
/* packtab: [2^8,2^3,2^2,2^2,2^2] */
return u<125259u ? (uint8_t)(_hb_ucd_u8[7307u+((_hb_ucd_u8[6724u+((_hb_ucd_u8[6247u+((_hb_ucd_u8[5881u+((_hb_ucd_u8[5636u+((((((((u)>>2))>>2))>>2))>>3)])<<3)+((((((((u)>>2))>>2))>>2))&7)])<<2)+((((((u)>>2))>>2))&3)])<<2)+((((u)>>2))&3)])<<2)+((u)&3)]) : 0;
}
static inline uint8_t _hb_ucd_b4 (const uint8_t* a, unsigned i)
{
@@ -5599,15 +5611,18 @@ static inline uint8_t _hb_ucd_b4 (const uint8_t* a, unsigned i)
}
static inline int16_t _hb_ucd_bmg (unsigned u)
{
return u<65380 ? (int16_t)(_hb_ucd_i16[_hb_ucd_u8[8198u+_hb_ucd_u8[7969u+_hb_ucd_u8[7875u+((_hb_ucd_b4(_hb_ucd_u8+7811u,((((((((u)>>1))>>2))>>3))>>3)))<<3)+((((((((u)>>1))>>2))>>3))&7)]+((((((u)>>1))>>2))&7)]+((((u)>>1))&3)]+((u)&1)]) : 0;
/* packtab: [2^4,2^3,2^3,2^2,2^1] */
return u<65380u ? (int16_t)(_hb_ucd_i16[_hb_ucd_u8[8198u+_hb_ucd_u8[7969u+_hb_ucd_u8[7875u+((_hb_ucd_b4(_hb_ucd_u8+7811u,((((((((u)>>1))>>2))>>3))>>3)))<<3)+((((((((u)>>1))>>2))>>3))&7)]+((((((u)>>1))>>2))&7)]+((((u)>>1))&3)]+((u)&1)]) : 0;
}
static inline uint8_t _hb_ucd_sc (unsigned u)
{
return u<918016 ? (uint8_t)(_hb_ucd_u8[11623u+((_hb_ucd_u8[10615u+((_hb_ucd_u8[9119u+((_hb_ucd_u8[8675u+((_hb_ucd_u8[8475u+((_hb_ucd_b4(_hb_ucd_u8+8446u,((((((((((u)>>2))>>2))>>3))>>3))>>4)))<<4)+((((((((((u)>>2))>>2))>>3))>>3))&15)])<<3)+((((((((u)>>2))>>2))>>3))&7)])<<3)+((((((u)>>2))>>2))&7)])<<2)+((((u)>>2))&3)])<<2)+((u)&3)]) : 2;
/* packtab: [2^4,2^4,2^3,2^3,2^2,2^2] */
return u<918016u ? (uint8_t)(_hb_ucd_u8[11623u+((_hb_ucd_u8[10615u+((_hb_ucd_u8[9119u+((_hb_ucd_u8[8675u+((_hb_ucd_u8[8475u+((_hb_ucd_b4(_hb_ucd_u8+8446u,((((((((((u)>>2))>>2))>>3))>>3))>>4)))<<4)+((((((((((u)>>2))>>2))>>3))>>3))&15)])<<3)+((((((((u)>>2))>>2))>>3))&7)])<<3)+((((((u)>>2))>>2))&7)])<<2)+((((u)>>2))&3)])<<2)+((u)&3)]) : 2;
}
static inline uint16_t _hb_ucd_dm (unsigned u)
{
return u<195102 ? (uint16_t)(_hb_ucd_u16[1680u+((_hb_ucd_u8[13009u+((_hb_ucd_u8[12627u+((((u)>>4))>>5)])<<5)+((((u)>>4))&31)])<<4)+((u)&15)]) : 0;
/* packtab: [2^8,2^5,2^4] */
return u<195102u ? (uint16_t)(_hb_ucd_u16[1680u+((_hb_ucd_u8[13009u+((_hb_ucd_u8[12627u+((((u)>>4))>>5)])<<5)+((((u)>>4))&31)])<<4)+((u)&15)]) : 0;
}
+2 -1
View File
@@ -78,7 +78,8 @@ static inline uint8_t _hb_emoji_b1 (const uint8_t* a, unsigned i)
}
static inline uint8_t _hb_emoji_is_Extended_Pictographic (unsigned u)
{
return u<131070 ? (uint8_t)(_hb_emoji_b1(_hb_emoji_u8+224u,((_hb_emoji_u8[64u+((_hb_emoji_b4(_hb_emoji_u8,((((u)>>6))>>4)))<<4)+((((u)>>6))&15)])<<6)+((u)&63))) : 0;
/* packtab: [2^4,2^4,2^6] */
return u<131070u ? (uint8_t)(_hb_emoji_b1(_hb_emoji_u8+224u,((_hb_emoji_u8[64u+((_hb_emoji_b4(_hb_emoji_u8,((((u)>>6))>>4)))<<4)+((((u)>>6))&15)])<<6)+((u)&63))) : 0;
}
+17 -6
View File
@@ -1,21 +1,29 @@
#!/usr/bin/env -S make -f
all: packtab \
GENERATED = \
hb-ot-shaper-arabic-joining-list.hh \
hb-ot-shaper-arabic-table.hh hb-unicode-emoji-table.hh \
hb-ot-shaper-indic-table.cc hb-ot-tag-table.hh \
hb-ucd-table.hh hb-ot-shaper-use-table.hh \
hb-ot-shaper-arabic-pua.hh \
hb-ot-shaper-arabic-table.hh \
hb-unicode-emoji-table.hh \
hb-ot-shaper-indic-table.cc \
hb-ot-tag-table.hh \
hb-ucd-table.hh \
hb-ot-shaper-use-table.hh \
hb-ot-shaper-vowel-constraints.cc
all: packtab $(GENERATED)
SOURCES = \
ArabicShaping.txt UnicodeData.txt Blocks.txt emoji-data.txt \
IndicSyllabicCategory.txt IndicPositionalCategory.txt \
languagetags language-subtag-registry ucd.nounihan.grouped.zip Scripts.txt
.PHONY: all touch clean packtab
.PHONY: all touch clean clean-sources packtab
hb-ot-shaper-arabic-joining-list.hh: gen-arabic-joining-list.py ArabicShaping.txt Scripts.txt
./$^ > $@ || ($(RM) $@; false)
hb-ot-shaper-arabic-pua.hh: gen-arabic-pua.py ArabicPUASimplified.txt ArabicPUATraditional.txt
./$< > $@ || ($(RM) $@; false)
hb-ot-shaper-arabic-table.hh: gen-arabic-table.py ArabicShaping.txt UnicodeData.txt Blocks.txt
./$^ > $@ || ($(RM) $@; false)
hb-unicode-emoji-table.hh: gen-emoji-table.py emoji-data.txt emoji-test.txt
@@ -48,7 +56,10 @@ ucd.nounihan.grouped.zip:
curl -O https://unicode.org/Public/UCD/latest/ucdxml/ucd.nounihan.grouped.zip
clean:
$(RM) $(GENERATED)
clean-sources:
$(RM) $(SOURCES)
touch:
touch $(SOURCES)
@for f in $(SOURCES); do test ! -e $$f || touch $$f; done