Does "result = (uint(number) & uint(comparison))" work? -Josh
2009/1/20 Rafael Faria <rafaelfaria.gru...@gmail.com> > > 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 > > > ------------------------------------ > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Alternative FAQ location: > https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 > Search Archives: > http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups > Links > > > > -- "Therefore, send not to know For whom the bell tolls. It tolls for thee." Like the cut of my jib? Check out my Flex blog! :: Josh 'G-Funk' McDonald :: 0437 221 380 :: j...@gfunk007.com :: http://flex.joshmcdonald.info/ :: http://twitter.com/sophistifunk