| 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 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 { | 635 { |
| 636 inline bool is_null (void) const { return 0 == *this; } | 636 inline bool is_null (void) const { return 0 == *this; } |
| 637 public: | 637 public: |
| 638 DEFINE_SIZE_STATIC (4); | 638 DEFINE_SIZE_STATIC (4); |
| 639 }; | 639 }; |
| 640 | 640 |
| 641 | 641 |
| 642 /* CheckSum */ | 642 /* CheckSum */ |
| 643 struct CheckSum : ULONG | 643 struct CheckSum : ULONG |
| 644 { | 644 { |
| 645 static uint32_t CalcTableChecksum (ULONG *Table, uint32_t Length) | 645 /* This is reference implementation from the spec. */ |
| 646 static inline uint32_t CalcTableChecksum (const ULONG *Table, uint32_t Length) |
| 646 { | 647 { |
| 647 uint32_t Sum = 0L; | 648 uint32_t Sum = 0L; |
| 648 ULONG *EndPtr = Table+((Length+3) & ~3) / ULONG::static_size; | 649 const ULONG *EndPtr = Table+((Length+3) & ~3) / ULONG::static_size; |
| 649 | 650 |
| 650 while (Table < EndPtr) | 651 while (Table < EndPtr) |
| 651 Sum += *Table++; | 652 Sum += *Table++; |
| 652 return Sum; | 653 return Sum; |
| 653 } | 654 } |
| 655 |
| 656 /* Note: data should be 4byte aligned and have 4byte padding at the end. */ |
| 657 inline void set_for_data (const void *data, unsigned int length) |
| 658 { set (CalcTableChecksum ((const ULONG *) data, length)); } |
| 659 |
| 654 public: | 660 public: |
| 655 DEFINE_SIZE_STATIC (4); | 661 DEFINE_SIZE_STATIC (4); |
| 656 }; | 662 }; |
| 657 | 663 |
| 658 | 664 |
| 659 /* | 665 /* |
| 660 * Version Numbers | 666 * Version Numbers |
| 661 */ | 667 */ |
| 662 | 668 |
| 663 struct FixedVersion | 669 struct FixedVersion |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 } | 972 } |
| 967 return -1; | 973 return -1; |
| 968 } | 974 } |
| 969 }; | 975 }; |
| 970 | 976 |
| 971 | 977 |
| 972 } /* namespace OT */ | 978 } /* namespace OT */ |
| 973 | 979 |
| 974 | 980 |
| 975 #endif /* HB_OPEN_TYPE_PRIVATE_HH */ | 981 #endif /* HB_OPEN_TYPE_PRIVATE_HH */ |
| OLD | NEW |