Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct CHAR_END #83

Merged
merged 1 commit into from May 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/lib.rs
Expand Up @@ -347,7 +347,8 @@ impl_arbitrary_for_floats! {
impl<'a> Arbitrary<'a> for char {
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self> {
use std::char;
const CHAR_END: u32 = 0x0001_1000;
// The highest unicode code point is 0x11_FFFF
const CHAR_END: u32 = 0x11_0000;
Manishearth marked this conversation as resolved.
Show resolved Hide resolved
// The size of the surrogate blocks
const SURROGATES_START: u32 = 0xD800;
let mut c = <u32 as Arbitrary<'a>>::arbitrary(u)? % CHAR_END;
Expand Down