[][src]Function solana_rbpf::helpers::memfrob

pub fn memfrob(
    ptr: u64,
    len: u64,
    unused3: u64,
    unused4: u64,
    unused5: u64
) -> u64

Same as void *memfrob(void *s, size_t n); in string.h in C. See the GNU manual page (in section 3) for memfrob. The memory is directly modified, and the helper returns 0 in all cases. Arguments 3 to 5 are unused.

Examples

use solana_rbpf::helpers;

let val: u64 = 0x112233;
let val_ptr = &val as *const u64;

helpers::memfrob(val_ptr as u64, 8, 0, 0, 0);
assert_eq!(val, 0x2a2a2a2a2a3b0819);
helpers::memfrob(val_ptr as u64, 8, 0, 0, 0);
assert_eq!(val, 0x112233);