| { | ||
| "git": { | ||
| "sha1": "c9fac4e625ccb2c6a7aa35079fff9709db4385ac" | ||
| "sha1": "a14f2dad852be26bad277ae704abf27a15cbfed1" | ||
| }, | ||
| "path_in_vcs": "utils/tinystr" | ||
| } |
+87
-76
@@ -7,5 +7,5 @@ # This file is automatically @generated by Cargo. | ||
| name = "aho-corasick" | ||
| version = "1.1.4" | ||
| version = "1.1.5" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" | ||
| checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" | ||
| dependencies = [ | ||
@@ -29,5 +29,5 @@ "memchr", | ||
| name = "autocfg" | ||
| version = "1.5.0" | ||
| version = "1.5.1" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" | ||
| checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" | ||
@@ -45,5 +45,5 @@ [[package]] | ||
| name = "bumpalo" | ||
| version = "3.20.2" | ||
| version = "3.20.3" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" | ||
| checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" | ||
@@ -161,5 +161,5 @@ [[package]] | ||
| name = "crossbeam-deque" | ||
| version = "0.8.6" | ||
| version = "0.8.7" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" | ||
| checksum = "5181e0de7b61eb03a81e347d6dd8797bae9da5146707b51077e2d71a54ec0ceb" | ||
| dependencies = [ | ||
@@ -172,5 +172,5 @@ "crossbeam-epoch", | ||
| name = "crossbeam-epoch" | ||
| version = "0.9.18" | ||
| version = "0.9.20" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" | ||
| checksum = "2d6914041f254d6e9176c01941b21115dcfb7089e55135a35411081bd106ef3f" | ||
| dependencies = [ | ||
@@ -182,5 +182,5 @@ "crossbeam-utils", | ||
| name = "crossbeam-utils" | ||
| version = "0.8.21" | ||
| version = "0.8.22" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" | ||
| checksum = "61803da095bee82a81bb1a452ecc25d3b2f1416d1897eb86430c6159ef717c17" | ||
@@ -205,9 +205,9 @@ [[package]] | ||
| name = "displaydoc" | ||
| version = "0.2.5" | ||
| version = "0.2.7" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" | ||
| checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" | ||
| dependencies = [ | ||
| "proc-macro2", | ||
| "quote", | ||
| "syn", | ||
| "syn 3.0.3", | ||
| ] | ||
@@ -217,5 +217,5 @@ | ||
| name = "either" | ||
| version = "1.15.0" | ||
| version = "1.17.0" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" | ||
| checksum = "9e5e8f6c15a24b9a3ee5efec809ccd006d3b30e8b3bb63c39af737c7f87daa1d" | ||
@@ -290,5 +290,5 @@ [[package]] | ||
| name = "js-sys" | ||
| version = "0.3.91" | ||
| version = "0.3.94" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "b49715b7073f385ba4bc528e5747d02e66cb39c6146efb66b781f131f0fb399c" | ||
| checksum = "2e04e2ef80ce82e13552136fabeef8a5ed1f985a96805761cbb9a2c34e7664d9" | ||
| dependencies = [ | ||
@@ -301,11 +301,11 @@ "once_cell", | ||
| name = "libc" | ||
| version = "0.2.183" | ||
| version = "0.2.189" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "b5b646652bf6661599e1da8901b3b9522896f01e736bad5f723fe7a3a27f899d" | ||
| checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2" | ||
| [[package]] | ||
| name = "memchr" | ||
| version = "2.8.0" | ||
| version = "2.8.3" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" | ||
| checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" | ||
@@ -384,5 +384,5 @@ [[package]] | ||
| name = "proc-macro2" | ||
| version = "1.0.106" | ||
| version = "1.0.107" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" | ||
| checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" | ||
| dependencies = [ | ||
@@ -394,5 +394,5 @@ "unicode-ident", | ||
| name = "quote" | ||
| version = "1.0.45" | ||
| version = "1.0.47" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" | ||
| checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" | ||
| dependencies = [ | ||
@@ -410,5 +410,5 @@ "proc-macro2", | ||
| name = "rand" | ||
| version = "0.9.2" | ||
| version = "0.9.5" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" | ||
| checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" | ||
| dependencies = [ | ||
@@ -460,5 +460,5 @@ "rand_chacha", | ||
| name = "regex" | ||
| version = "1.12.3" | ||
| version = "1.13.1" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" | ||
| checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" | ||
| dependencies = [ | ||
@@ -473,5 +473,5 @@ "aho-corasick", | ||
| name = "regex-automata" | ||
| version = "0.4.14" | ||
| version = "0.4.18" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" | ||
| checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" | ||
| dependencies = [ | ||
@@ -485,11 +485,11 @@ "aho-corasick", | ||
| name = "regex-syntax" | ||
| version = "0.8.10" | ||
| version = "0.8.11" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" | ||
| checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" | ||
| [[package]] | ||
| name = "rustversion" | ||
| version = "1.0.22" | ||
| version = "1.0.23" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" | ||
| checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" | ||
@@ -507,5 +507,5 @@ [[package]] | ||
| name = "serde" | ||
| version = "1.0.228" | ||
| version = "1.0.229" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" | ||
| checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" | ||
| dependencies = [ | ||
@@ -518,5 +518,5 @@ "serde_core", | ||
| name = "serde_core" | ||
| version = "1.0.228" | ||
| version = "1.0.229" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" | ||
| checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" | ||
| dependencies = [ | ||
@@ -528,9 +528,9 @@ "serde_derive", | ||
| name = "serde_derive" | ||
| version = "1.0.228" | ||
| version = "1.0.229" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" | ||
| checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" | ||
| dependencies = [ | ||
| "proc-macro2", | ||
| "quote", | ||
| "syn", | ||
| "syn 3.0.3", | ||
| ] | ||
@@ -540,5 +540,5 @@ | ||
| name = "serde_json" | ||
| version = "1.0.149" | ||
| version = "1.0.151" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" | ||
| checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14" | ||
| dependencies = [ | ||
@@ -554,5 +554,5 @@ "itoa", | ||
| name = "syn" | ||
| version = "2.0.117" | ||
| version = "2.0.119" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" | ||
| checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" | ||
| dependencies = [ | ||
@@ -565,6 +565,17 @@ "proc-macro2", | ||
| [[package]] | ||
| name = "syn" | ||
| version = "3.0.3" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3" | ||
| dependencies = [ | ||
| "proc-macro2", | ||
| "quote", | ||
| "unicode-ident", | ||
| ] | ||
| [[package]] | ||
| name = "thiserror" | ||
| version = "2.0.18" | ||
| version = "2.0.20" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" | ||
| checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f" | ||
| dependencies = [ | ||
@@ -576,9 +587,9 @@ "thiserror-impl", | ||
| name = "thiserror-impl" | ||
| version = "2.0.18" | ||
| version = "2.0.20" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" | ||
| checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af" | ||
| dependencies = [ | ||
| "proc-macro2", | ||
| "quote", | ||
| "syn", | ||
| "syn 3.0.3", | ||
| ] | ||
@@ -588,3 +599,3 @@ | ||
| name = "tinystr" | ||
| version = "0.8.3" | ||
| version = "0.8.4" | ||
| dependencies = [ | ||
@@ -639,5 +650,5 @@ "bincode", | ||
| name = "wasm-bindgen" | ||
| version = "0.2.114" | ||
| version = "0.2.117" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "6532f9a5c1ece3798cb1c2cfdba640b9b3ba884f5db45973a6f442510a87d38e" | ||
| checksum = "0551fc1bb415591e3372d0bc4780db7e587d84e2a7e79da121051c5c4b89d0b0" | ||
| dependencies = [ | ||
@@ -653,5 +664,5 @@ "cfg-if", | ||
| name = "wasm-bindgen-macro" | ||
| version = "0.2.114" | ||
| version = "0.2.117" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "18a2d50fcf105fb33bb15f00e7a77b772945a2ee45dcf454961fd843e74c18e6" | ||
| checksum = "7fbdf9a35adf44786aecd5ff89b4563a90325f9da0923236f6104e603c7e86be" | ||
| dependencies = [ | ||
@@ -664,5 +675,5 @@ "quote", | ||
| name = "wasm-bindgen-macro-support" | ||
| version = "0.2.114" | ||
| version = "0.2.117" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "03ce4caeaac547cdf713d280eda22a730824dd11e6b8c3ca9e42247b25c631e3" | ||
| checksum = "dca9693ef2bab6d4e6707234500350d8dad079eb508dca05530c85dc3a529ff2" | ||
| dependencies = [ | ||
@@ -672,3 +683,3 @@ "bumpalo", | ||
| "quote", | ||
| "syn", | ||
| "syn 2.0.119", | ||
| "wasm-bindgen-shared", | ||
@@ -679,5 +690,5 @@ ] | ||
| name = "wasm-bindgen-shared" | ||
| version = "0.2.114" | ||
| version = "0.2.117" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "75a326b8c223ee17883a4251907455a2431acc2791c98c26279376490c378c16" | ||
| checksum = "39129a682a6d2d841b6c429d0c51e5cb0ed1a03829d8b3d1e69a011e62cb3d3b" | ||
| dependencies = [ | ||
@@ -689,5 +700,5 @@ "unicode-ident", | ||
| name = "web-sys" | ||
| version = "0.3.91" | ||
| version = "0.3.94" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "854ba17bb104abfb26ba36da9729addc7ce7f06f5c0f90f3c391f8461cca21f9" | ||
| checksum = "cd70027e39b12f0849461e08ffc50b9cd7688d942c1c8e3c7b22273236b4dd0a" | ||
| dependencies = [ | ||
@@ -730,5 +741,5 @@ "js-sys", | ||
| name = "zerocopy" | ||
| version = "0.8.47" | ||
| version = "0.8.56" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "efbb2a062be311f2ba113ce66f697a4dc589f85e78a4aea276200804cea0ed87" | ||
| checksum = "556764e583adb45a9f8d413c2a147fa7e8d821e48e12b14fd560b607998b75eb" | ||
| dependencies = [ | ||
@@ -740,9 +751,9 @@ "zerocopy-derive", | ||
| name = "zerocopy-derive" | ||
| version = "0.8.47" | ||
| version = "0.8.56" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "0e8bc7269b54418e7aeeef514aa68f8690b8c0489a06b0136e5f57c4c5ccab89" | ||
| checksum = "f2ab42fc20575779bd240faa45f94a74256f755c0fa9e89f0ede20d91d0cdfc1" | ||
| dependencies = [ | ||
| "proc-macro2", | ||
| "quote", | ||
| "syn", | ||
| "syn 2.0.119", | ||
| ] | ||
@@ -752,11 +763,11 @@ | ||
| name = "zerofrom" | ||
| version = "0.1.7" | ||
| version = "0.1.8" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "69faa1f2a1ea75661980b013019ed6687ed0e83d069bc1114e2cc74c6c04c4df" | ||
| checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" | ||
| [[package]] | ||
| name = "zerovec" | ||
| version = "0.11.6" | ||
| version = "0.11.7" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" | ||
| checksum = "94b5c6b5976d66c1d703c4fd17d3f5e43c8cedaacf604961b171adc7130896d8" | ||
| dependencies = [ | ||
@@ -769,4 +780,4 @@ "serde", | ||
| name = "zmij" | ||
| version = "1.0.21" | ||
| version = "1.0.23" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" | ||
| checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" |
+8
-6
@@ -16,3 +16,3 @@ # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO | ||
| name = "tinystr" | ||
| version = "0.8.3" | ||
| version = "0.8.4" | ||
| authors = ["The ICU4X Project Developers"] | ||
@@ -114,3 +114,3 @@ build = false | ||
| [dependencies.zerovec] | ||
| version = "0.11.6" | ||
| version = "0.11.7" | ||
| optional = true | ||
@@ -139,4 +139,5 @@ default-features = false | ||
| [lints.clippy] | ||
| alloc-instead-of-core = "warn" | ||
| branches-sharing-code = "warn" | ||
| alloc_instead_of_core = "warn" | ||
| bool_assert_comparison = "allow" | ||
| branches_sharing_code = "warn" | ||
| collection_is_never_read = "warn" | ||
@@ -156,3 +157,3 @@ crosspointer_transmute = "warn" | ||
| negative_feature_names = "warn" | ||
| or-fun-call = "warn" | ||
| or_fun_call = "warn" | ||
| same_functions_in_if_condition = "warn" | ||
@@ -168,3 +169,3 @@ todo = "warn" | ||
| trivially_copy_pass_by_ref = "deny" | ||
| unnecessary-wraps = "warn" | ||
| unnecessary_wraps = "warn" | ||
| useless_transmute = "warn" | ||
@@ -186,4 +187,5 @@ wildcard_dependencies = "warn" | ||
| "cfg(needs_alloc_error_handler)", | ||
| "cfg(icu4x_nightly_tests)", | ||
| "cfg(icu4x_run_size_tests)", | ||
| "cfg(icu4x_unstable_fast_trie_only)", | ||
| ] |
+2
-2
@@ -13,3 +13,3 @@ // This file is part of ICU4X. For terms of use, please see the file | ||
| use core::ops::Deref; | ||
| use core::str::{self, FromStr}; | ||
| use core::str::FromStr; | ||
@@ -309,3 +309,3 @@ #[repr(transparent)] | ||
| // as_utf8 is valid utf8 | ||
| unsafe { str::from_utf8_unchecked(self.as_utf8()) } | ||
| unsafe { core::str::from_utf8_unchecked(self.as_utf8()) } | ||
| } | ||
@@ -312,0 +312,0 @@ |
+30
-12
@@ -131,3 +131,7 @@ // This file is part of ICU4X. For terms of use, please see the file | ||
| let word = self.0; | ||
| let result = word | (((word + 0x3f3f_3f3f) & !(word + 0x2525_2525) & 0x8080_8080) >> 2); | ||
| let mask = ((word + 0x3f3f_3f3f) & !(word + 0x2525_2525) & 0x8080_8080) >> 2; | ||
| let result = word | mask; | ||
| // SAFETY: The existing word is ASCII, and it is bitwise-ORed with `mask`, | ||
| // a subset of 0x20_20_20_... (0x80_... >> 2), which keeps the word | ||
| // in the ASCII range (all bytes <= 127). | ||
| unsafe { AsciiByte::to_ascii_byte_array(&result.to_ne_bytes()) } | ||
@@ -140,2 +144,5 @@ } | ||
| let result = (word | mask) & !(0x20 & mask); | ||
| // SAFETY: The existing word is ASCII, and it is bitwise-ORed with `mask`, a subset of 0x20_20_20_... | ||
| // (0x80_... >> 2), which keeps the word in the ASCII range (all bytes <= 127). It is then ANDed | ||
| // which cannot introduce new bits. | ||
| unsafe { AsciiByte::to_ascii_byte_array(&u32::from_le(result).to_ne_bytes()) } | ||
@@ -146,3 +153,6 @@ } | ||
| let word = self.0; | ||
| let result = word & !(((word + 0x1f1f_1f1f) & !(word + 0x0505_0505) & 0x8080_8080) >> 2); | ||
| let mask = !(((word + 0x1f1f_1f1f) & !(word + 0x0505_0505) & 0x8080_8080) >> 2); | ||
| let result = word & mask; | ||
| // SAFETY: The existing word is ASCII, and it is bitwise-ANDed with `mask`, | ||
| // which cannot introduce new bits, so it stays ASCII. | ||
| unsafe { AsciiByte::to_ascii_byte_array(&result.to_ne_bytes()) } | ||
@@ -261,7 +271,10 @@ } | ||
| let word = self.0; | ||
| let result = word | ||
| | (((word + 0x3f3f_3f3f_3f3f_3f3f) | ||
| & !(word + 0x2525_2525_2525_2525) | ||
| & 0x8080_8080_8080_8080) | ||
| >> 2); | ||
| let mask = ((word + 0x3f3f_3f3f_3f3f_3f3f) | ||
| & !(word + 0x2525_2525_2525_2525) | ||
| & 0x8080_8080_8080_8080) | ||
| >> 2; | ||
| let result = word | mask; | ||
| // SAFETY: The existing word is ASCII, and it is bitwise-ORed with `mask`, | ||
| // a subset of 0x20_20_20_... (0x80_... >> 2), which keeps the word | ||
| // in the ASCII range (all bytes <= 127). | ||
| unsafe { AsciiByte::to_ascii_byte_array(&result.to_ne_bytes()) } | ||
@@ -277,2 +290,5 @@ } | ||
| let result = (word | mask) & !(0x20 & mask); | ||
| // SAFETY: The existing word is ASCII, and it is bitwise-ORed with `mask`, a subset of 0x20_20_20_... | ||
| // (0x80_... >> 2), which keeps the word in the ASCII range (all bytes <= 127). It is then ANDed | ||
| // which cannot introduce new bits. | ||
| unsafe { AsciiByte::to_ascii_byte_array(&u64::from_le(result).to_ne_bytes()) } | ||
@@ -283,9 +299,11 @@ } | ||
| let word = self.0; | ||
| let result = word | ||
| & !(((word + 0x1f1f_1f1f_1f1f_1f1f) | ||
| & !(word + 0x0505_0505_0505_0505) | ||
| & 0x8080_8080_8080_8080) | ||
| >> 2); | ||
| let mask = !(((word + 0x1f1f_1f1f_1f1f_1f1f) | ||
| & !(word + 0x0505_0505_0505_0505) | ||
| & 0x8080_8080_8080_8080) | ||
| >> 2); | ||
| let result = word & mask; | ||
| // SAFETY: The existing word is ASCII, and it is bitwise-ANDed with `mask`, | ||
| // which cannot introduce new bits, so it stays ASCII. | ||
| unsafe { AsciiByte::to_ascii_byte_array(&result.to_ne_bytes()) } | ||
| } | ||
| } |
+12
-0
@@ -56,4 +56,16 @@ // This file is part of ICU4X. For terms of use, please see the file | ||
| } | ||
| #[inline] | ||
| /// Returns the empty string. | ||
| pub const fn default() -> Self { | ||
| TinyAsciiStr::EMPTY.to_unvalidated() | ||
| } | ||
| } | ||
| impl<const N: usize> Default for UnvalidatedTinyAsciiStr<N> { | ||
| fn default() -> Self { | ||
| Self::default() | ||
| } | ||
| } | ||
| impl<const N: usize> TinyAsciiStr<N> { | ||
@@ -60,0 +72,0 @@ #[inline] |
Sorry, the diff of this file is not supported yet