github.com/dolthub/go-mysql-server@v0.18.0/sql/encodings/utf16_unicode_520_ci.go (about)

     1  // Copyright 2023 Dolthub, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package encodings
    16  
    17  // Utf16_unicode_520_ci_RuneWeight returns the weight of a given rune based on its relational sort order from
    18  // the `utf16_unicode_520_ci` collation.
    19  func Utf16_unicode_520_ci_RuneWeight(r rune) int32 {
    20  	weight, ok := common_utf_unicode_520_ci_Weights()[r]
    21  	if ok {
    22  		return weight
    23  	} else if r >= 9003 && r <= 9192 {
    24  		return r - 7758
    25  	} else if r >= 9475 && r <= 9632 {
    26  		return r - 7987
    27  	} else if r >= 9676 && r <= 9775 {
    28  		return r - 7987
    29  	} else if r >= 10496 && r <= 10626 {
    30  		return r - 8321
    31  	} else if r >= 10765 && r <= 10867 {
    32  		return r - 8346
    33  	} else if r >= 10872 && r <= 10971 {
    34  		return r - 8349
    35  	} else if r >= 10974 && r <= 11084 {
    36  		return r - 8350
    37  	} else if r >= 10240 && r <= 10495 {
    38  		return r - 7489
    39  	} else if r >= 118784 && r <= 119029 {
    40  		return r - 115474
    41  	} else if r >= 127024 && r <= 127123 {
    42  		return r - 123185
    43  	} else if r >= 5121 && r <= 5499 {
    44  		return r + 3811
    45  	} else if r >= 5543 && r <= 5740 {
    46  		return r + 3819
    47  	} else if r >= 40960 && r <= 42124 {
    48  		return r - 30284
    49  	} else if r >= 65664 && r <= 65786 {
    50  		return r - 53409
    51  	} else if r >= 73728 && r <= 74606 {
    52  		return r - 61076
    53  	} else if r >= 77825 && r <= 78894 {
    54  		return r - 64293
    55  	} else if r >= 22900 && r <= 23000 {
    56  		return r - 5365
    57  	} else if r >= 25797 && r <= 25902 {
    58  		return r - 5364
    59  	} else if r >= 26793 && r <= 26900 {
    60  		return r - 5361
    61  	} else if r >= 27156 && r <= 27304 {
    62  		return r - 5361
    63  	} else if r >= 31521 && r <= 31630 {
    64  		return r - 5361
    65  	} else if r >= 31690 && r <= 31806 {
    66  		return r - 5361
    67  	} else if r >= 32415 && r <= 32565 {
    68  		return r - 5361
    69  	} else if r >= 33087 && r <= 33240 {
    70  		return r - 5361
    71  	} else if r >= 33880 && r <= 34030 {
    72  		return r - 5361
    73  	} else if r >= 34149 && r <= 34253 {
    74  		return r - 5361
    75  	} else if r >= 35328 && r <= 35488 {
    76  		return r - 5361
    77  	} else if r >= 35744 && r <= 35894 {
    78  		return r - 5361
    79  	} else if r >= 36337 && r <= 36522 {
    80  		return r - 5361
    81  	} else if r >= 36791 && r <= 36899 {
    82  		return r - 5361
    83  	} else if r >= 37707 && r <= 37881 {
    84  		return r - 5361
    85  	} else if r >= 37910 && r <= 38020 {
    86  		return r - 5361
    87  	} else if r >= 38021 && r <= 38262 {
    88  		return r - 5361
    89  	} else if r >= 39423 && r <= 39530 {
    90  		return r - 5361
    91  	} else if r >= 39792 && r <= 40000 {
    92  		return r - 5361
    93  	} else if r >= 40060 && r <= 40164 {
    94  		return r - 5361
    95  	} else if r >= 40190 && r <= 40295 {
    96  		return r - 5361
    97  	} else if r >= 13312 && r <= 13470 {
    98  		return r + 22209
    99  	} else if r >= 13590 && r <= 14062 {
   100  		return r + 22209
   101  	} else if r >= 14077 && r <= 14209 {
   102  		return r + 22209
   103  	} else if r >= 14210 && r <= 14383 {
   104  		return r + 22209
   105  	} else if r >= 14651 && r <= 14894 {
   106  		return r + 22209
   107  	} else if r >= 14957 && r <= 15076 {
   108  		return r + 22209
   109  	} else if r >= 15262 && r <= 15384 {
   110  		return r + 22209
   111  	} else if r >= 15439 && r <= 15667 {
   112  		return r + 22209
   113  	} else if r >= 15767 && r <= 16044 {
   114  		return r + 22209
   115  	} else if r >= 16156 && r <= 16380 {
   116  		return r + 22209
   117  	} else if r >= 16688 && r <= 16898 {
   118  		return r + 22209
   119  	} else if r >= 16936 && r <= 17056 {
   120  		return r + 22209
   121  	} else if r >= 17242 && r <= 17365 {
   122  		return r + 22209
   123  	} else if r >= 17516 && r <= 17707 {
   124  		return r + 22209
   125  	} else if r >= 17772 && r <= 17879 {
   126  		return r + 22209
   127  	} else if r >= 17974 && r <= 18110 {
   128  		return r + 22209
   129  	} else if r >= 18120 && r <= 18837 {
   130  		return r + 22209
   131  	} else if r >= 18919 && r <= 19054 {
   132  		return r + 22209
   133  	} else if r >= 19123 && r <= 19251 {
   134  		return r + 22209
   135  	} else if r >= 19252 && r <= 19406 {
   136  		return r + 22209
   137  	} else if r >= 19407 && r <= 19662 {
   138  		return r + 22209
   139  	} else if r >= 2111 && r <= 2303 {
   140  		return r + 40187
   141  	} else if r >= 11098 && r <= 11263 {
   142  		return r + 32639
   143  	} else if r >= 42893 && r <= 43002 {
   144  		return r + 1384
   145  	} else if r >= 43744 && r <= 43967 {
   146  		return r + 772
   147  	} else if r >= 44026 && r <= 55215 {
   148  		return r + 716
   149  	} else if r >= 57344 && r <= 63743 {
   150  		return r - 1404
   151  	} else if r >= 66046 && r <= 66175 {
   152  		return r - 3390
   153  	} else if r >= 66730 && r <= 67583 {
   154  		return r - 3779
   155  	} else if r >= 67680 && r <= 67839 {
   156  		return r - 3865
   157  	} else if r >= 67904 && r <= 68095 {
   158  		return r - 3921
   159  	} else if r >= 68224 && r <= 68351 {
   160  		return r - 4018
   161  	} else if r >= 68480 && r <= 68607 {
   162  		return r - 4136
   163  	} else if r >= 68682 && r <= 69215 {
   164  		return r - 4209
   165  	} else if r >= 69248 && r <= 69759 {
   166  		return r - 4240
   167  	} else if r >= 69827 && r <= 73727 {
   168  		return r - 4306
   169  	} else if r >= 74608 && r <= 74751 {
   170  		return r - 5185
   171  	} else if r >= 74868 && r <= 77823 {
   172  		return r - 5288
   173  	} else if r >= 78896 && r <= 118783 {
   174  		return r - 6359
   175  	} else if r >= 119366 && r <= 119551 {
   176  		return r - 6895
   177  	} else if r >= 119666 && r <= 119807 {
   178  		return r - 7000
   179  	} else if r >= 120832 && r <= 126975 {
   180  		return r - 7996
   181  	} else if r >= 127124 && r <= 127231 {
   182  		return r - 8140
   183  	} else if r >= 127377 && r <= 127487 {
   184  		return r - 8203
   185  	} else if r >= 127561 && r <= 194559 {
   186  		return r - 8247
   187  	} else if r >= 195103 && r <= 917504 {
   188  		return r - 8789
   189  	} else if r >= 917632 && r <= 917759 {
   190  		return r - 8886
   191  	} else if r >= 918001 && r <= 1114111 {
   192  		return r - 9126
   193  	} else if r >= 917760 && r <= 917999 {
   194  		return 9
   195  	} else {
   196  		return 2147483647
   197  	}
   198  }