MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / isa_string_extensions

Function isa_string_extensions

cranelift/native/src/riscv.rs:87–98  ·  view source on GitHub ↗

Parses an ISA string and returns an iterator over the extensions.

(isa: &str)

Source from the content-addressed store, hash-verified

85
86/// Parses an ISA string and returns an iterator over the extensions.
87fn isa_string_extensions(isa: &str) -> Vec<&str> {
88 let mut parts = isa.split('_');
89 let mut extensions = Vec::new();
90 // The first entry has the form `rv64imafdcvh`, we need to skip the architecture ("rv64").
91 // Each of the letters after the cpu architecture is an extension, so return them
92 // individually.
93 if let Some(letters) = parts.next().unwrap().strip_prefix("rv64") {
94 extensions.extend(letters.matches(|_| true));
95 extensions.extend(parts);
96 }
97 extensions
98}
99
100#[cfg(test)]
101mod tests {

Callers 1

cpuinfo_detectFunction · 0.85

Calls 6

splitMethod · 0.80
newFunction · 0.50
unwrapMethod · 0.45
nextMethod · 0.45
extendMethod · 0.45
matchesMethod · 0.45

Tested by

no test coverage detected