MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / set_implicit_weights

Function set_implicit_weights

strings/uca-dump.c:239–282  ·  view source on GitHub ↗

We need to initialize implicit weights because some pages have both implicit and explicit weights: 0x4D??, 0x9F?? */

Source from the content-addressed store, hash-verified

237 0x4D??, 0x9F??
238*/
239static void
240set_implicit_weights(MY_UCA *uca, size_t maxchar)
241{
242 size_t code;
243 /* Now set implicit weights */
244 for (code= 0; code < maxchar; code++)
245 {
246 size_t base, aaaa, bbbb;
247 MY_UCA_ITEM *item= &uca->item[code];
248
249 if (item->num)
250 continue;
251
252 /*
253 3400;<CJK Ideograph Extension A, First>
254 4DB5;<CJK Ideograph Extension A, Last>
255 4E00;<CJK Ideograph, First>
256 9FA5;<CJK Ideograph, Last>
257 */
258
259 if (code >= 0x3400 && code <= 0x4DB5)
260 base= 0xFB80;
261 else if (code >= 0x4E00 && code <= 0x9FA5)
262 base= 0xFB40;
263 else
264 base= 0xFBC0;
265
266 aaaa= base + (code >> 15);
267 bbbb= (code & 0x7FFF) | 0x8000;
268 item->weight[0][0]= aaaa;
269 item->weight[0][1]= bbbb;
270
271 item->weight[1][0]= 0x0020;
272 item->weight[1][1]= 0x0000;
273
274 item->weight[2][0]= 0x0002;
275 item->weight[2][1]= 0x0000;
276
277 item->weight[3][0]= 0x0001;
278 item->weight[3][2]= 0x0000;
279
280 item->num= 2;
281 }
282}
283
284
285static void

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected