106c3fb27SDimitry Andric // -*- C++ -*- 206c3fb27SDimitry Andric //===----------------------------------------------------------------------===// 306c3fb27SDimitry Andric // 406c3fb27SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 506c3fb27SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 606c3fb27SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 706c3fb27SDimitry Andric // 806c3fb27SDimitry Andric //===----------------------------------------------------------------------===// 906c3fb27SDimitry Andric 1006c3fb27SDimitry Andric // WARNING, this entire header is generated by 1106c3fb27SDimitry Andric // utils/generate_width_estimation_table.py 1206c3fb27SDimitry Andric // DO NOT MODIFY! 1306c3fb27SDimitry Andric 1406c3fb27SDimitry Andric // UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE 1506c3fb27SDimitry Andric // 1606c3fb27SDimitry Andric // See Terms of Use <https://www.unicode.org/copyright.html> 1706c3fb27SDimitry Andric // for definitions of Unicode Inc.'s Data Files and Software. 1806c3fb27SDimitry Andric // 1906c3fb27SDimitry Andric // NOTICE TO USER: Carefully read the following legal agreement. 2006c3fb27SDimitry Andric // BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S 2106c3fb27SDimitry Andric // DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"), 2206c3fb27SDimitry Andric // YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE 2306c3fb27SDimitry Andric // TERMS AND CONDITIONS OF THIS AGREEMENT. 2406c3fb27SDimitry Andric // IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE 2506c3fb27SDimitry Andric // THE DATA FILES OR SOFTWARE. 2606c3fb27SDimitry Andric // 2706c3fb27SDimitry Andric // COPYRIGHT AND PERMISSION NOTICE 2806c3fb27SDimitry Andric // 2906c3fb27SDimitry Andric // Copyright (c) 1991-2022 Unicode, Inc. All rights reserved. 3006c3fb27SDimitry Andric // Distributed under the Terms of Use in https://www.unicode.org/copyright.html. 3106c3fb27SDimitry Andric // 3206c3fb27SDimitry Andric // Permission is hereby granted, free of charge, to any person obtaining 3306c3fb27SDimitry Andric // a copy of the Unicode data files and any associated documentation 3406c3fb27SDimitry Andric // (the "Data Files") or Unicode software and any associated documentation 3506c3fb27SDimitry Andric // (the "Software") to deal in the Data Files or Software 3606c3fb27SDimitry Andric // without restriction, including without limitation the rights to use, 3706c3fb27SDimitry Andric // copy, modify, merge, publish, distribute, and/or sell copies of 3806c3fb27SDimitry Andric // the Data Files or Software, and to permit persons to whom the Data Files 3906c3fb27SDimitry Andric // or Software are furnished to do so, provided that either 4006c3fb27SDimitry Andric // (a) this copyright and permission notice appear with all copies 4106c3fb27SDimitry Andric // of the Data Files or Software, or 4206c3fb27SDimitry Andric // (b) this copyright and permission notice appear in associated 4306c3fb27SDimitry Andric // Documentation. 4406c3fb27SDimitry Andric // 4506c3fb27SDimitry Andric // THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF 4606c3fb27SDimitry Andric // ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 4706c3fb27SDimitry Andric // WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 4806c3fb27SDimitry Andric // NONINFRINGEMENT OF THIRD PARTY RIGHTS. 4906c3fb27SDimitry Andric // IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS 5006c3fb27SDimitry Andric // NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL 5106c3fb27SDimitry Andric // DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 5206c3fb27SDimitry Andric // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 5306c3fb27SDimitry Andric // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 5406c3fb27SDimitry Andric // PERFORMANCE OF THE DATA FILES OR SOFTWARE. 5506c3fb27SDimitry Andric // 5606c3fb27SDimitry Andric // Except as contained in this notice, the name of a copyright holder 5706c3fb27SDimitry Andric // shall not be used in advertising or otherwise to promote the sale, 5806c3fb27SDimitry Andric // use or other dealings in these Data Files or Software without prior 5906c3fb27SDimitry Andric // written authorization of the copyright holder. 6006c3fb27SDimitry Andric 6106c3fb27SDimitry Andric #ifndef _LIBCPP___FORMAT_WIDTH_ESTIMATION_TABLE_H 6206c3fb27SDimitry Andric #define _LIBCPP___FORMAT_WIDTH_ESTIMATION_TABLE_H 6306c3fb27SDimitry Andric 6406c3fb27SDimitry Andric #include <__algorithm/ranges_upper_bound.h> 6506c3fb27SDimitry Andric #include <__config> 6606c3fb27SDimitry Andric #include <cstddef> 6706c3fb27SDimitry Andric #include <cstdint> 6806c3fb27SDimitry Andric 6906c3fb27SDimitry Andric #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 7006c3fb27SDimitry Andric # pragma GCC system_header 7106c3fb27SDimitry Andric #endif 7206c3fb27SDimitry Andric 7306c3fb27SDimitry Andric _LIBCPP_BEGIN_NAMESPACE_STD 7406c3fb27SDimitry Andric 7506c3fb27SDimitry Andric #if _LIBCPP_STD_VER >= 20 7606c3fb27SDimitry Andric 7706c3fb27SDimitry Andric namespace __width_estimation_table { 7806c3fb27SDimitry Andric 7906c3fb27SDimitry Andric /// The entries of the characters with an estimated width of 2. 8006c3fb27SDimitry Andric /// 8106c3fb27SDimitry Andric /// Contains the entries for [format.string.std]/12 8206c3fb27SDimitry Andric /// - Any code point with the East_Asian_Width="W" or East_Asian_Width="F" 8306c3fb27SDimitry Andric /// Derived Extracted Property as described by UAX #44 8406c3fb27SDimitry Andric /// - U+4DC0 - U+4DFF (Yijing Hexagram Symbols) 8506c3fb27SDimitry Andric /// - U+1F300 - U+1F5FF (Miscellaneous Symbols and Pictographs) 8606c3fb27SDimitry Andric /// - U+1F900 - U+1F9FF (Supplemental Symbols and Pictographs) 8706c3fb27SDimitry Andric /// 8806c3fb27SDimitry Andric /// The data is generated from 8906c3fb27SDimitry Andric /// - https://www.unicode.org/Public/UCD/latest/ucd/EastAsianWidth.txt 9006c3fb27SDimitry Andric /// - The "overrides" in [format.string.std]/12 9106c3fb27SDimitry Andric /// 9206c3fb27SDimitry Andric /// The format of EastAsianWidth.txt is two fields separated by a semicolon. 9306c3fb27SDimitry Andric /// Field 0: Unicode code point value or range of code point values 9406c3fb27SDimitry Andric /// Field 1: East_Asian_Width property, consisting of one of the following values: 9506c3fb27SDimitry Andric /// "A", "F", "H", "N", "Na", "W" 9606c3fb27SDimitry Andric /// - All code points, assigned or unassigned, that are not listed 9706c3fb27SDimitry Andric /// explicitly are given the value "N". 9806c3fb27SDimitry Andric /// - The unassigned code points in the following blocks default to "W": 9906c3fb27SDimitry Andric /// CJK Unified Ideographs Extension A: U+3400..U+4DBF 10006c3fb27SDimitry Andric /// CJK Unified Ideographs: U+4E00..U+9FFF 10106c3fb27SDimitry Andric /// CJK Compatibility Ideographs: U+F900..U+FAFF 10206c3fb27SDimitry Andric /// - All undesignated code points in Planes 2 and 3, whether inside or 10306c3fb27SDimitry Andric /// outside of allocated blocks, default to "W": 10406c3fb27SDimitry Andric /// Plane 2: U+20000..U+2FFFD 10506c3fb27SDimitry Andric /// Plane 3: U+30000..U+3FFFD 10606c3fb27SDimitry Andric /// 10706c3fb27SDimitry Andric /// The table is similar to the table 10806c3fb27SDimitry Andric /// __extended_grapheme_custer_property_boundary::__entries 10906c3fb27SDimitry Andric /// which explains the details of these classes. The only difference is this 11006c3fb27SDimitry Andric /// table lacks a property, thus having more bits available for the size. 11106c3fb27SDimitry Andric /// 11206c3fb27SDimitry Andric /// The maximum code point that has an estimated width of 2 is U+3FFFD. This 11306c3fb27SDimitry Andric /// value can be encoded in 18 bits. Thus the upper 3 bits of the code point 11406c3fb27SDimitry Andric /// are always 0. These 3 bits are used to enlarge the offset range. This 11506c3fb27SDimitry Andric /// optimization reduces the table in Unicode 15 from 184 to 104 entries, 11606c3fb27SDimitry Andric /// saving 320 bytes. 11706c3fb27SDimitry Andric /// 11806c3fb27SDimitry Andric /// The data has 2 values: 11906c3fb27SDimitry Andric /// - bits [0, 13] The size of the range, allowing 16384 elements. 12006c3fb27SDimitry Andric /// - bits [14, 31] The lower bound code point of the range. The upper bound of 12106c3fb27SDimitry Andric /// the range is lower bound + size. 122*0fca6ea1SDimitry Andric _LIBCPP_HIDE_FROM_ABI inline constexpr uint32_t __entries[107] = { 12306c3fb27SDimitry Andric 0x0440005f /* 00001100 - 0000115f [ 96] */, // 12406c3fb27SDimitry Andric 0x08c68001 /* 0000231a - 0000231b [ 2] */, // 12506c3fb27SDimitry Andric 0x08ca4001 /* 00002329 - 0000232a [ 2] */, // 12606c3fb27SDimitry Andric 0x08fa4003 /* 000023e9 - 000023ec [ 4] */, // 12706c3fb27SDimitry Andric 0x08fc0000 /* 000023f0 - 000023f0 [ 1] */, // 12806c3fb27SDimitry Andric 0x08fcc000 /* 000023f3 - 000023f3 [ 1] */, // 12906c3fb27SDimitry Andric 0x097f4001 /* 000025fd - 000025fe [ 2] */, // 13006c3fb27SDimitry Andric 0x09850001 /* 00002614 - 00002615 [ 2] */, // 13106c3fb27SDimitry Andric 0x0992000b /* 00002648 - 00002653 [ 12] */, // 13206c3fb27SDimitry Andric 0x099fc000 /* 0000267f - 0000267f [ 1] */, // 13306c3fb27SDimitry Andric 0x09a4c000 /* 00002693 - 00002693 [ 1] */, // 13406c3fb27SDimitry Andric 0x09a84000 /* 000026a1 - 000026a1 [ 1] */, // 13506c3fb27SDimitry Andric 0x09aa8001 /* 000026aa - 000026ab [ 2] */, // 13606c3fb27SDimitry Andric 0x09af4001 /* 000026bd - 000026be [ 2] */, // 13706c3fb27SDimitry Andric 0x09b10001 /* 000026c4 - 000026c5 [ 2] */, // 13806c3fb27SDimitry Andric 0x09b38000 /* 000026ce - 000026ce [ 1] */, // 13906c3fb27SDimitry Andric 0x09b50000 /* 000026d4 - 000026d4 [ 1] */, // 14006c3fb27SDimitry Andric 0x09ba8000 /* 000026ea - 000026ea [ 1] */, // 14106c3fb27SDimitry Andric 0x09bc8001 /* 000026f2 - 000026f3 [ 2] */, // 14206c3fb27SDimitry Andric 0x09bd4000 /* 000026f5 - 000026f5 [ 1] */, // 14306c3fb27SDimitry Andric 0x09be8000 /* 000026fa - 000026fa [ 1] */, // 14406c3fb27SDimitry Andric 0x09bf4000 /* 000026fd - 000026fd [ 1] */, // 14506c3fb27SDimitry Andric 0x09c14000 /* 00002705 - 00002705 [ 1] */, // 14606c3fb27SDimitry Andric 0x09c28001 /* 0000270a - 0000270b [ 2] */, // 14706c3fb27SDimitry Andric 0x09ca0000 /* 00002728 - 00002728 [ 1] */, // 14806c3fb27SDimitry Andric 0x09d30000 /* 0000274c - 0000274c [ 1] */, // 14906c3fb27SDimitry Andric 0x09d38000 /* 0000274e - 0000274e [ 1] */, // 15006c3fb27SDimitry Andric 0x09d4c002 /* 00002753 - 00002755 [ 3] */, // 15106c3fb27SDimitry Andric 0x09d5c000 /* 00002757 - 00002757 [ 1] */, // 15206c3fb27SDimitry Andric 0x09e54002 /* 00002795 - 00002797 [ 3] */, // 15306c3fb27SDimitry Andric 0x09ec0000 /* 000027b0 - 000027b0 [ 1] */, // 15406c3fb27SDimitry Andric 0x09efc000 /* 000027bf - 000027bf [ 1] */, // 15506c3fb27SDimitry Andric 0x0ac6c001 /* 00002b1b - 00002b1c [ 2] */, // 15606c3fb27SDimitry Andric 0x0ad40000 /* 00002b50 - 00002b50 [ 1] */, // 15706c3fb27SDimitry Andric 0x0ad54000 /* 00002b55 - 00002b55 [ 1] */, // 15806c3fb27SDimitry Andric 0x0ba00019 /* 00002e80 - 00002e99 [ 26] */, // 15906c3fb27SDimitry Andric 0x0ba6c058 /* 00002e9b - 00002ef3 [ 89] */, // 16006c3fb27SDimitry Andric 0x0bc000d5 /* 00002f00 - 00002fd5 [ 214] */, // 161*0fca6ea1SDimitry Andric 0x0bfc004e /* 00002ff0 - 0000303e [ 79] */, // 16206c3fb27SDimitry Andric 0x0c104055 /* 00003041 - 00003096 [ 86] */, // 16306c3fb27SDimitry Andric 0x0c264066 /* 00003099 - 000030ff [ 103] */, // 16406c3fb27SDimitry Andric 0x0c41402a /* 00003105 - 0000312f [ 43] */, // 16506c3fb27SDimitry Andric 0x0c4c405d /* 00003131 - 0000318e [ 94] */, // 16606c3fb27SDimitry Andric 0x0c640053 /* 00003190 - 000031e3 [ 84] */, // 167*0fca6ea1SDimitry Andric 0x0c7bc02f /* 000031ef - 0000321e [ 48] */, // 16806c3fb27SDimitry Andric 0x0c880027 /* 00003220 - 00003247 [ 40] */, // 16906c3fb27SDimitry Andric 0x0c943fff /* 00003250 - 0000724f [16384] */, // 17006c3fb27SDimitry Andric 0x1c94323c /* 00007250 - 0000a48c [12861] */, // 17106c3fb27SDimitry Andric 0x29240036 /* 0000a490 - 0000a4c6 [ 55] */, // 17206c3fb27SDimitry Andric 0x2a58001c /* 0000a960 - 0000a97c [ 29] */, // 17306c3fb27SDimitry Andric 0x2b002ba3 /* 0000ac00 - 0000d7a3 [11172] */, // 17406c3fb27SDimitry Andric 0x3e4001ff /* 0000f900 - 0000faff [ 512] */, // 17506c3fb27SDimitry Andric 0x3f840009 /* 0000fe10 - 0000fe19 [ 10] */, // 17606c3fb27SDimitry Andric 0x3f8c0022 /* 0000fe30 - 0000fe52 [ 35] */, // 17706c3fb27SDimitry Andric 0x3f950012 /* 0000fe54 - 0000fe66 [ 19] */, // 17806c3fb27SDimitry Andric 0x3f9a0003 /* 0000fe68 - 0000fe6b [ 4] */, // 17906c3fb27SDimitry Andric 0x3fc0405f /* 0000ff01 - 0000ff60 [ 96] */, // 18006c3fb27SDimitry Andric 0x3ff80006 /* 0000ffe0 - 0000ffe6 [ 7] */, // 18106c3fb27SDimitry Andric 0x5bf80004 /* 00016fe0 - 00016fe4 [ 5] */, // 18206c3fb27SDimitry Andric 0x5bfc0001 /* 00016ff0 - 00016ff1 [ 2] */, // 18306c3fb27SDimitry Andric 0x5c0017f7 /* 00017000 - 000187f7 [ 6136] */, // 18406c3fb27SDimitry Andric 0x620004d5 /* 00018800 - 00018cd5 [ 1238] */, // 18506c3fb27SDimitry Andric 0x63400008 /* 00018d00 - 00018d08 [ 9] */, // 18606c3fb27SDimitry Andric 0x6bfc0003 /* 0001aff0 - 0001aff3 [ 4] */, // 18706c3fb27SDimitry Andric 0x6bfd4006 /* 0001aff5 - 0001affb [ 7] */, // 18806c3fb27SDimitry Andric 0x6bff4001 /* 0001affd - 0001affe [ 2] */, // 18906c3fb27SDimitry Andric 0x6c000122 /* 0001b000 - 0001b122 [ 291] */, // 19006c3fb27SDimitry Andric 0x6c4c8000 /* 0001b132 - 0001b132 [ 1] */, // 19106c3fb27SDimitry Andric 0x6c540002 /* 0001b150 - 0001b152 [ 3] */, // 19206c3fb27SDimitry Andric 0x6c554000 /* 0001b155 - 0001b155 [ 1] */, // 19306c3fb27SDimitry Andric 0x6c590003 /* 0001b164 - 0001b167 [ 4] */, // 19406c3fb27SDimitry Andric 0x6c5c018b /* 0001b170 - 0001b2fb [ 396] */, // 19506c3fb27SDimitry Andric 0x7c010000 /* 0001f004 - 0001f004 [ 1] */, // 19606c3fb27SDimitry Andric 0x7c33c000 /* 0001f0cf - 0001f0cf [ 1] */, // 19706c3fb27SDimitry Andric 0x7c638000 /* 0001f18e - 0001f18e [ 1] */, // 19806c3fb27SDimitry Andric 0x7c644009 /* 0001f191 - 0001f19a [ 10] */, // 19906c3fb27SDimitry Andric 0x7c800002 /* 0001f200 - 0001f202 [ 3] */, // 20006c3fb27SDimitry Andric 0x7c84002b /* 0001f210 - 0001f23b [ 44] */, // 20106c3fb27SDimitry Andric 0x7c900008 /* 0001f240 - 0001f248 [ 9] */, // 20206c3fb27SDimitry Andric 0x7c940001 /* 0001f250 - 0001f251 [ 2] */, // 20306c3fb27SDimitry Andric 0x7c980005 /* 0001f260 - 0001f265 [ 6] */, // 20406c3fb27SDimitry Andric 0x7cc0034f /* 0001f300 - 0001f64f [ 848] */, // 20506c3fb27SDimitry Andric 0x7da00045 /* 0001f680 - 0001f6c5 [ 70] */, // 20606c3fb27SDimitry Andric 0x7db30000 /* 0001f6cc - 0001f6cc [ 1] */, // 20706c3fb27SDimitry Andric 0x7db40002 /* 0001f6d0 - 0001f6d2 [ 3] */, // 20806c3fb27SDimitry Andric 0x7db54002 /* 0001f6d5 - 0001f6d7 [ 3] */, // 20906c3fb27SDimitry Andric 0x7db70003 /* 0001f6dc - 0001f6df [ 4] */, // 21006c3fb27SDimitry Andric 0x7dbac001 /* 0001f6eb - 0001f6ec [ 2] */, // 21106c3fb27SDimitry Andric 0x7dbd0008 /* 0001f6f4 - 0001f6fc [ 9] */, // 21206c3fb27SDimitry Andric 0x7df8000b /* 0001f7e0 - 0001f7eb [ 12] */, // 21306c3fb27SDimitry Andric 0x7dfc0000 /* 0001f7f0 - 0001f7f0 [ 1] */, // 21406c3fb27SDimitry Andric 0x7e4000ff /* 0001f900 - 0001f9ff [ 256] */, // 21506c3fb27SDimitry Andric 0x7e9c000c /* 0001fa70 - 0001fa7c [ 13] */, // 21606c3fb27SDimitry Andric 0x7ea00008 /* 0001fa80 - 0001fa88 [ 9] */, // 21706c3fb27SDimitry Andric 0x7ea4002d /* 0001fa90 - 0001fabd [ 46] */, // 21806c3fb27SDimitry Andric 0x7eafc006 /* 0001fabf - 0001fac5 [ 7] */, // 21906c3fb27SDimitry Andric 0x7eb3800d /* 0001face - 0001fadb [ 14] */, // 22006c3fb27SDimitry Andric 0x7eb80008 /* 0001fae0 - 0001fae8 [ 9] */, // 22106c3fb27SDimitry Andric 0x7ebc0008 /* 0001faf0 - 0001faf8 [ 9] */, // 22206c3fb27SDimitry Andric 0x80003fff /* 00020000 - 00023fff [16384] */, // 22306c3fb27SDimitry Andric 0x90003fff /* 00024000 - 00027fff [16384] */, // 22406c3fb27SDimitry Andric 0xa0003fff /* 00028000 - 0002bfff [16384] */, // 22506c3fb27SDimitry Andric 0xb0003ffd /* 0002c000 - 0002fffd [16382] */, // 22606c3fb27SDimitry Andric 0xc0003fff /* 00030000 - 00033fff [16384] */, // 22706c3fb27SDimitry Andric 0xd0003fff /* 00034000 - 00037fff [16384] */, // 22806c3fb27SDimitry Andric 0xe0003fff /* 00038000 - 0003bfff [16384] */, // 22906c3fb27SDimitry Andric 0xf0003ffd /* 0003c000 - 0003fffd [16382] */}; 23006c3fb27SDimitry Andric 23106c3fb27SDimitry Andric /// The upper bound entry of EastAsianWidth.txt. 23206c3fb27SDimitry Andric /// 23306c3fb27SDimitry Andric /// Values greater than this value may have more than 18 significant bits. 23406c3fb27SDimitry Andric /// They always have a width of 1. This property makes it possible to store 23506c3fb27SDimitry Andric /// the table in its compact form. 23606c3fb27SDimitry Andric inline constexpr uint32_t __table_upper_bound = 0x0003fffd; 23706c3fb27SDimitry Andric 23806c3fb27SDimitry Andric /// Returns the estimated width of a Unicode code point. 23906c3fb27SDimitry Andric /// 240*0fca6ea1SDimitry Andric /// \\pre The code point is a valid Unicode code point. 24106c3fb27SDimitry Andric [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr int __estimated_width(const char32_t __code_point) noexcept { 24206c3fb27SDimitry Andric // Since __table_upper_bound contains the unshifted range do the 24306c3fb27SDimitry Andric // comparison without shifting. 24406c3fb27SDimitry Andric if (__code_point > __table_upper_bound) [[unlikely]] 24506c3fb27SDimitry Andric return 1; 24606c3fb27SDimitry Andric 24706c3fb27SDimitry Andric // When the code-point is less than the first element in the table 24806c3fb27SDimitry Andric // the lookup is quite expensive. Since quite some scripts are in 24906c3fb27SDimitry Andric // that range, it makes sense to validate that first. 25006c3fb27SDimitry Andric // The std_format_spec_string_unicode benchmark gives a measurable 25106c3fb27SDimitry Andric // improvement. 25206c3fb27SDimitry Andric if (__code_point < (__entries[0] >> 14)) 25306c3fb27SDimitry Andric return 1; 25406c3fb27SDimitry Andric 25506c3fb27SDimitry Andric ptrdiff_t __i = std::ranges::upper_bound(__entries, (__code_point << 14) | 0x3fffu) - __entries; 25606c3fb27SDimitry Andric if (__i == 0) 25706c3fb27SDimitry Andric return 1; 25806c3fb27SDimitry Andric 25906c3fb27SDimitry Andric --__i; 26006c3fb27SDimitry Andric uint32_t __upper_bound = (__entries[__i] >> 14) + (__entries[__i] & 0x3fffu); 26106c3fb27SDimitry Andric return 1 + (__code_point <= __upper_bound); 26206c3fb27SDimitry Andric } 26306c3fb27SDimitry Andric 26406c3fb27SDimitry Andric } // namespace __width_estimation_table 26506c3fb27SDimitry Andric 26606c3fb27SDimitry Andric #endif //_LIBCPP_STD_VER >= 20 26706c3fb27SDimitry Andric 26806c3fb27SDimitry Andric _LIBCPP_END_NAMESPACE_STD 26906c3fb27SDimitry Andric 27006c3fb27SDimitry Andric #endif // _LIBCPP___FORMAT_WIDTH_ESTIMATION_TABLE_H 271