Fwd: [PHP] Re: Can this code go faster?

2005-04-30 Thread Rory Browne
I sent this about a week ago, but I forgot to 'reply to all', and send it to the list. Thanks Rolf for pointing that out to me. I'm not totally sure, but this might work. I'm too tired to understand rolf's masks, but: ?php function bin2int($bin){ $a = bindec($bin); return ($a 128) ? ($a) :

[PHP] Re: Can this code go faster?

2005-04-29 Thread Rolf Østvik
Just a couple of comments about those 0x.. and 11 in my post. (By the way, i haven't looked to closely on speed even if the OP asked for that, i was unsure on how he was coding his numbers). [EMAIL PROTECTED] (Rolf Østvik) wrote in news:[EMAIL PROTECTED]: [EMAIL PROTECTED] (René

[PHP] Re: Can this code go faster?

2005-04-26 Thread Jason Barnett
René Fournier wrote: I've looked in the docs and don't see anything for this per se... I need to convert a binary number of arbitrary length to a signed integer. This is how I'm doing it now: CODE function bin2int ($bin) { if (substr($bin,0,1) == 1) { $val = 0 -

[PHP] Re: Can this code go faster?

2005-04-26 Thread Jason Barnett
Well that was retarded of me... I missed that you said you needed negative integers... in which case I don't know of anything better than what you've already coded. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Re: Can this code go faster?

2005-04-26 Thread Rolf Østvik
[EMAIL PROTECTED] (René Fournier) wrote in news:[EMAIL PROTECTED]: I need to convert a binary number of arbitrary length to a signed integer. This is how I'm doing it now: CODE function bin2int ($bin) { if (substr($bin,0,1) == 1) { $val = 0 -