diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2006-12-27 20:06:42 -0500 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2006-12-27 20:06:42 -0500 |
commit | bf0f9dd61375c5afce8e6b1664d0df5f6c8b2494 (patch) | |
tree | e6e6b69d25e0c032ff7d99b3a65173fda4c09075 | |
parent | c46196d09c4ea879bf45182e8a0d649d4c750c39 (diff) | |
download | harfbuzz-bf0f9dd61375c5afce8e6b1664d0df5f6c8b2494.tar.gz |
Use union for ClassDef
-rw-r--r-- | src/harfbuzz-ng.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/harfbuzz-ng.cc b/src/harfbuzz-ng.cc index 47d7ebe4..ecde88a2 100644 --- a/src/harfbuzz-ng.cc +++ b/src/harfbuzz-ng.cc @@ -594,22 +594,24 @@ struct ClassDef { inline unsigned int get_size (void) const { switch (classFormat) { - case 1: return ((const ClassDefFormat1&)*this).get_size (); - case 2: return ((const ClassDefFormat2&)*this).get_size (); - default:return sizeof (ClassDef); + case 1: return format1.get_size (); + case 2: return format2.get_size (); + default:return sizeof (classFormat); } } /* Returns 0 if not found. */ inline int get_class (uint16_t glyph_id) const { switch (classFormat) { - case 1: return ((const ClassDefFormat1&)*this).get_class(glyph_id); - case 2: return ((const ClassDefFormat2&)*this).get_class(glyph_id); + case 1: format1.get_class(glyph_id); + case 2: format2.get_class(glyph_id); default:return 0; } } USHORT classFormat; /* Format identifier */ + ClassDefFormat1 format1; + ClassDefFormat2 format2; }; /* |