| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright © 2012 Google, Inc. | 2 * Copyright © 2012 Google, Inc. |
| 3 * | 3 * |
| 4 * This is part of HarfBuzz, a text shaping library. | 4 * This is part of HarfBuzz, a text shaping library. |
| 5 * | 5 * |
| 6 * Permission is hereby granted, without written agreement and without | 6 * Permission is hereby granted, without written agreement and without |
| 7 * license or royalty fees, to use, copy, modify, and distribute this | 7 * license or royalty fees, to use, copy, modify, and distribute this |
| 8 * software and its documentation for any purpose, provided that the | 8 * software and its documentation for any purpose, provided that the |
| 9 * above copyright notice and the following two paragraphs appear in | 9 * above copyright notice and the following two paragraphs appear in |
| 10 * all copies of this software. | 10 * all copies of this software. |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 unsigned int count = 0; | 306 unsigned int count = 0; |
| 307 for (unsigned int i = 0; i < ELTS; i++) | 307 for (unsigned int i = 0; i < ELTS; i++) |
| 308 count += _hb_popcount32 (elts[i]); | 308 count += _hb_popcount32 (elts[i]); |
| 309 return count; | 309 return count; |
| 310 } | 310 } |
| 311 inline hb_codepoint_t get_min (void) const | 311 inline hb_codepoint_t get_min (void) const |
| 312 { | 312 { |
| 313 for (unsigned int i = 0; i < ELTS; i++) | 313 for (unsigned int i = 0; i < ELTS; i++) |
| 314 if (elts[i]) | 314 if (elts[i]) |
| 315 for (unsigned int j = 0; j < BITS; j++) | 315 for (unsigned int j = 0; j < BITS; j++) |
| 316 » if (elts[i] & (1 << j)) | 316 » if (elts[i] & (1u << j)) |
| 317 return i * BITS + j; | 317 return i * BITS + j; |
| 318 return INVALID; | 318 return INVALID; |
| 319 } | 319 } |
| 320 inline hb_codepoint_t get_max (void) const | 320 inline hb_codepoint_t get_max (void) const |
| 321 { | 321 { |
| 322 for (unsigned int i = ELTS; i; i--) | 322 for (unsigned int i = ELTS; i; i--) |
| 323 if (elts[i - 1]) | 323 if (elts[i - 1]) |
| 324 for (unsigned int j = BITS; j; j--) | 324 for (unsigned int j = BITS; j; j--) |
| 325 » if (elts[i - 1] & (1 << (j - 1))) | 325 » if (elts[i - 1] & (1u << (j - 1))) |
| 326 return (i - 1) * BITS + (j - 1); | 326 return (i - 1) * BITS + (j - 1); |
| 327 return INVALID; | 327 return INVALID; |
| 328 } | 328 } |
| 329 | 329 |
| 330 typedef uint32_t elt_t; | 330 typedef uint32_t elt_t; |
| 331 static const unsigned int MAX_G = 65536 - 1; /* XXX Fix this... */ | 331 static const unsigned int MAX_G = 65536 - 1; /* XXX Fix this... */ |
| 332 static const unsigned int SHIFT = 5; | 332 static const unsigned int SHIFT = 5; |
| 333 static const unsigned int BITS = (1 << SHIFT); | 333 static const unsigned int BITS = (1 << SHIFT); |
| 334 static const unsigned int MASK = BITS - 1; | 334 static const unsigned int MASK = BITS - 1; |
| 335 static const unsigned int ELTS = (MAX_G + 1 + (BITS - 1)) / BITS; | 335 static const unsigned int ELTS = (MAX_G + 1 + (BITS - 1)) / BITS; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 elt_t const &elt (hb_codepoint_t g) const { return elts[g >> SHIFT]; } | 393 elt_t const &elt (hb_codepoint_t g) const { return elts[g >> SHIFT]; } |
| 394 elt_t mask (hb_codepoint_t g) const { return elt_t (1) << (g & MASK); } | 394 elt_t mask (hb_codepoint_t g) const { return elt_t (1) << (g & MASK); } |
| 395 | 395 |
| 396 private: | 396 private: |
| 397 hb_codepoint_t start, count; | 397 hb_codepoint_t start, count; |
| 398 elt_t *elts; | 398 elt_t *elts; |
| 399 }; | 399 }; |
| 400 | 400 |
| 401 | 401 |
| 402 #endif /* HB_SET_PRIVATE_HH */ | 402 #endif /* HB_SET_PRIVATE_HH */ |
| OLD | NEW |