github.com/dolthub/go-mysql-server@v0.18.0/sql/encodings/utf8mb4_tr_0900_as_cs.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  // Utf8mb4_tr_0900_as_cs_RuneWeight returns the weight of a given rune based on its relational sort order from
    18  // the `utf8mb4_tr_0900_as_cs` collation.
    19  func Utf8mb4_tr_0900_as_cs_RuneWeight(r rune) int32 {
    20  	weight, ok := utf8mb4_tr_0900_as_cs_Weights()[r]
    21  	if ok {
    22  		return weight
    23  	} else if r >= 9003 && r <= 9214 {
    24  		return r - 7093
    25  	} else if r >= 9475 && r <= 9632 {
    26  		return r - 7299
    27  	} else if r >= 9676 && r <= 9775 {
    28  		return r - 7297
    29  	} else if r >= 9872 && r <= 9983 {
    30  		return r - 7314
    31  	} else if r >= 9984 && r <= 10087 {
    32  		return r - 7288
    33  	} else if r >= 10496 && r <= 10626 {
    34  		return r - 7600
    35  	} else if r >= 10765 && r <= 10867 {
    36  		return r - 7629
    37  	} else if r >= 10872 && r <= 10971 {
    38  		return r - 7632
    39  	} else if r >= 10974 && r <= 11123 {
    40  		return r - 7632
    41  	} else if r >= 10240 && r <= 10495 {
    42  		return r - 6652
    43  	} else if r >= 118784 && r <= 119029 {
    44  		return r - 114626
    45  	} else if r >= 127024 && r <= 127123 {
    46  		return r - 122325
    47  	} else if r >= 127744 && r <= 128511 {
    48  		return r - 122863
    49  	} else if r >= 128512 && r <= 128722 {
    50  		return r - 122781
    51  	} else if r >= 128768 && r <= 128883 {
    52  		return r - 122806
    53  	} else if r >= 120832 && r <= 121343 {
    54  		return r - 114521
    55  	} else if r >= 5121 && r <= 5499 {
    56  		return r + 10862
    57  	} else if r >= 5543 && r <= 5740 {
    58  		return r + 10870
    59  	} else if r >= 92160 && r <= 92728 {
    60  		return r - 74816
    61  	} else if r >= 124928 && r <= 125124 {
    62  		return r - 106985
    63  	} else if r >= 44033 && r <= 44619 {
    64  		return r - 25819
    65  	} else if r >= 44620 && r <= 45207 {
    66  		return r - 25816
    67  	} else if r >= 45209 && r <= 45795 {
    68  		return r - 25811
    69  	} else if r >= 45797 && r <= 46383 {
    70  		return r - 25806
    71  	} else if r >= 46384 && r <= 46971 {
    72  		return r - 25803
    73  	} else if r >= 46973 && r <= 47559 {
    74  		return r - 25798
    75  	} else if r >= 47561 && r <= 48147 {
    76  		return r - 25793
    77  	} else if r >= 48149 && r <= 48735 {
    78  		return r - 25788
    79  	} else if r >= 48736 && r <= 49323 {
    80  		return r - 25785
    81  	} else if r >= 49325 && r <= 49911 {
    82  		return r - 25780
    83  	} else if r >= 49912 && r <= 50499 {
    84  		return r - 25777
    85  	} else if r >= 50501 && r <= 50864 {
    86  		return r - 25772
    87  	} else if r >= 50865 && r <= 51087 {
    88  		return r - 25771
    89  	} else if r >= 51089 && r <= 51452 {
    90  		return r - 25766
    91  	} else if r >= 51453 && r <= 51675 {
    92  		return r - 25765
    93  	} else if r >= 51676 && r <= 52263 {
    94  		return r - 25762
    95  	} else if r >= 52281 && r <= 52851 {
    96  		return r - 25756
    97  	} else if r >= 52853 && r <= 53439 {
    98  		return r - 25751
    99  	} else if r >= 53441 && r <= 54027 {
   100  		return r - 25746
   101  	} else if r >= 54029 && r <= 54615 {
   102  		return r - 25741
   103  	} else if r >= 54617 && r <= 55203 {
   104  		return r - 25736
   105  	} else if r >= 40960 && r <= 42124 {
   106  		return r - 10574
   107  	} else if r >= 113664 && r <= 113770 {
   108  		return r - 81431
   109  	} else if r >= 65664 && r <= 65786 {
   110  		return r - 33026
   111  	} else if r >= 67073 && r <= 67382 {
   112  		return r - 34311
   113  	} else if r >= 73728 && r <= 74338 {
   114  		return r - 40192
   115  	} else if r >= 74339 && r <= 74451 {
   116  		return r - 40190
   117  	} else if r >= 74455 && r <= 74649 {
   118  		return r - 40192
   119  	} else if r >= 74881 && r <= 75075 {
   120  		return r - 40422
   121  	} else if r >= 77825 && r <= 78894 {
   122  		return r - 43170
   123  	} else if r >= 82944 && r <= 83526 {
   124  		return r - 47161
   125  	} else if r >= 94209 && r <= 101119 {
   126  		return r - 57842
   127  	} else if r >= 22900 && r <= 23000 {
   128  		return r + 23422
   129  	} else if r >= 25797 && r <= 25903 {
   130  		return r + 23473
   131  	} else if r >= 26793 && r <= 26900 {
   132  		return r + 23502
   133  	} else if r >= 27156 && r <= 27304 {
   134  		return r + 23502
   135  	} else if r >= 31521 && r <= 31631 {
   136  		return r + 23579
   137  	} else if r >= 31690 && r <= 31806 {
   138  		return r + 23580
   139  	} else if r >= 32416 && r <= 32566 {
   140  		return r + 23585
   141  	} else if r >= 33087 && r <= 33240 {
   142  		return r + 23607
   143  	} else if r >= 33880 && r <= 34030 {
   144  		return r + 23621
   145  	} else if r >= 34149 && r <= 34253 {
   146  		return r + 23621
   147  	} else if r >= 35329 && r <= 35488 {
   148  		return r + 23637
   149  	} else if r >= 35745 && r <= 35895 {
   150  		return r + 23638
   151  	} else if r >= 36337 && r <= 36523 {
   152  		return r + 23652
   153  	} else if r >= 36791 && r <= 36899 {
   154  		return r + 23661
   155  	} else if r >= 37707 && r <= 37881 {
   156  		return r + 23671
   157  	} else if r >= 37910 && r <= 38021 {
   158  		return r + 23671
   159  	} else if r >= 38022 && r <= 38263 {
   160  		return r + 23672
   161  	} else if r >= 39423 && r <= 39530 {
   162  		return r + 23708
   163  	} else if r >= 39792 && r <= 40000 {
   164  		return r + 23719
   165  	} else if r >= 40061 && r <= 40165 {
   166  		return r + 23720
   167  	} else if r >= 40190 && r <= 40295 {
   168  		return r + 23721
   169  	} else if r >= 13312 && r <= 13470 {
   170  		return r + 51371
   171  	} else if r >= 13590 && r <= 14062 {
   172  		return r + 51371
   173  	} else if r >= 14077 && r <= 14209 {
   174  		return r + 51371
   175  	} else if r >= 14210 && r <= 14383 {
   176  		return r + 51371
   177  	} else if r >= 14651 && r <= 14894 {
   178  		return r + 51371
   179  	} else if r >= 14957 && r <= 15076 {
   180  		return r + 51371
   181  	} else if r >= 15262 && r <= 15384 {
   182  		return r + 51371
   183  	} else if r >= 15439 && r <= 15667 {
   184  		return r + 51371
   185  	} else if r >= 15767 && r <= 16044 {
   186  		return r + 51371
   187  	} else if r >= 16156 && r <= 16380 {
   188  		return r + 51371
   189  	} else if r >= 16688 && r <= 16898 {
   190  		return r + 51371
   191  	} else if r >= 16936 && r <= 17056 {
   192  		return r + 51371
   193  	} else if r >= 17242 && r <= 17365 {
   194  		return r + 51371
   195  	} else if r >= 17516 && r <= 17707 {
   196  		return r + 51371
   197  	} else if r >= 17772 && r <= 17879 {
   198  		return r + 51371
   199  	} else if r >= 17974 && r <= 18110 {
   200  		return r + 51371
   201  	} else if r >= 18120 && r <= 18837 {
   202  		return r + 51371
   203  	} else if r >= 18919 && r <= 19054 {
   204  		return r + 51371
   205  	} else if r >= 19123 && r <= 19251 {
   206  		return r + 51371
   207  	} else if r >= 19252 && r <= 19406 {
   208  		return r + 51371
   209  	} else if r >= 19407 && r <= 19662 {
   210  		return r + 51371
   211  	} else if r >= 131072 && r <= 131362 {
   212  		return r - 59807
   213  	} else if r >= 131363 && r <= 132380 {
   214  		return r - 59807
   215  	} else if r >= 132428 && r <= 132666 {
   216  		return r - 59807
   217  	} else if r >= 132667 && r <= 133124 {
   218  		return r - 59807
   219  	} else if r >= 133125 && r <= 133342 {
   220  		return r - 59807
   221  	} else if r >= 133343 && r <= 133676 {
   222  		return r - 59807
   223  	} else if r >= 133677 && r <= 133987 {
   224  		return r - 59807
   225  	} else if r >= 133988 && r <= 136420 {
   226  		return r - 59807
   227  	} else if r >= 136421 && r <= 136872 {
   228  		return r - 59807
   229  	} else if r >= 136939 && r <= 137672 {
   230  		return r - 59807
   231  	} else if r >= 137673 && r <= 138008 {
   232  		return r - 59807
   233  	} else if r >= 138009 && r <= 138507 {
   234  		return r - 59807
   235  	} else if r >= 138508 && r <= 138724 {
   236  		return r - 59807
   237  	} else if r >= 138727 && r <= 139651 {
   238  		return r - 59807
   239  	} else if r >= 139680 && r <= 140081 {
   240  		return r - 59807
   241  	} else if r >= 140082 && r <= 141012 {
   242  		return r - 59807
   243  	} else if r >= 141013 && r <= 141379 {
   244  		return r - 59807
   245  	} else if r >= 141386 && r <= 142092 {
   246  		return r - 59807
   247  	} else if r >= 142093 && r <= 142321 {
   248  		return r - 59807
   249  	} else if r >= 142322 && r <= 143370 {
   250  		return r - 59807
   251  	} else if r >= 143371 && r <= 144056 {
   252  		return r - 59807
   253  	} else if r >= 144057 && r <= 144223 {
   254  		return r - 59807
   255  	} else if r >= 144341 && r <= 144493 {
   256  		return r - 59807
   257  	} else if r >= 144494 && r <= 145059 {
   258  		return r - 59807
   259  	} else if r >= 145060 && r <= 145575 {
   260  		return r - 59807
   261  	} else if r >= 145576 && r <= 146061 {
   262  		return r - 59807
   263  	} else if r >= 146062 && r <= 146170 {
   264  		return r - 59807
   265  	} else if r >= 146171 && r <= 146620 {
   266  		return r - 59807
   267  	} else if r >= 146719 && r <= 147153 {
   268  		return r - 59807
   269  	} else if r >= 147154 && r <= 147294 {
   270  		return r - 59807
   271  	} else if r >= 147343 && r <= 148067 {
   272  		return r - 59807
   273  	} else if r >= 148068 && r <= 148205 {
   274  		return r - 59807
   275  	} else if r >= 148206 && r <= 148395 {
   276  		return r - 59807
   277  	} else if r >= 148396 && r <= 149000 {
   278  		return r - 59807
   279  	} else if r >= 149001 && r <= 149301 {
   280  		return r - 59807
   281  	} else if r >= 149302 && r <= 149524 {
   282  		return r - 59807
   283  	} else if r >= 149525 && r <= 150582 {
   284  		return r - 59807
   285  	} else if r >= 150675 && r <= 151457 {
   286  		return r - 59807
   287  	} else if r >= 151481 && r <= 151620 {
   288  		return r - 59807
   289  	} else if r >= 151621 && r <= 151794 {
   290  		return r - 59807
   291  	} else if r >= 151860 && r <= 152136 {
   292  		return r - 59807
   293  	} else if r >= 152137 && r <= 152605 {
   294  		return r - 59807
   295  	} else if r >= 152606 && r <= 153126 {
   296  		return r - 59807
   297  	} else if r >= 153127 && r <= 153242 {
   298  		return r - 59807
   299  	} else if r >= 153286 && r <= 153980 {
   300  		return r - 59807
   301  	} else if r >= 153981 && r <= 154279 {
   302  		return r - 59807
   303  	} else if r >= 154280 && r <= 154539 {
   304  		return r - 59807
   305  	} else if r >= 154540 && r <= 154752 {
   306  		return r - 59807
   307  	} else if r >= 154832 && r <= 155526 {
   308  		return r - 59807
   309  	} else if r >= 155527 && r <= 156122 {
   310  		return r - 59807
   311  	} else if r >= 156232 && r <= 156377 {
   312  		return r - 59807
   313  	} else if r >= 156378 && r <= 156478 {
   314  		return r - 59807
   315  	} else if r >= 156479 && r <= 156890 {
   316  		return r - 59807
   317  	} else if r >= 156964 && r <= 157096 {
   318  		return r - 59807
   319  	} else if r >= 157097 && r <= 157607 {
   320  		return r - 59807
   321  	} else if r >= 157622 && r <= 158524 {
   322  		return r - 59807
   323  	} else if r >= 158525 && r <= 158774 {
   324  		return r - 59807
   325  	} else if r >= 158775 && r <= 158933 {
   326  		return r - 59807
   327  	} else if r >= 158934 && r <= 159083 {
   328  		return r - 59807
   329  	} else if r >= 159084 && r <= 159532 {
   330  		return r - 59807
   331  	} else if r >= 159533 && r <= 159665 {
   332  		return r - 59807
   333  	} else if r >= 159666 && r <= 159954 {
   334  		return r - 59807
   335  	} else if r >= 159955 && r <= 160714 {
   336  		return r - 59807
   337  	} else if r >= 160715 && r <= 161383 {
   338  		return r - 59807
   339  	} else if r >= 161384 && r <= 161966 {
   340  		return r - 59807
   341  	} else if r >= 161967 && r <= 162150 {
   342  		return r - 59807
   343  	} else if r >= 162151 && r <= 162984 {
   344  		return r - 59807
   345  	} else if r >= 162985 && r <= 163538 {
   346  		return r - 59807
   347  	} else if r >= 163632 && r <= 165330 {
   348  		return r - 59807
   349  	} else if r >= 165358 && r <= 165678 {
   350  		return r - 59807
   351  	} else if r >= 165679 && r <= 166906 {
   352  		return r - 59807
   353  	} else if r >= 166907 && r <= 167287 {
   354  		return r - 59807
   355  	} else if r >= 167288 && r <= 168261 {
   356  		return r - 59807
   357  	} else if r >= 168262 && r <= 168415 {
   358  		return r - 59807
   359  	} else if r >= 168475 && r <= 168970 {
   360  		return r - 59807
   361  	} else if r >= 168971 && r <= 169110 {
   362  		return r - 59807
   363  	} else if r >= 169111 && r <= 169398 {
   364  		return r - 59807
   365  	} else if r >= 169399 && r <= 170800 {
   366  		return r - 59807
   367  	} else if r >= 170801 && r <= 172238 {
   368  		return r - 59807
   369  	} else if r >= 172294 && r <= 172558 {
   370  		return r - 59807
   371  	} else if r >= 172559 && r <= 172689 {
   372  		return r - 59807
   373  	} else if r >= 172690 && r <= 172946 {
   374  		return r - 59807
   375  	} else if r >= 172947 && r <= 173568 {
   376  		return r - 59807
   377  	} else if r >= 173569 && r <= 173782 {
   378  		return r - 59807
   379  	} else if r >= 173825 && r <= 177972 {
   380  		return r - 59848
   381  	} else if r >= 177985 && r <= 178205 {
   382  		return r - 59859
   383  	} else if r >= 178209 && r <= 183969 {
   384  		return r - 59861
   385  	} else if r >= 57344 && r <= 63743 {
   386  		return r + 68424
   387  	} else if r >= 66046 && r <= 66175 {
   388  		return r + 66406
   389  	} else if r >= 66928 && r <= 67071 {
   390  		return r + 65780
   391  	} else if r >= 67432 && r <= 67583 {
   392  		return r + 65439
   393  	} else if r >= 68864 && r <= 69215 {
   394  		return r + 64569
   395  	} else if r >= 69248 && r <= 69631 {
   396  		return r + 64538
   397  	} else if r >= 70517 && r <= 70655 {
   398  		return r + 63854
   399  	} else if r >= 70874 && r <= 71039 {
   400  		return r + 63680
   401  	} else if r >= 71488 && r <= 71839 {
   402  		return r + 63373
   403  	} else if r >= 71936 && r <= 72383 {
   404  		return r + 63289
   405  	} else if r >= 72442 && r <= 72703 {
   406  		return r + 63232
   407  	} else if r >= 72887 && r <= 73727 {
   408  		return r + 63067
   409  	} else if r >= 74651 && r <= 74751 {
   410  		return r + 62145
   411  	} else if r >= 75076 && r <= 77823 {
   412  		return r + 61833
   413  	} else if r >= 78896 && r <= 82943 {
   414  		return r + 60762
   415  	} else if r >= 83528 && r <= 92159 {
   416  		return r + 60179
   417  	} else if r >= 93072 && r <= 93951 {
   418  		return r + 59404
   419  	} else if r >= 101120 && r <= 110591 {
   420  		return r + 52358
   421  	} else if r >= 110595 && r <= 113663 {
   422  		return r + 52356
   423  	} else if r >= 113828 && r <= 118783 {
   424  		return r + 52209
   425  	} else if r >= 119366 && r <= 119551 {
   426  		return r + 51662
   427  	} else if r >= 119666 && r <= 119807 {
   428  		return r + 51557
   429  	} else if r >= 121520 && r <= 122879 {
   430  		return r + 49889
   431  	} else if r >= 122923 && r <= 124927 {
   432  		return r + 49851
   433  	} else if r >= 125280 && r <= 126463 {
   434  		return r + 49551
   435  	} else if r >= 126706 && r <= 126975 {
   436  		return r + 49408
   437  	} else if r >= 127570 && r <= 127743 {
   438  		return r + 48933
   439  	} else if r >= 129473 && r <= 131071 {
   440  		return r + 47503
   441  	} else if r >= 183970 && r <= 194559 {
   442  		return r - 5341
   443  	} else if r >= 195103 && r <= 917504 {
   444  		return r - 5883
   445  	} else if r >= 917632 && r <= 917759 {
   446  		return r - 5980
   447  	} else if r >= 918001 && r <= 1114111 {
   448  		return r - 6220
   449  	} else if r >= 917760 && r <= 917999 {
   450  		return 0
   451  	} else {
   452  		return 2147483647
   453  	}
   454  }