MCPcopy Create free account
hub / github.com/NativeScript/android / to_lower_ascii

Function to_lower_ascii

test-app/runtime/src/main/cpp/ada/ada.cpp:10466–10490  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10464}
10465
10466constexpr bool to_lower_ascii(char* input, size_t length) noexcept {
10467 uint64_t broadcast_80 = broadcast(0x80);
10468 uint64_t broadcast_Ap = broadcast(128 - 'A');
10469 uint64_t broadcast_Zp = broadcast(128 - 'Z' - 1);
10470 uint64_t non_ascii = 0;
10471 size_t i = 0;
10472
10473 for (; i + 7 < length; i += 8) {
10474 uint64_t word{};
10475 memcpy(&word, input + i, sizeof(word));
10476 non_ascii |= (word & broadcast_80);
10477 word ^=
10478 (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
10479 memcpy(input + i, &word, sizeof(word));
10480 }
10481 if (i < length) {
10482 uint64_t word{};
10483 memcpy(&word, input + i, length - i);
10484 non_ascii |= (word & broadcast_80);
10485 word ^=
10486 (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
10487 memcpy(input + i, &word, length - i);
10488 }
10489 return non_ascii == 0;
10490}
10491#if ADA_NEON
10492ada_really_inline bool has_tabs_or_newline(
10493 std::string_view user_input) noexcept {

Callers 4

parse_schemeMethod · 0.85
parse_hostMethod · 0.85

Calls 1

broadcastFunction · 0.85

Tested by

no test coverage detected