[HB] More reference cast simplification

This commit is contained in:
Behdad Esfahbod 2009-05-18 18:30:25 -04:00
parent eb0dfc830e
commit 6b54c5d044
3 changed files with 19 additions and 19 deletions

View File

@ -551,10 +551,10 @@ struct ReverseChainSingleSubstFormat1 {
if (HB_LIKELY (index == NOT_COVERED)) if (HB_LIKELY (index == NOT_COVERED))
return false; return false;
const OffsetArrayOf<Coverage> &lookahead = * (const OffsetArrayOf<Coverage> *) const OffsetArrayOf<Coverage> &lookahead = (const OffsetArrayOf<Coverage>&)
((const char *) &backtrack + backtrack.get_size ()); *((const char *) &backtrack + backtrack.get_size ());
const ArrayOf<GlyphID> &substitute = * (const ArrayOf<GlyphID> *) const ArrayOf<GlyphID> &substitute = (const ArrayOf<GlyphID>&)
((const char *) &lookahead + lookahead.get_size ()); *((const char *) &lookahead + lookahead.get_size ());
if (match_backtrack (APPLY_ARG, if (match_backtrack (APPLY_ARG,
backtrack.len, (USHORT *) backtrack.array, backtrack.len, (USHORT *) backtrack.array,

View File

@ -61,12 +61,12 @@ static inline bool match_glyph (hb_codepoint_t glyph_id, const USHORT &value, ch
} }
static inline bool match_class (hb_codepoint_t glyph_id, const USHORT &value, char *data) { static inline bool match_class (hb_codepoint_t glyph_id, const USHORT &value, char *data) {
const ClassDef &class_def = * (const ClassDef *) data; const ClassDef &class_def = (const ClassDef &)*data;
return class_def.get_class (glyph_id) == value; return class_def.get_class (glyph_id) == value;
} }
static inline bool match_coverage (hb_codepoint_t glyph_id, const USHORT &value, char *data) { static inline bool match_coverage (hb_codepoint_t glyph_id, const USHORT &value, char *data) {
const OffsetTo<Coverage> &coverage = * (const OffsetTo<Coverage> *) &value; const OffsetTo<Coverage> &coverage = (const OffsetTo<Coverage>&)value;
return (data+coverage) (glyph_id) != NOT_COVERED; return (data+coverage) (glyph_id) != NOT_COVERED;
} }
@ -457,12 +457,12 @@ struct ChainRule {
private: private:
inline bool apply (APPLY_ARG_DEF, ChainContextLookupContext &context) const { inline bool apply (APPLY_ARG_DEF, ChainContextLookupContext &context) const {
const HeadlessArrayOf<USHORT> &input = * (const HeadlessArrayOf<USHORT> *) const HeadlessArrayOf<USHORT> &input = (const HeadlessArrayOf<USHORT>&)
((const char *) &backtrack + backtrack.get_size ()); *((const char *) &backtrack + backtrack.get_size ());
const ArrayOf<USHORT> &lookahead = * (const ArrayOf<USHORT> *) const ArrayOf<USHORT> &lookahead = (const ArrayOf<USHORT>&)
((const char *) &input + input.get_size ()); *((const char *) &input + input.get_size ());
const ArrayOf<LookupRecord> &lookup = * (const ArrayOf<LookupRecord> *) const ArrayOf<LookupRecord> &lookup = (const ArrayOf<LookupRecord>&)
((const char *) &lookahead + lookahead.get_size ()); *((const char *) &lookahead + lookahead.get_size ());
return chain_context_lookup (APPLY_ARG, return chain_context_lookup (APPLY_ARG,
backtrack.len, backtrack.array, backtrack.len, backtrack.array,
input.len, input.array + 1, input.len, input.array + 1,
@ -602,17 +602,17 @@ struct ChainContextFormat3 {
inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const { inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const {
const OffsetArrayOf<Coverage> &input = * (const OffsetArrayOf<Coverage> *) const OffsetArrayOf<Coverage> &input = (const OffsetArrayOf<Coverage>&)
((const char *) &backtrack + backtrack.get_size ()); *((const char *) &backtrack + backtrack.get_size ());
unsigned int index = (this+input[0]) (IN_CURGLYPH ()); unsigned int index = (this+input[0]) (IN_CURGLYPH ());
if (HB_LIKELY (index == NOT_COVERED)) if (HB_LIKELY (index == NOT_COVERED))
return false; return false;
const OffsetArrayOf<Coverage> &lookahead = * (const OffsetArrayOf<Coverage> *) const OffsetArrayOf<Coverage> &lookahead = (const OffsetArrayOf<Coverage>&)
((const char *) &input + input.get_size ()); *((const char *) &input + input.get_size ());
const ArrayOf<LookupRecord> &lookup = * (const ArrayOf<LookupRecord> *) const ArrayOf<LookupRecord> &lookup = (const ArrayOf<LookupRecord>&)
((const char *) &lookahead + lookahead.get_size ()); *((const char *) &lookahead + lookahead.get_size ());
struct ChainContextLookupContext context = { struct ChainContextLookupContext context = {
{match_coverage, apply_func}, {match_coverage, apply_func},
{(char *) this, (char *) this, (char *) this} {(char *) this, (char *) this, (char *) this}

View File

@ -300,7 +300,7 @@ struct OffsetTo : Offset {
inline const Type& operator() (const void *base) const { inline const Type& operator() (const void *base) const {
unsigned int offset = *this; unsigned int offset = *this;
if (HB_UNLIKELY (!offset)) return Null(Type); if (HB_UNLIKELY (!offset)) return Null(Type);
return * (const Type *) ((const char *) base + offset); return (const Type&)*((const char *) base + offset);
} }
}; };
template <typename Base, typename Type> template <typename Base, typename Type>