| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright © 2007,2008,2009,2010 Red Hat, Inc. | 2 * Copyright © 2007,2008,2009,2010 Red Hat, Inc. |
| 3 * Copyright © 2012 Google, Inc. | 3 * Copyright © 2012 Google, Inc. |
| 4 * | 4 * |
| 5 * This is part of HarfBuzz, a text shaping library. | 5 * This is part of HarfBuzz, a text shaping library. |
| 6 * | 6 * |
| 7 * Permission is hereby granted, without written agreement and without | 7 * Permission is hereby granted, without written agreement and without |
| 8 * license or royalty fees, to use, copy, modify, and distribute this | 8 * license or royalty fees, to use, copy, modify, and distribute this |
| 9 * software and its documentation for any purpose, provided that the | 9 * software and its documentation for any purpose, provided that the |
| 10 * above copyright notice and the following two paragraphs appear in | 10 * above copyright notice and the following two paragraphs appear in |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 # define DEFINE_COMPILES_ASSERTION(_code) _DEFINE_COMPILES_ASSERTION0 (__LINE__,
_code) | 98 # define DEFINE_COMPILES_ASSERTION(_code) _DEFINE_COMPILES_ASSERTION0 (__LINE__,
_code) |
| 99 | 99 |
| 100 | 100 |
| 101 #define DEFINE_SIZE_STATIC(size) \ | 101 #define DEFINE_SIZE_STATIC(size) \ |
| 102 DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size)); \ | 102 DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size)); \ |
| 103 static const unsigned int static_size = (size); \ | 103 static const unsigned int static_size = (size); \ |
| 104 static const unsigned int min_size = (size); \ | 104 static const unsigned int min_size = (size); \ |
| 105 inline unsigned int get_size (void) const { return (size); } | 105 inline unsigned int get_size (void) const { return (size); } |
| 106 | 106 |
| 107 #define DEFINE_SIZE_UNION(size, _member) \ | 107 #define DEFINE_SIZE_UNION(size, _member) \ |
| 108 DEFINE_INSTANCE_ASSERTION (this->u._member.static_size == (size)); \ | 108 DEFINE_INSTANCE_ASSERTION (0*sizeof(this->u._member.static_size) + sizeof(this
->u._member) == (size)); \ |
| 109 static const unsigned int min_size = (size) | 109 static const unsigned int min_size = (size) |
| 110 | 110 |
| 111 #define DEFINE_SIZE_MIN(size) \ | 111 #define DEFINE_SIZE_MIN(size) \ |
| 112 DEFINE_INSTANCE_ASSERTION (sizeof (*this) >= (size)); \ | 112 DEFINE_INSTANCE_ASSERTION (sizeof (*this) >= (size)); \ |
| 113 static const unsigned int min_size = (size) | 113 static const unsigned int min_size = (size) |
| 114 | 114 |
| 115 #define DEFINE_SIZE_ARRAY(size, array) \ | 115 #define DEFINE_SIZE_ARRAY(size, array) \ |
| 116 DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size) + sizeof (array[0])); \ | 116 DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size) + sizeof (array[0])); \ |
| 117 DEFINE_COMPILES_ASSERTION ((void) array[0].static_size) \ | 117 DEFINE_COMPILES_ASSERTION ((void) array[0].static_size) \ |
| 118 static const unsigned int min_size = (size) | 118 static const unsigned int min_size = (size) |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 return_trace (likely (c->check_struct (this))); | 645 return_trace (likely (c->check_struct (this))); |
| 646 } | 646 } |
| 647 protected: | 647 protected: |
| 648 BEInt<Type, Size> v; | 648 BEInt<Type, Size> v; |
| 649 public: | 649 public: |
| 650 DEFINE_SIZE_STATIC (Size); | 650 DEFINE_SIZE_STATIC (Size); |
| 651 }; | 651 }; |
| 652 | 652 |
| 653 typedef IntType<int8_t , 1> CHAR; /* 8-bit signed integer. */ | 653 typedef IntType<int8_t , 1> CHAR; /* 8-bit signed integer. */ |
| 654 typedef IntType<uint8_t , 1> BYTE; /* 8-bit unsigned integer. */ | 654 typedef IntType<uint8_t , 1> BYTE; /* 8-bit unsigned integer. */ |
| 655 typedef IntType<int8_t , 1> INT8; /* 8-bit signed integer. */ |
| 655 typedef IntType<uint16_t, 2> USHORT; /* 16-bit unsigned integer. */ | 656 typedef IntType<uint16_t, 2> USHORT; /* 16-bit unsigned integer. */ |
| 656 typedef IntType<int16_t, 2> SHORT; /* 16-bit signed integer. */ | 657 typedef IntType<int16_t, 2> SHORT; /* 16-bit signed integer. */ |
| 657 typedef IntType<uint32_t, 4> ULONG; /* 32-bit unsigned integer. */ | 658 typedef IntType<uint32_t, 4> ULONG; /* 32-bit unsigned integer. */ |
| 658 typedef IntType<int32_t, 4> LONG; /* 32-bit signed integer. */ | 659 typedef IntType<int32_t, 4> LONG; /* 32-bit signed integer. */ |
| 659 typedef IntType<uint32_t, 3> UINT24; /* 24-bit unsigned integer. */ | 660 typedef IntType<uint32_t, 3> UINT24; /* 24-bit unsigned integer. */ |
| 660 | 661 |
| 661 /* 16-bit signed integer (SHORT) that describes a quantity in FUnits. */ | 662 /* 16-bit signed integer (SHORT) that describes a quantity in FUnits. */ |
| 662 typedef SHORT FWORD; | 663 typedef SHORT FWORD; |
| 663 | 664 |
| 664 /* 16-bit unsigned integer (USHORT) that describes a quantity in FUnits. */ | 665 /* 16-bit unsigned integer (USHORT) that describes a quantity in FUnits. */ |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 } | 945 } |
| 945 | 946 |
| 946 public: | 947 public: |
| 947 LenType len; | 948 LenType len; |
| 948 Type array[VAR]; | 949 Type array[VAR]; |
| 949 public: | 950 public: |
| 950 DEFINE_SIZE_ARRAY (sizeof (LenType), array); | 951 DEFINE_SIZE_ARRAY (sizeof (LenType), array); |
| 951 }; | 952 }; |
| 952 | 953 |
| 953 /* Array of Offset's */ | 954 /* Array of Offset's */ |
| 954 template <typename Type> | 955 template <typename Type, typename OffsetType=USHORT> |
| 955 struct OffsetArrayOf : ArrayOf<OffsetTo<Type> > {}; | 956 struct OffsetArrayOf : ArrayOf<OffsetTo<Type, OffsetType> > {}; |
| 956 | 957 |
| 957 /* Array of offsets relative to the beginning of the array itself. */ | 958 /* Array of offsets relative to the beginning of the array itself. */ |
| 958 template <typename Type> | 959 template <typename Type> |
| 959 struct OffsetListOf : OffsetArrayOf<Type> | 960 struct OffsetListOf : OffsetArrayOf<Type> |
| 960 { | 961 { |
| 961 inline const Type& operator [] (unsigned int i) const | 962 inline const Type& operator [] (unsigned int i) const |
| 962 { | 963 { |
| 963 if (unlikely (i >= this->len)) return Null(Type); | 964 if (unlikely (i >= this->len)) return Null(Type); |
| 964 return this+this->array[i]; | 965 return this+this->array[i]; |
| 965 } | 966 } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1057 } | 1058 } |
| 1058 return -1; | 1059 return -1; |
| 1059 } | 1060 } |
| 1060 }; | 1061 }; |
| 1061 | 1062 |
| 1062 | 1063 |
| 1063 } /* namespace OT */ | 1064 } /* namespace OT */ |
| 1064 | 1065 |
| 1065 | 1066 |
| 1066 #endif /* HB_OPEN_TYPE_PRIVATE_HH */ | 1067 #endif /* HB_OPEN_TYPE_PRIVATE_HH */ |
| OLD | NEW |