Skip to content

IntTryLog2

Description

Try to compute floor(log2(value)).

Returns

true on success, false when value is zero.

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    bool IntTryLog2(Int *value, u64 *out) {
        if (!value || !out) {
            LOG_ERROR("Invalid arguments");
    u64 IntLog2WithError(Int *value, bool *error) {
        u64  out = 0;
        bool ok  = IntTryLog2(value, &out);
    
        if (error) {
        u64 max_degree = 0;
    
        if (!IntTryLog2(value, &max_degree)) {
            return false;
        }
Last updated on