More cast simplification

This commit is contained in:
Behdad Esfahbod 2010-04-21 23:57:01 -04:00
parent 0dfcc13a46
commit 243d20e011
1 changed files with 3 additions and 3 deletions

View File

@ -484,21 +484,21 @@ struct GenericOffsetTo : OffsetType
if (!SANITIZE_SELF ()) return false; if (!SANITIZE_SELF ()) return false;
unsigned int offset = *this; unsigned int offset = *this;
if (HB_UNLIKELY (!offset)) return true; if (HB_UNLIKELY (!offset)) return true;
return SANITIZE (CAST(Type, *CharP(base), offset)) || NEUTER (DECONST_CAST(OffsetType,*this,0), 0); return SANITIZE (CAST(Type, *CharP(base), offset)) || NEUTER (CAST(OffsetType,*this,0), 0);
} }
inline bool sanitize (SANITIZE_ARG_DEF, void *base, void *base2) { inline bool sanitize (SANITIZE_ARG_DEF, void *base, void *base2) {
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (!SANITIZE_SELF ()) return false; if (!SANITIZE_SELF ()) return false;
unsigned int offset = *this; unsigned int offset = *this;
if (HB_UNLIKELY (!offset)) return true; if (HB_UNLIKELY (!offset)) return true;
return SANITIZE_BASE (CAST(Type, *CharP(base), offset), base2) || NEUTER (DECONST_CAST(OffsetType,*this,0), 0); return SANITIZE_BASE (CAST(Type, *CharP(base), offset), base2) || NEUTER (CAST(OffsetType,*this,0), 0);
} }
inline bool sanitize (SANITIZE_ARG_DEF, void *base, unsigned int user_data) { inline bool sanitize (SANITIZE_ARG_DEF, void *base, unsigned int user_data) {
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (!SANITIZE_SELF ()) return false; if (!SANITIZE_SELF ()) return false;
unsigned int offset = *this; unsigned int offset = *this;
if (HB_UNLIKELY (!offset)) return true; if (HB_UNLIKELY (!offset)) return true;
return SANITIZE_BASE (CAST(Type, *CharP(base), offset), user_data) || NEUTER (DECONST_CAST(OffsetType,*this,0), 0); return SANITIZE_BASE (CAST(Type, *CharP(base), offset), user_data) || NEUTER (CAST(OffsetType,*this,0), 0);
} }
}; };
template <typename Base, typename OffsetType, typename Type> template <typename Base, typename OffsetType, typename Type>