fn stable_write() {
    let operation = operation_from_args();

    let repeat = operation.repeat.unwrap_or(1);
    let value = operation
        .value
        .unwrap_or_else(|| rand(0, u8::MAX.into()) as u8);
    let len = operation.size as u64;
    assert!(len <= STABLE_MEMORY_SIZE);
    for _ in 0..repeat {
        let dst = RNG.with(|rng| rng.borrow_mut().gen_range(0, STABLE_MEMORY_SIZE - len));
        MEMORY.with(|memory| {
            let mut refmut = memory.borrow_mut();
            #[allow(unused_assignments)]
            let mut buf = vec![].as_mut_slice();
            unsafe {
                buf = refmut.align_to_mut::<u8>().1;
            }
            // Always use the first part of `MEMORY` to minimize the number of different
            // pages touched. This should in turn minimize the overhead of wasm
            // memory operations when testing out stable memory operations.
            #[allow(clippy::needless_range_loop)]
            for i in 0..len as usize {
                buf[i] = value;
            }
            stable::stable64_write(dst as u64, &buf[..len as usize]);
        });
    }

    api::reply(&[]);
}
/// Writes the given byte value into the given stable memory region.
///
/// Arguments:
/// - operation.repeat: the number of operations.
/// - operation.address: optional start address of the stable memory region. It
///   is chosen randomly if not given.
/// - operation.size: the size of the stable memory region in bytes.
/// - operation.value: optional byte value. It is chosen randomly if not given.
Writes the given byte value into the given stable memory region.
Arguments:
operation.repeat: the number of operations.
operation.address: optional start address of the stable memory region. It
is chosen randomly if not given.
operation.size: the size of the stable memory region in bytes.
Writes the given byte value into the given stable memory region . Arguments : operation . repeat : the number of operations . operation . address : optional start address of the stable memory region . It is chosen randomly if not given . operation . size : the size of the stable memory region in bytes .
fn stable_write() {
    let operation = operation_from_args();
    let repeat = operation.repeat.unwrap_or(1);
    let value = operation
        .value
        .unwrap_or_else(|| rand(0, u8::MAX.into()) as u8);
    let len = operation.size as u64;
    assert!(len <= STABLE_MEMORY_SIZE);
    for _ in 0..repeat {
        let dst = RNG.with(|rng| rng.borrow_mut().gen_range(0, STABLE_MEMORY_SIZE - len));
        MEMORY.with(|memory| {
            let mut refmut = memory.borrow_mut();
            #[allow(unused_assignments)]
            let mut buf = vec![].as_mut_slice();
            unsafe {
                buf = refmut.align_to_mut::<u8>().1;
            }
            // Always use the first part of `MEMORY` to minimize the number of different
            // pages touched. This should in turn minimize the overhead of wasm
            // memory operations when testing out stable memory operations.
            #[allow(clippy::needless_range_loop)]
            for i in 0..len as usize {
                buf[i] = value;
            }
            stable::stable64_write(dst as u64, &buf[..len as usize]);
        });
    }
    api::reply(&[]);
}
fn stable_write ( ) { let operation = operation_from_args ( ) ; let repeat = operation . repeat . unwrap_or ( 1 ) ; let value = operation . value . unwrap_or_else ( | | rand ( 0 , u8 :: MAX . into ( ) ) as u8 ) ; let len = operation . size as u64 ; assert ! ( len STABLE_MEMORY_SIZE ) ; for _ in 0 .. repeat { let dst = RNG . with ( | rng | rng . borrow_mut ( ) . gen_range ( 0 , STABLE_MEMORY_SIZE - len ) ) ; MEMORY . with ( | memory | { let mut refmut = memory . borrow_mut ( ) ; # [ allow ( unused_assignments ) ] let mut buf = vec ! [ ] . as_mut_slice ( ) ; unsafe { buf = refmut . align_to_mut :: < u8 > ( ) . 1 ; } // Always use the first part of `MEMORY` to minimize the number of different // pages touched. This should in turn minimize the overhead of wasm // memory operations when testing out stable memory operations. # [ allow ( clippy needless_range_loop ) ] for i in 0 .. len as usize { buf [ i ] = value ; } stable :: stable64_write ( dst as u64 , & buf [ .. len as usize ] ) ; } ) ; } api :: reply ( & [ ] ) ; }
Writes the given byte value into the given stable memory region.
Writes the given byte value into the given stable memory region .