| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkOTTableTypes_DEFINED | 8 #ifndef SkOTTableTypes_DEFINED |
| 9 #define SkOTTableTypes_DEFINED | 9 #define SkOTTableTypes_DEFINED |
| 10 | 10 |
| 11 #include "SkTemplates.h" |
| 11 #include "SkTypes.h" | 12 #include "SkTypes.h" |
| 12 #include "SkEndian.h" | 13 #include "SkEndian.h" |
| 13 | 14 |
| 14 //All SK_OT_ prefixed types should be considered as big endian. | 15 //All SK_OT_ prefixed types should be considered as big endian. |
| 15 typedef uint8_t SK_OT_BYTE; | 16 typedef uint8_t SK_OT_BYTE; |
| 16 #if CHAR_BIT == 8 | 17 #if CHAR_BIT == 8 |
| 17 typedef signed char SK_OT_CHAR; //easier to debug | 18 typedef signed char SK_OT_CHAR; //easier to debug |
| 18 #else | 19 #else |
| 19 typedef int8_t SK_OT_CHAR; | 20 typedef int8_t SK_OT_CHAR; |
| 20 #endif | 21 #endif |
| (...skipping 17 matching lines...) Expand all Loading... |
| 38 public: | 39 public: |
| 39 /** | 40 /** |
| 40 * SkOTTableTAG<T>::value is the big endian value of an OpenType table tag. | 41 * SkOTTableTAG<T>::value is the big endian value of an OpenType table tag. |
| 41 * It may be directly compared with raw big endian table data. | 42 * It may be directly compared with raw big endian table data. |
| 42 */ | 43 */ |
| 43 static const SK_OT_ULONG value = SkTEndian_SwapBE32( | 44 static const SK_OT_ULONG value = SkTEndian_SwapBE32( |
| 44 SkSetFourByteTag(T::TAG0, T::TAG1, T::TAG2, T::TAG3) | 45 SkSetFourByteTag(T::TAG0, T::TAG1, T::TAG2, T::TAG3) |
| 45 ); | 46 ); |
| 46 }; | 47 }; |
| 47 | 48 |
| 49 /** SkOTSetUSHORTBit<N>::value is an SK_OT_USHORT with the Nth BE bit set. */ |
| 50 template <unsigned N> struct SkOTSetUSHORTBit { |
| 51 static const uint16_t bit = SkTSetBit<N, uint16_t>::value; |
| 52 static const SK_OT_USHORT value = SkTEndian_SwapBE16(bit); |
| 53 }; |
| 54 |
| 55 /** SkOTSetUSHORTBit<N>::value is an SK_OT_ULONG with the Nth BE bit set. */ |
| 56 template <unsigned N> struct SkOTSetULONGBit { |
| 57 static const uint32_t bit = SkTSetBit<N, uint32_t>::value; |
| 58 static const SK_OT_ULONG value = SkTEndian_SwapBE32(bit); |
| 59 }; |
| 60 |
| 48 #endif | 61 #endif |
| OLD | NEW |