Skip to content

Commit d7607f7

Browse files
authored
Upgrade ada to 2.6.10, bump version to 1.5.0 (#37)
1 parent c9257fa commit d7607f7

File tree

3 files changed

+39
-19
lines changed

3 files changed

+39
-19
lines changed

ada_url/ada.cpp

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* auto-generated on 2023-09-19 16:48:25 -0400. Do not edit! */
1+
/* auto-generated on 2023-09-30 20:34:30 -0400. Do not edit! */
22
/* begin file src/ada.cpp */
33
#include "ada.h"
44
/* begin file src/checkers.cpp */
@@ -116,7 +116,7 @@ ada_really_inline constexpr bool verify_dns_length(
116116

117117
ADA_PUSH_DISABLE_ALL_WARNINGS
118118
/* begin file src/ada_idna.cpp */
119-
/* auto-generated on 2023-08-29 15:28:19 -0400. Do not edit! */
119+
/* auto-generated on 2023-09-19 15:58:51 -0400. Do not edit! */
120120
/* begin file src/idna.cpp */
121121
/* begin file src/unicode_transcoding.cpp */
122122

@@ -9505,18 +9505,19 @@ bool is_label_valid(const std::u32string_view label) {
95059505

95069506
namespace ada::idna {
95079507

9508-
bool constexpr begins_with(std::u32string_view view,
9509-
std::u32string_view prefix) {
9508+
bool begins_with(std::u32string_view view, std::u32string_view prefix) {
95109509
if (view.size() < prefix.size()) {
95119510
return false;
95129511
}
9512+
// constexpr as of C++20
95139513
return std::equal(prefix.begin(), prefix.end(), view.begin());
95149514
}
95159515

9516-
bool constexpr begins_with(std::string_view view, std::string_view prefix) {
9516+
bool begins_with(std::string_view view, std::string_view prefix) {
95179517
if (view.size() < prefix.size()) {
95189518
return false;
95199519
}
9520+
// constexpr as of C++20
95209521
return std::equal(prefix.begin(), prefix.end(), view.begin());
95219522
}
95229523

@@ -9809,6 +9810,17 @@ constexpr bool to_lower_ascii(char* input, size_t length) noexcept {
98099810
#if ADA_NEON
98109811
ada_really_inline bool has_tabs_or_newline(
98119812
std::string_view user_input) noexcept {
9813+
// first check for short strings in which case we do it naively.
9814+
if (user_input.size() < 16) { // slow path
9815+
for (size_t i = 0; i < user_input.size(); i++) {
9816+
if (user_input[i] == '\r' || user_input[i] == '\n' ||
9817+
user_input[i] == '\t') {
9818+
return true;
9819+
}
9820+
}
9821+
return false;
9822+
}
9823+
// fast path for long strings (expected to be common)
98129824
size_t i = 0;
98139825
const uint8x16_t mask1 = vmovq_n_u8('\r');
98149826
const uint8x16_t mask2 = vmovq_n_u8('\n');
@@ -9821,9 +9833,8 @@ ada_really_inline bool has_tabs_or_newline(
98219833
vceqq_u8(word, mask3));
98229834
}
98239835
if (i < user_input.size()) {
9824-
uint8_t buffer[16]{};
9825-
memcpy(buffer, user_input.data() + i, user_input.size() - i);
9826-
uint8x16_t word = vld1q_u8((const uint8_t*)user_input.data() + i);
9836+
uint8x16_t word =
9837+
vld1q_u8((const uint8_t*)user_input.data() + user_input.length() - 16);
98279838
running = vorrq_u8(vorrq_u8(running, vorrq_u8(vceqq_u8(word, mask1),
98289839
vceqq_u8(word, mask2))),
98299840
vceqq_u8(word, mask3));
@@ -9833,6 +9844,17 @@ ada_really_inline bool has_tabs_or_newline(
98339844
#elif ADA_SSE2
98349845
ada_really_inline bool has_tabs_or_newline(
98359846
std::string_view user_input) noexcept {
9847+
// first check for short strings in which case we do it naively.
9848+
if (user_input.size() < 16) { // slow path
9849+
for (size_t i = 0; i < user_input.size(); i++) {
9850+
if (user_input[i] == '\r' || user_input[i] == '\n' ||
9851+
user_input[i] == '\t') {
9852+
return true;
9853+
}
9854+
}
9855+
return false;
9856+
}
9857+
// fast path for long strings (expected to be common)
98369858
size_t i = 0;
98379859
const __m128i mask1 = _mm_set1_epi8('\r');
98389860
const __m128i mask2 = _mm_set1_epi8('\n');
@@ -9846,9 +9868,8 @@ ada_really_inline bool has_tabs_or_newline(
98469868
_mm_cmpeq_epi8(word, mask3));
98479869
}
98489870
if (i < user_input.size()) {
9849-
alignas(16) uint8_t buffer[16]{};
9850-
memcpy(buffer, user_input.data() + i, user_input.size() - i);
9851-
__m128i word = _mm_load_si128((const __m128i*)buffer);
9871+
__m128i word = _mm_loadu_si128(
9872+
(const __m128i*)(user_input.data() + user_input.length() - 16));
98529873
running = _mm_or_si128(
98539874
_mm_or_si128(running, _mm_or_si128(_mm_cmpeq_epi8(word, mask1),
98549875
_mm_cmpeq_epi8(word, mask2))),

ada_url/ada.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* auto-generated on 2023-09-19 16:48:25 -0400. Do not edit! */
1+
/* auto-generated on 2023-09-30 20:34:30 -0400. Do not edit! */
22
/* begin file include/ada.h */
33
/**
44
* @file ada.h
@@ -8,7 +8,7 @@
88
#define ADA_H
99

1010
/* begin file include/ada/ada_idna.h */
11-
/* auto-generated on 2023-08-29 15:28:19 -0400. Do not edit! */
11+
/* auto-generated on 2023-09-19 15:58:51 -0400. Do not edit! */
1212
/* begin file include/idna.h */
1313
#ifndef ADA_IDNA_H
1414
#define ADA_IDNA_H
@@ -129,9 +129,8 @@ std::string to_ascii(std::string_view ut8_string);
129129
// https://url.spec.whatwg.org/#forbidden-domain-code-point
130130
bool contains_forbidden_domain_code_point(std::string_view ascii_string);
131131

132-
bool constexpr begins_with(std::u32string_view view,
133-
std::u32string_view prefix);
134-
bool constexpr begins_with(std::string_view view, std::string_view prefix);
132+
bool begins_with(std::u32string_view view, std::u32string_view prefix);
133+
bool begins_with(std::string_view view, std::string_view prefix);
135134

136135
bool constexpr is_ascii(std::u32string_view view);
137136
bool constexpr is_ascii(std::string_view view);
@@ -6929,14 +6928,14 @@ inline void url_search_params::sort() {
69296928
#ifndef ADA_ADA_VERSION_H
69306929
#define ADA_ADA_VERSION_H
69316930

6932-
#define ADA_VERSION "2.6.8"
6931+
#define ADA_VERSION "2.6.10"
69336932

69346933
namespace ada {
69356934

69366935
enum {
69376936
ADA_VERSION_MAJOR = 2,
69386937
ADA_VERSION_MINOR = 6,
6939-
ADA_VERSION_REVISION = 8,
6938+
ADA_VERSION_REVISION = 10,
69406939
};
69416940

69426941
} // namespace ada

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = ada-url
3-
version = 1.4.1
3+
version = 1.5.0
44
description = 'URL parser and manipulator based on the WHAT WG URL standard'
55
long_description = file: README.rst
66
long_description_content_type = text/x-rst

0 commit comments

Comments
 (0)