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

Success

Returns true. The result has been computed and the destination object updated.

Failure

Returns false when the value does not fit in 64 bits. The destination is left untouched.

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    bool IntTryToU64(const Int *value, u64 *out) {
        if (!value || !out) {
            LOG_FATAL("Invalid arguments");
    u64 IntToU64WithError(const 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