1fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius/* 2fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius******************************************************************************* 3fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius* Copyright (C) 2013-2014, International Business Machines 4fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius* Corporation and others. All Rights Reserved. 5fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius******************************************************************************* 6fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius* collationrootelements.h 7fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius* 8fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius* created on: 2013mar01 9fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius* created by: Markus W. Scherer 10fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius*/ 11fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 12fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius#ifndef __COLLATIONROOTELEMENTS_H__ 13fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius#define __COLLATIONROOTELEMENTS_H__ 14fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 15fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius#include "unicode/utypes.h" 16fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 17fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius#if !UCONFIG_NO_COLLATION 18fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 19fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius#include "unicode/uobject.h" 20fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius#include "collation.h" 21fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 22fceb39872958b9fa2505e63f8b8699a9e0f882f4ccorneliusU_NAMESPACE_BEGIN 23fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 24fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius/** 25fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Container and access methods for collation elements and weights 26fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * that occur in the root collator. 27fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Needed for finding boundaries for building a tailoring. 28fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * 29fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * This class takes and returns 16-bit secondary and tertiary weights. 30fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */ 31fceb39872958b9fa2505e63f8b8699a9e0f882f4ccorneliusclass U_I18N_API CollationRootElements : public UMemory { 32fceb39872958b9fa2505e63f8b8699a9e0f882f4ccorneliuspublic: 33fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius CollationRootElements(const uint32_t *rootElements, int32_t rootElementsLength) 34fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius : elements(rootElements), length(rootElementsLength) {} 35fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 36fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius /** 37fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Higher than any root primary. 38fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */ 39fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius static const uint32_t PRIMARY_SENTINEL = 0xffffff00; 40fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 41fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius /** 42fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Flag in a root element, set if the element contains secondary & tertiary weights, 43fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * rather than a primary. 44fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */ 45fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius static const uint32_t SEC_TER_DELTA_FLAG = 0x80; 46fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius /** 47fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Mask for getting the primary range step value from a primary-range-end element. 48fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */ 49fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius static const uint8_t PRIMARY_STEP_MASK = 0x7f; 50fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 51fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius enum { 52fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius /** 53fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Index of the first CE with a non-zero tertiary weight. 54fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Same as the start of the compact root elements table. 55fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */ 56fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius IX_FIRST_TERTIARY_INDEX, 57fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius /** 58fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Index of the first CE with a non-zero secondary weight. 59fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */ 60fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius IX_FIRST_SECONDARY_INDEX, 61fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius /** 62fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Index of the first CE with a non-zero primary weight. 63fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */ 64fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius IX_FIRST_PRIMARY_INDEX, 65fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius /** 66fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Must match Collation::COMMON_SEC_AND_TER_CE. 67fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */ 68fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius IX_COMMON_SEC_AND_TER_CE, 69fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius /** 70fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Secondary & tertiary boundaries. 71fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Bits 31..24: [fixed last secondary common byte 45] 72fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Bits 23..16: [fixed first ignorable secondary byte 80] 73fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Bits 15.. 8: reserved, 0 74fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Bits 7.. 0: [fixed first ignorable tertiary byte 3C] 75fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */ 76fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius IX_SEC_TER_BOUNDARIES, 77fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius /** 78fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * The current number of indexes. 79fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Currently the same as elements[IX_FIRST_TERTIARY_INDEX]. 80fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */ 81fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius IX_COUNT 82fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius }; 83fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 84fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius /** 85fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Returns the boundary between tertiary weights of primary/secondary CEs 86fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * and those of tertiary CEs. 87fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * This is the upper limit for tertiaries of primary/secondary CEs. 88fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * This minus one is the lower limit for tertiaries of tertiary CEs. 89fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */ 90fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius uint32_t getTertiaryBoundary() const { 91fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius return (elements[IX_SEC_TER_BOUNDARIES] << 8) & 0xff00; 92fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius } 93fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 94fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius /** 95fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Returns the first assigned tertiary CE. 96fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */ 97fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius uint32_t getFirstTertiaryCE() const { 98fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius return elements[elements[IX_FIRST_TERTIARY_INDEX]] & ~SEC_TER_DELTA_FLAG; 99fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius } 100fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 101fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius /** 102fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Returns the last assigned tertiary CE. 103fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */ 104fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius uint32_t getLastTertiaryCE() const { 105fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius return elements[elements[IX_FIRST_SECONDARY_INDEX] - 1] & ~SEC_TER_DELTA_FLAG; 106fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius } 107fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 108fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius /** 109fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Returns the last common secondary weight. 110fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * This is the lower limit for secondaries of primary CEs. 111fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */ 112fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius uint32_t getLastCommonSecondary() const { 113fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius return (elements[IX_SEC_TER_BOUNDARIES] >> 16) & 0xff00; 114fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius } 115fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 116fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius /** 117fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Returns the boundary between secondary weights of primary CEs 118fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * and those of secondary CEs. 119fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * This is the upper limit for secondaries of primary CEs. 120fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * This minus one is the lower limit for secondaries of secondary CEs. 121fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */ 122fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius uint32_t getSecondaryBoundary() const { 123fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius return (elements[IX_SEC_TER_BOUNDARIES] >> 8) & 0xff00; 124fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius } 125fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 126fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius /** 127fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Returns the first assigned secondary CE. 128fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */ 129fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius uint32_t getFirstSecondaryCE() const { 130fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius return elements[elements[IX_FIRST_SECONDARY_INDEX]] & ~SEC_TER_DELTA_FLAG; 131fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius } 132fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 133fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius /** 134fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Returns the last assigned secondary CE. 135fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */ 136fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius uint32_t getLastSecondaryCE() const { 137fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius return elements[elements[IX_FIRST_PRIMARY_INDEX] - 1] & ~SEC_TER_DELTA_FLAG; 138fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius } 139fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 140fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius /** 141fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Returns the first assigned primary weight. 142fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */ 143fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius uint32_t getFirstPrimary() const { 144fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius return elements[elements[IX_FIRST_PRIMARY_INDEX]]; // step=0: cannot be a range end 145fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius } 146fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 147fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius /** 148fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Returns the first assigned primary CE. 149fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */ 150fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius int64_t getFirstPrimaryCE() const { 151fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius return Collation::makeCE(getFirstPrimary()); 152fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius } 153fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 154fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius /** 155fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Returns the last root CE with a primary weight before p. 156fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Intended only for reordering group boundaries. 157fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */ 158fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius int64_t lastCEWithPrimaryBefore(uint32_t p) const; 159fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 160fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius /** 161fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Returns the first root CE with a primary weight of at least p. 162fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Intended only for reordering group boundaries. 163fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */ 164fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius int64_t firstCEWithPrimaryAtLeast(uint32_t p) const; 165fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 166fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius /** 167fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Returns the primary weight before p. 168fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * p must be greater than the first root primary. 169fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */ 170fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius uint32_t getPrimaryBefore(uint32_t p, UBool isCompressible) const; 171fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 172fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius /** Returns the secondary weight before [p, s]. */ 173fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius uint32_t getSecondaryBefore(uint32_t p, uint32_t s) const; 174fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 175fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius /** Returns the tertiary weight before [p, s, t]. */ 176fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius uint32_t getTertiaryBefore(uint32_t p, uint32_t s, uint32_t t) const; 177fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 178fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius /** 179fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Finds the index of the input primary. 180fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * p must occur as a root primary, and must not be 0. 181fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */ 182fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius int32_t findPrimary(uint32_t p) const; 183fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 184fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius /** 185fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Returns the primary weight after p where index=findPrimary(p). 186fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * p must be at least the first root primary. 187fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */ 188fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius uint32_t getPrimaryAfter(uint32_t p, int32_t index, UBool isCompressible) const; 189fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius /** 190fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Returns the secondary weight after [p, s] where index=findPrimary(p) 191fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * except use index=0 for p=0. 192fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */ 193fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius uint32_t getSecondaryAfter(int32_t index, uint32_t s) const; 194fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius /** 195fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Returns the tertiary weight after [p, s, t] where index=findPrimary(p) 196fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * except use index=0 for p=0. 197fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */ 198fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius uint32_t getTertiaryAfter(int32_t index, uint32_t s, uint32_t t) const; 199fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 200fceb39872958b9fa2505e63f8b8699a9e0f882f4ccorneliusprivate: 201fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius /** 202fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Finds the largest index i where elements[i]<=p. 203fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Requires first primary<=p<0xffffff00 (PRIMARY_SENTINEL). 204fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Does not require that p is a root collator primary. 205fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */ 206fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius int32_t findP(uint32_t p) const; 207fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 208fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius static inline UBool isEndOfPrimaryRange(uint32_t q) { 209fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius return (q & SEC_TER_DELTA_FLAG) == 0 && (q & PRIMARY_STEP_MASK) != 0; 210fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius } 211fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 212fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius /** 213fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Data structure: 214fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * 215fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * The first few entries are indexes, up to elements[IX_FIRST_TERTIARY_INDEX]. 216fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * See the comments on the IX_ constants. 217fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * 218fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * All other elements are a compact form of the root collator CEs 219fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * in collation order. 220fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * 221fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Primary weights have the SEC_TER_DELTA_FLAG flag not set. 222fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * A primary-weight element by itself represents a root CE 223fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * with Collation::COMMON_SEC_AND_TER_CE. 224fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * 225fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * If there are root CEs with the same primary but other secondary/tertiary weights, 226fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * then for each such CE there is an element with those secondary and tertiary weights, 227fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * and with the SEC_TER_DELTA_FLAG flag set. 228fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * 229fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * A range of only-primary CEs with a consistent "step" increment 230fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * from each primary to the next may be stored as a range. 231fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Only the first and last primary are stored, and the last has the step 232fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * value in the low bits (PRIMARY_STEP_MASK). 233fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * 234fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * An range-end element may also either start a new range or be followed by 235fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * elements with secondary/tertiary deltas. 236fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * 237fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * A primary element that is not a range end has zero step bits. 238fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * 239fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * There is no element for the completely ignorable CE (all weights 0). 240fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * 241fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Before elements[IX_FIRST_PRIMARY_INDEX], all elements are secondary/tertiary deltas, 242fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * for all of the ignorable root CEs. 243fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * 244fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * There are no elements for unassigned-implicit primary CEs. 245fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * All primaries stored here are at most 3 bytes long. 246fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */ 247fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius const uint32_t *elements; 248fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius int32_t length; 249fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius}; 250fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 251fceb39872958b9fa2505e63f8b8699a9e0f882f4ccorneliusU_NAMESPACE_END 252fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 253fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius#endif // !UCONFIG_NO_COLLATION 254fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius#endif // __COLLATIONROOTELEMENTS_H__ 255