- uint8_t *src = this->fBytes;
- uint8_t *tgt = target.fBytes;
-
- // are we comparing the same string
- if (src == tgt)
- return Collator::EQUAL;
-
- /*
- int count = (this->fCount < target.fCount) ? this->fCount : target.fCount;
- if (count == 0)
- {
- // If count is 0, at least one of the keys is empty.
- // An empty key is always LESS than a non-empty one
- // and EQUAL to another empty
- if (this->fCount < target.fCount)
- {
- return Collator::LESS;
- }
-
- if (this->fCount > target.fCount)
- {
- return Collator::GREATER;
- }
- return Collator::EQUAL;
- }
- */
-
- int minLength;
- Collator::EComparisonResult result;
-
- // are we comparing different lengths?
- if (this->fCount != target.fCount) {
- if (this->fCount < target.fCount) {
- minLength = this->fCount;
- result = Collator::LESS;
- }
- else {
- minLength = target.fCount;
- result = Collator::GREATER;
- }
- }
- else {
- minLength = target.fCount;
- result = Collator::EQUAL;
- }
-
- if (minLength > 0) {
- int diff = uprv_memcmp(src, tgt, minLength);
- if (diff > 0) {
- return Collator::GREATER;
- }
- else
- if (diff < 0) {
- return Collator::LESS;
- }
- }
-
- return result;
- /*
- if (result < 0)
- {
- return Collator::LESS;
- }
-
- if (result > 0)
- {
- return Collator::GREATER;
- }
- return Collator::EQUAL;
- */