From 0394ec1bfbd7806cbe9fc809b34f96f8d12ffbf2 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 27 Jun 2014 14:40:35 -0400 Subject: [PATCH] Minor: Introduce GenericOffset --- src/hb-open-type-private.hh | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh index c4ec0edd4..d3e2bee44 100644 --- a/src/hb-open-type-private.hh +++ b/src/hb-open-type-private.hh @@ -630,21 +630,17 @@ struct Index : USHORT { }; DEFINE_NULL_DATA (Index, "\xff\xff"); -/* Offset to a table, same as uint16 (length = 16 bits), Null offset = 0x0000 */ -struct Offset : USHORT +/* GenericOffset, Null offset = 0 */ +template +struct GenericOffset : Type { inline bool is_null (void) const { return 0 == *this; } public: - DEFINE_SIZE_STATIC (2); + DEFINE_SIZE_STATIC (sizeof(Type)); }; -/* LongOffset to a table, same as uint32 (length = 32 bits), Null offset = 0x00000000 */ -struct LongOffset : ULONG -{ - inline bool is_null (void) const { return 0 == *this; } - public: - DEFINE_SIZE_STATIC (4); -}; +typedef GenericOffset Offset; +typedef GenericOffset LongOffset; /* CheckSum */