1- /* auto-generated on 2025-03-08 13:17:11 -0500 . Do not edit! */
1+ /* auto-generated on 2025-06-26 23:04:30 -0300 . Do not edit! */
22/* begin file src/idna.cpp */
33/* begin file src/unicode_transcoding.cpp */
44
@@ -8021,7 +8021,7 @@ bool utf32_to_punycode(std::u32string_view input, std::string &out) {
80218021 ++h;
80228022 out.push_back(char(c));
80238023 }
8024- if (c > 0x10ffff || (c >= 0xd880 && c < 0xe000)) {
8024+ if (c > 0x10ffff || (c >= 0xd800 && c < 0xe000)) {
80258025 return false;
80268026 }
80278027 }
@@ -9411,6 +9411,10 @@ bool is_label_valid(const std::u32string_view label) {
94119411#include <ranges>
94129412
94139413
9414+ #ifdef ADA_USE_SIMDUTF
9415+ #include "simdutf.h"
9416+ #endif
9417+
94149418namespace ada::idna {
94159419
94169420bool constexpr is_ascii(std::u32string_view view) {
@@ -9523,11 +9527,20 @@ std::string to_ascii(std::string_view ut8_string) {
95239527 }
95249528 static const std::string error = "";
95259529 // We convert to UTF-32
9530+
9531+ #ifdef ADA_USE_SIMDUTF
9532+ size_t utf32_length =
9533+ simdutf::utf32_length_from_utf8(ut8_string.data(), ut8_string.size());
9534+ std::u32string utf32(utf32_length, '\0');
9535+ size_t actual_utf32_length = simdutf::convert_utf8_to_utf32(
9536+ ut8_string.data(), ut8_string.size(), utf32.data());
9537+ #else
95269538 size_t utf32_length =
95279539 ada::idna::utf32_length_from_utf8(ut8_string.data(), ut8_string.size());
95289540 std::u32string utf32(utf32_length, '\0');
95299541 size_t actual_utf32_length = ada::idna::utf8_to_utf32(
95309542 ut8_string.data(), ut8_string.size(), utf32.data());
9543+ #endif
95319544 if (actual_utf32_length == 0) {
95329545 return error;
95339546 }
@@ -9619,6 +9632,10 @@ std::string to_ascii(std::string_view ut8_string) {
96199632#include <string>
96209633
96219634
9635+ #ifdef ADA_USE_SIMDUTF
9636+ #include "simdutf.h"
9637+ #endif
9638+
96229639namespace ada::idna {
96239640std::string to_unicode(std::string_view input) {
96249641 std::string output;
@@ -9637,11 +9654,19 @@ std::string to_unicode(std::string_view input) {
96379654 if (ada::idna::verify_punycode(label_view)) {
96389655 std::u32string tmp_buffer;
96399656 if (ada::idna::punycode_to_utf32(label_view, tmp_buffer)) {
9657+ #ifdef ADA_USE_SIMDUTF
9658+ auto utf8_size = simdutf::utf8_length_from_utf32(tmp_buffer.data(),
9659+ tmp_buffer.size());
9660+ std::string final_utf8(utf8_size, '\0');
9661+ simdutf::convert_utf32_to_utf8(tmp_buffer.data(), tmp_buffer.size(),
9662+ final_utf8.data());
9663+ #else
96409664 auto utf8_size = ada::idna::utf8_length_from_utf32(tmp_buffer.data(),
96419665 tmp_buffer.size());
96429666 std::string final_utf8(utf8_size, '\0');
96439667 ada::idna::utf32_to_utf8(tmp_buffer.data(), tmp_buffer.size(),
96449668 final_utf8.data());
9669+ #endif
96459670 output.append(final_utf8);
96469671 } else {
96479672 // ToUnicode never fails. If any step fails, then the original input
0 commit comments