MCPcopy Create free account
hub / github.com/digama0/lean-sys / lean_array_swap

Function lean_array_swap

src/array/high_level.rs:165–181  ·  view source on GitHub ↗
(
    a: lean_obj_arg,
    i: b_lean_obj_arg,
    j: b_lean_obj_arg,
)

Source from the content-addressed store, hash-verified

163
164#[inline(always)]
165pub unsafe fn lean_array_swap(
166 a: lean_obj_arg,
167 i: b_lean_obj_arg,
168 j: b_lean_obj_arg,
169) -> *mut lean_object {
170 if !lean_is_scalar(i) || !lean_is_scalar(j) {
171 return a;
172 }
173 let i = lean_unbox(i);
174 let j = lean_unbox(j);
175 let sz = lean_array_size(a);
176 if i >= sz || j >= sz {
177 a
178 } else {
179 lean_array_uswap(a, i, j)
180 }
181}
182
183extern "C" {
184 pub fn lean_array_get_panic(def_val: lean_obj_arg) -> lean_obj_res;

Callers

nothing calls this directly

Calls 4

lean_is_scalarFunction · 0.85
lean_unboxFunction · 0.85
lean_array_sizeFunction · 0.85
lean_array_uswapFunction · 0.85

Tested by

no test coverage detected