Skip to main content

runtime_text_measure_off

Function runtime_text_measure_off 

Source
pub extern "C" fn runtime_text_measure_off(
    addr: i64,
    off: i64,
    len: i64,
    cnt: i64,
) -> i64
Expand description

Measure codepoints in a UTF-8 buffer. Matches text-2.1.2 _hs_text_measure_off semantics.

If the buffer contains >= cnt characters, returns the non-negative byte count of those cnt characters. If the buffer is shorter (< cnt chars), returns the non-positive negated total character count. Returns 0 if len = 0 or cnt = 0.

ยงSafety

Input must be valid UTF-8. No validation is performed (matches C text library).