Skip to content

IntTryToU64

Description

Try to convert an integer to u64.

Parameters

Name Direction Description
value in Integer to convert
out out Destination for the converted value

Returns

true on success, false when the value does not fit in 64 bits.

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    bool IntTryToU64(Int *value, u64 *out) {
        if (!value || !out) {
            LOG_ERROR("Invalid arguments");
    u64 IntToU64WithError(Int *value, bool *error) {
        u64  out = 0;
        bool ok  = IntTryToU64(value, &out);
    
        if (error) {
        u64 lhs_value = 0;
    
        (void)IntTryToU64(lhs, &lhs_value);
    
        if (lhs_value < rhs) {
        IntShiftLeft(&value, 64);
    
        bool result = !IntTryToU64(&value, &out);
        result      = result && (IntToU64(&value, &error) == 0);
        result      = result && error;
Last updated on