[][src]Function solana_rbpf::helpers::strcmp

pub fn strcmp(
    arg1: u64,
    arg2: u64,
    arg3: u64,
    unused4: u64,
    unused5: u64
) -> u64

C-like strcmp, return 0 if the strings are equal, and a non-null value otherwise.

Examples

use solana_rbpf::helpers;

let foo = "This is a string.".as_ptr() as u64;
let bar = "This is another sting.".as_ptr() as u64;

assert!(helpers::strcmp(foo, foo, 0, 0, 0) == 0);
assert!(helpers::strcmp(foo, bar, 0, 0, 0) != 0);