MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / parse

Function parse

native/android/src/lib.rs:1407–1416  ·  view source on GitHub ↗
(buf: &[u8], n: i32)

Source from the content-addressed store, hash-verified

1405#[no_mangle]
1406pub extern "C" fn bloom_get_language() -> f64 {
1407 fn parse(buf: &[u8], n: i32) -> Option<f64> {
1408 if n < 2 { return None; }
1409 let lc = |b: u8| if b.is_ascii_uppercase() { b + 32 } else { b };
1410 let (c0, c1) = (lc(buf[0]), lc(buf[1]));
1411 if c0.is_ascii_alphabetic() && c1.is_ascii_alphabetic() {
1412 Some((c0 as f64) * 256.0 + (c1 as f64))
1413 } else {
1414 None
1415 }
1416 }
1417 let props: [&[u8]; 3] = [
1418 b"persist.sys.locale\0",
1419 b"ro.product.locale\0",

Callers 2

mainFunction · 0.85
bloom_get_languageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected