mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
wc: document the long match
This commit is contained in:
parent
043c009a41
commit
7257adb53b
1 changed files with 19 additions and 1 deletions
|
@ -317,6 +317,7 @@ fn word_count_from_reader<T: WordCountable>(
|
||||||
// Specialize scanning loop to improve the performance.
|
// Specialize scanning loop to improve the performance.
|
||||||
(false, false, false, false, false) => unreachable!(),
|
(false, false, false, false, false) => unreachable!(),
|
||||||
|
|
||||||
|
// show_bytes
|
||||||
(true, false, false, false, false) => {
|
(true, false, false, false, false) => {
|
||||||
// Fast path when only show_bytes is true.
|
// Fast path when only show_bytes is true.
|
||||||
let (bytes, error) = count_bytes_fast(&mut reader);
|
let (bytes, error) = count_bytes_fast(&mut reader);
|
||||||
|
@ -330,58 +331,75 @@ fn word_count_from_reader<T: WordCountable>(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fast paths that can be computed without Unicode decoding.
|
// Fast paths that can be computed without Unicode decoding.
|
||||||
|
// show_lines
|
||||||
(false, false, true, false, false) => {
|
(false, false, true, false, false) => {
|
||||||
count_bytes_chars_and_lines_fast::<_, false, false, true>(&mut reader)
|
count_bytes_chars_and_lines_fast::<_, false, false, true>(&mut reader)
|
||||||
}
|
}
|
||||||
|
// show_chars
|
||||||
(false, true, false, false, false) => {
|
(false, true, false, false, false) => {
|
||||||
count_bytes_chars_and_lines_fast::<_, false, true, false>(&mut reader)
|
count_bytes_chars_and_lines_fast::<_, false, true, false>(&mut reader)
|
||||||
}
|
}
|
||||||
|
// show_chars, show_lines
|
||||||
(false, true, true, false, false) => {
|
(false, true, true, false, false) => {
|
||||||
count_bytes_chars_and_lines_fast::<_, false, true, true>(&mut reader)
|
count_bytes_chars_and_lines_fast::<_, false, true, true>(&mut reader)
|
||||||
}
|
}
|
||||||
|
// show_bytes, show_lines
|
||||||
(true, false, true, false, false) => {
|
(true, false, true, false, false) => {
|
||||||
count_bytes_chars_and_lines_fast::<_, true, false, true>(&mut reader)
|
count_bytes_chars_and_lines_fast::<_, true, false, true>(&mut reader)
|
||||||
}
|
}
|
||||||
|
// show_bytes, show_chars
|
||||||
(true, true, false, false, false) => {
|
(true, true, false, false, false) => {
|
||||||
count_bytes_chars_and_lines_fast::<_, true, true, false>(&mut reader)
|
count_bytes_chars_and_lines_fast::<_, true, true, false>(&mut reader)
|
||||||
}
|
}
|
||||||
|
// show_bytes, show_chars, show_lines
|
||||||
(true, true, true, false, false) => {
|
(true, true, true, false, false) => {
|
||||||
count_bytes_chars_and_lines_fast::<_, true, true, true>(&mut reader)
|
count_bytes_chars_and_lines_fast::<_, true, true, true>(&mut reader)
|
||||||
}
|
}
|
||||||
|
// show_words
|
||||||
(_, false, false, false, true) => {
|
(_, false, false, false, true) => {
|
||||||
word_count_from_reader_specialized::<_, false, false, false, true>(reader)
|
word_count_from_reader_specialized::<_, false, false, false, true>(reader)
|
||||||
}
|
}
|
||||||
|
// show_max_line_length
|
||||||
(_, false, false, true, false) => {
|
(_, false, false, true, false) => {
|
||||||
word_count_from_reader_specialized::<_, false, false, true, false>(reader)
|
word_count_from_reader_specialized::<_, false, false, true, false>(reader)
|
||||||
}
|
}
|
||||||
|
// show_max_line_length, show_words
|
||||||
(_, false, false, true, true) => {
|
(_, false, false, true, true) => {
|
||||||
word_count_from_reader_specialized::<_, false, false, true, true>(reader)
|
word_count_from_reader_specialized::<_, false, false, true, true>(reader)
|
||||||
}
|
}
|
||||||
|
// show_chars, show_words
|
||||||
(_, false, true, false, true) => {
|
(_, false, true, false, true) => {
|
||||||
word_count_from_reader_specialized::<_, false, true, false, true>(reader)
|
word_count_from_reader_specialized::<_, false, true, false, true>(reader)
|
||||||
}
|
}
|
||||||
|
// show_chars, show_lines
|
||||||
(_, false, true, true, false) => {
|
(_, false, true, true, false) => {
|
||||||
word_count_from_reader_specialized::<_, false, true, true, false>(reader)
|
word_count_from_reader_specialized::<_, false, true, true, false>(reader)
|
||||||
}
|
}
|
||||||
|
// show_lines, show_max_line_length, show_words
|
||||||
(_, false, true, true, true) => {
|
(_, false, true, true, true) => {
|
||||||
word_count_from_reader_specialized::<_, false, true, true, true>(reader)
|
word_count_from_reader_specialized::<_, false, true, true, true>(reader)
|
||||||
}
|
}
|
||||||
|
// show_chars, show_words
|
||||||
(_, true, false, false, true) => {
|
(_, true, false, false, true) => {
|
||||||
word_count_from_reader_specialized::<_, true, false, false, true>(reader)
|
word_count_from_reader_specialized::<_, true, false, false, true>(reader)
|
||||||
}
|
}
|
||||||
|
// show_chars, show_max_line_length
|
||||||
(_, true, false, true, false) => {
|
(_, true, false, true, false) => {
|
||||||
word_count_from_reader_specialized::<_, true, false, true, false>(reader)
|
word_count_from_reader_specialized::<_, true, false, true, false>(reader)
|
||||||
}
|
}
|
||||||
|
// show_chars, show_max_line_length, show_words
|
||||||
(_, true, false, true, true) => {
|
(_, true, false, true, true) => {
|
||||||
word_count_from_reader_specialized::<_, true, false, true, true>(reader)
|
word_count_from_reader_specialized::<_, true, false, true, true>(reader)
|
||||||
}
|
}
|
||||||
|
// show_chars, show_lines, show_words
|
||||||
(_, true, true, false, true) => {
|
(_, true, true, false, true) => {
|
||||||
word_count_from_reader_specialized::<_, true, true, false, true>(reader)
|
word_count_from_reader_specialized::<_, true, true, false, true>(reader)
|
||||||
}
|
}
|
||||||
|
// show_chars, show_lines, show_max_line_length
|
||||||
(_, true, true, true, false) => {
|
(_, true, true, true, false) => {
|
||||||
word_count_from_reader_specialized::<_, true, true, true, false>(reader)
|
word_count_from_reader_specialized::<_, true, true, true, false>(reader)
|
||||||
}
|
}
|
||||||
|
// show_chars, show_lines, show_max_line_length, show_words
|
||||||
(_, true, true, true, true) => {
|
(_, true, true, true, true) => {
|
||||||
word_count_from_reader_specialized::<_, true, true, true, true>(reader)
|
word_count_from_reader_specialized::<_, true, true, true, true>(reader)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue