Please,

anyone with skills to convert the following php function to flex? i'm
killing myself trying... 

please... anyone?

thanks
rafael

-----

/**
* Perform a float-safe bitwise AND comparison
*
* @param int/float $number  The number to which to perform a bitwise AND
* @param int/float $comparison  The number with which to perform a
bitwise AND
* @return bool
*/
function safeBitCheck($number,$comparison) {
   if( $number < 2147483647 ) {
       return ($number & $comparison)==$comparison;
   } else {
       $binNumber = strrev(base_convert($number,10,2));
       $binComparison = strrev(base_convert($comparison,10,2));
       for( $i=0; $i<strlen($binComparison); $i++ ) {
           if( strlen($binNumber)<$i || ($binComparison{$i}==="1" &&
$binNumber{$i}==="0") ) {
               return false;
           }
       }
       return true;
   }
}

safeBitCheck(17,16); // true
safeBitCheck(17,2); // false
safeBitCheck((4294967296+8589934592),4294967296); // true
safeBitCheck(2,8589934592); // false

Reply via email to