MCPcopy Create free account
hub / github.com/FastLED/FastLED / find_stdint_matches

Function find_stdint_matches

ci/lint_cpp_rs/src/lib.rs:2788–2830  ·  view source on GitHub ↗
(code_part: &str)

Source from the content-addressed store, hash-verified

2786}
2787
2788fn find_stdint_matches(code_part: &str) -> Vec<&'static str> {
2789 let bytes = code_part.as_bytes();
2790 let mut matches = Vec::new();
2791
2792 for (type_name, _) in STDINT_TYPE_MAPPINGS {
2793 if *type_name == "unsigned int" || *type_name == "signed int" {
2794 continue;
2795 }
2796 let mut search_start = 0;
2797 while let Some(relative_pos) = code_part[search_start..].find(type_name) {
2798 let pos = search_start + relative_pos;
2799 let end = pos + type_name.len();
2800 search_start = end;
2801
2802 if (pos == 0 || !is_ascii_word_byte(bytes[pos - 1]))
2803 && (end >= bytes.len() || !is_ascii_word_byte(bytes[end]))
2804 {
2805 matches.push(*type_name);
2806 }
2807 }
2808 }
2809
2810 for type_name in ["unsigned int", "signed int"] {
2811 let mut search_start = 0;
2812 while let Some(relative_pos) = code_part[search_start..].find(type_name) {
2813 let pos = search_start + relative_pos;
2814 let end = pos + type_name.len();
2815 search_start = end;
2816
2817 let Some(next) = bytes.get(end).copied() else {
2818 continue;
2819 };
2820 if !matches!(next, b' ' | b'*' | b'&' | b',' | b')' | b']') {
2821 continue;
2822 }
2823 if (pos == 0 || !is_ascii_word_byte(bytes[pos - 1])) && !is_ascii_word_byte(next) {
2824 matches.push(type_name);
2825 }
2826 }
2827 }
2828
2829 matches
2830}
2831
2832fn stdint_fl_type(type_name: &str) -> &'static str {
2833 STDINT_TYPE_MAPPINGS

Callers 1

check_file_contentMethod · 0.85

Calls 4

is_ascii_word_byteFunction · 0.85
findMethod · 0.45
pushMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected