| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright © 1998-2004 David Turner and Werner Lemberg | 2 * Copyright © 1998-2004 David Turner and Werner Lemberg |
| 3 * Copyright © 2004,2007,2009,2010 Red Hat, Inc. | 3 * Copyright © 2004,2007,2009,2010 Red Hat, Inc. |
| 4 * Copyright © 2011,2012 Google, Inc. | 4 * Copyright © 2011,2012 Google, Inc. |
| 5 * | 5 * |
| 6 * This is part of HarfBuzz, a text shaping library. | 6 * This is part of HarfBuzz, a text shaping library. |
| 7 * | 7 * |
| 8 * Permission is hereby granted, without written agreement and without | 8 * Permission is hereby granted, without written agreement and without |
| 9 * license or royalty fees, to use, copy, modify, and distribute this | 9 * license or royalty fees, to use, copy, modify, and distribute this |
| 10 * software and its documentation for any purpose, provided that the | 10 * software and its documentation for any purpose, provided that the |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 /* Internal debugging. */ | 127 /* Internal debugging. */ |
| 128 /* The bits here reflect current allocations of the bytes in glyph_info_t's va
r1 and var2. */ | 128 /* The bits here reflect current allocations of the bytes in glyph_info_t's va
r1 and var2. */ |
| 129 #ifndef HB_NDEBUG | 129 #ifndef HB_NDEBUG |
| 130 uint8_t allocated_var_bits; | 130 uint8_t allocated_var_bits; |
| 131 #endif | 131 #endif |
| 132 inline void allocate_var (unsigned int start, unsigned int count) | 132 inline void allocate_var (unsigned int start, unsigned int count) |
| 133 { | 133 { |
| 134 #ifndef HB_NDEBUG | 134 #ifndef HB_NDEBUG |
| 135 unsigned int end = start + count; | 135 unsigned int end = start + count; |
| 136 assert (end <= 8); | 136 assert (end <= 8); |
| 137 unsigned int bits = (1<<end) - (1<<start); | 137 unsigned int bits = (1u<<end) - (1u<<start); |
| 138 assert (0 == (allocated_var_bits & bits)); | 138 assert (0 == (allocated_var_bits & bits)); |
| 139 allocated_var_bits |= bits; | 139 allocated_var_bits |= bits; |
| 140 #endif | 140 #endif |
| 141 } | 141 } |
| 142 inline void deallocate_var (unsigned int start, unsigned int count) | 142 inline void deallocate_var (unsigned int start, unsigned int count) |
| 143 { | 143 { |
| 144 #ifndef HB_NDEBUG | 144 #ifndef HB_NDEBUG |
| 145 unsigned int end = start + count; | 145 unsigned int end = start + count; |
| 146 assert (end <= 8); | 146 assert (end <= 8); |
| 147 unsigned int bits = (1<<end) - (1<<start); | 147 unsigned int bits = (1u<<end) - (1u<<start); |
| 148 assert (bits == (allocated_var_bits & bits)); | 148 assert (bits == (allocated_var_bits & bits)); |
| 149 allocated_var_bits &= ~bits; | 149 allocated_var_bits &= ~bits; |
| 150 #endif | 150 #endif |
| 151 } | 151 } |
| 152 inline void assert_var (unsigned int start, unsigned int count) | 152 inline void assert_var (unsigned int start, unsigned int count) |
| 153 { | 153 { |
| 154 #ifndef HB_NDEBUG | 154 #ifndef HB_NDEBUG |
| 155 unsigned int end = start + count; | 155 unsigned int end = start + count; |
| 156 assert (end <= 8); | 156 assert (end <= 8); |
| 157 unsigned int bits = (1<<end) - (1<<start); | 157 unsigned int bits = (1u<<end) - (1u<<start); |
| 158 assert (bits == (allocated_var_bits & bits)); | 158 assert (bits == (allocated_var_bits & bits)); |
| 159 #endif | 159 #endif |
| 160 } | 160 } |
| 161 inline void deallocate_var_all (void) | 161 inline void deallocate_var_all (void) |
| 162 { | 162 { |
| 163 #ifndef HB_NDEBUG | 163 #ifndef HB_NDEBUG |
| 164 allocated_var_bits = 0; | 164 allocated_var_bits = 0; |
| 165 #endif | 165 #endif |
| 166 } | 166 } |
| 167 | 167 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 | 287 |
| 288 #define HB_BUFFER_XALLOCATE_VAR(b, func, var) \ | 288 #define HB_BUFFER_XALLOCATE_VAR(b, func, var) \ |
| 289 b->func (offsetof (hb_glyph_info_t, var) - offsetof(hb_glyph_info_t, var1), \ | 289 b->func (offsetof (hb_glyph_info_t, var) - offsetof(hb_glyph_info_t, var1), \ |
| 290 sizeof (b->info[0].var)) | 290 sizeof (b->info[0].var)) |
| 291 #define HB_BUFFER_ALLOCATE_VAR(b, var) HB_BUFFER_XALLOCATE_VAR (b, allo
cate_var, var ()) | 291 #define HB_BUFFER_ALLOCATE_VAR(b, var) HB_BUFFER_XALLOCATE_VAR (b, allo
cate_var, var ()) |
| 292 #define HB_BUFFER_DEALLOCATE_VAR(b, var) HB_BUFFER_XALLOCATE_VAR (b, deal
locate_var, var ()) | 292 #define HB_BUFFER_DEALLOCATE_VAR(b, var) HB_BUFFER_XALLOCATE_VAR (b, deal
locate_var, var ()) |
| 293 #define HB_BUFFER_ASSERT_VAR(b, var) HB_BUFFER_XALLOCATE_VAR (b, asse
rt_var, var ()) | 293 #define HB_BUFFER_ASSERT_VAR(b, var) HB_BUFFER_XALLOCATE_VAR (b, asse
rt_var, var ()) |
| 294 | 294 |
| 295 | 295 |
| 296 #endif /* HB_BUFFER_PRIVATE_HH */ | 296 #endif /* HB_BUFFER_PRIVATE_HH */ |
| OLD | NEW |