Talk:Binary options

From FUDforum Wiki
Jump to: navigation, search

Max value

The max value for any options bitmap is PHP_INT_MAX. This is equal to 2147483647 on a 32-bit system.

Enabled options

Code to see what options are enabled by a given value:

<?php

/* We want to know the power-2 based numbers of $fud_opt. */
function fudpowers($var, $opt) {
        $n = 1;
        while ( $opt > 0 ) {
                if ( $opt & 1 == 1 ) {
                        echo $n, "\n";
                }
                $n *= 2;
                $opt >>= 1;
        }
}

        header('Content-Type: text/plain') ;
        require('./GLOBALS.php');
        echo "FUD_OPT_1=[$FUD_OPT_1]\n";
        fudpowers($FUD_OPT_1);
?>
Languages
Personal tools