Differences From Artifact [3609f3a164]:
- File
src/OFString_UTF8.m
— part of check-in
[301ee63212]
at
2011-11-20 18:41:25
on branch trunk
— Make OFString a class cluster.
It is a class cluster now, but there is still much to improve. (user: js, size: 23880) [annotate] [blame] [check-ins using]
To Artifact [a98ac09f1e]:
- File src/OFString_UTF8.m — part of check-in [855de7c3a7] at 2011-11-21 16:47:57 on branch trunk — Implement -[OFString_UTF8 hash] for better performance. (user: js, size: 24341) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
711 712 713 714 715 716 717 | return OF_ORDERED_DESCENDING; else if (s->cStringLength - i < otherCStringLength - j) return OF_ORDERED_ASCENDING; return OF_ORDERED_SAME; } | < > > | > | > > > | > > > > > > > > > > > > > > > > | 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 | return OF_ORDERED_DESCENDING; else if (s->cStringLength - i < otherCStringLength - j) return OF_ORDERED_ASCENDING; return OF_ORDERED_SAME; } - (uint32_t)hash { size_t i; uint32_t hash; OF_HASH_INIT(hash); for (i = 0; i < s->cStringLength; i++) { of_unichar_t c; size_t length; if ((length = of_string_utf8_to_unicode(s->cString + i, s->cStringLength - i, &c)) == 0) @throw [OFInvalidEncodingException exceptionWithClass: isa]; OF_HASH_ADD(hash, (c & 0xFF0000) >> 16); OF_HASH_ADD(hash, (c & 0x00FF00) >> 8); OF_HASH_ADD(hash, c & 0x0000FF); i += length - 1; } OF_HASH_FINALIZE(hash); return hash; } - (of_unichar_t)characterAtIndex: (size_t)index { of_unichar_t character; if (index >= s->length) @throw [OFOutOfRangeException exceptionWithClass: isa]; |
︙ | ︙ |