[PHP-DEV] Re: [Zend Engine 2] Right/Left Shift Zero Fill operator

2001-09-12 Thread Andi Gutmans

At 12:15 AM 9/11/2001 +0200, Alexander Wirtz wrote:
Hi Jeroen,

to give a little bit background, as a student of computersciences I happen
to work with bitshift not as a means of having a quick multiplication or
division, but as using it to manipulate bit-patterns.
The distinction between signed and unsigned rightshift is nothing strange,
obscure or redundant, but is implemented down to the machine-language
itsself (dependent on cpu-architecture).
So this is no bad operator, but one of the most crucial operators on
bit-patterns. I don't want to sound arrogant (saying this is almost always a
sure sign, that it will ;-) ) but maybe you should inform yourself the next
time why other languages have this operator implemented.
Disabling signed shifting will force me to turn back to perl, as I use this
feature for quick hacking certain scripts I use at the University (and that
would be a very cruel thing to do :o) ) - besides, it would disregard the
holy BC...

In what case (when not dividing) do you use this kind of shift?

Andi


Cheers  flames on (constructive comments are welcome),

Alexander

--
| Alexander Wirtz   | eMail: [EMAIL PROTECTED]  |
| web@ctive GmbH| Accidents, Emergency, Ambulance|


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Re: [Zend Engine 2] Right/Left Shift Zero Fill operator

2001-09-11 Thread Phil Driscoll

+1 for 

-- 
Phil Driscoll

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Re: [Zend Engine 2] Right/Left Shift Zero Fill operator

2001-09-10 Thread Jason Greene

Good Idea

Is there anyone out there who uses  on negative numbers?
There is the discussion on the engine2 list about whether to 
make  an unsigned right shift, or to introduce a new operator
.

Speak-up or potential loose your negative shift-ability
: )

-Jason

- Original Message - 
From: Andrei Zmievski [EMAIL PROTECTED]
To: Andi Gutmans [EMAIL PROTECTED]
Cc: Jason T. Greene [EMAIL PROTECTED]; Jason Greene [EMAIL PROTECTED]; 
[EMAIL PROTECTED]
Sent: Friday, September 07, 2001 8:22 AM
Subject: Re: [Zend Engine 2] Right/Left Shift Zero Fill operator


 On Fri, 07 Sep 2001, Andi Gutmans wrote:
  I guess the reason for this is because some people in C use  1 to divide 
  by 2. I don't think this has had its uses in PHP and I think we should 
  change it to do an unsigned shift.
 
 Maybe you should ask on the php-dev list first.. if anyone uses it for
 division.
 
 -Andrei
 
 In this age, which believes that there is a short cut to everything,
  the greatest lesson to be learned is that the most difficult way is, in
  the long run, the easiest.
 -Henry Miller, The Books in My Life


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Re: [Zend Engine 2] Right/Left Shift Zero Fill operator

2001-09-10 Thread Alexander Wirtz

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Jason et al.,

On Monday 10 September 2001 16:24, Jason Greene wrote:
 Is there anyone out there who uses  on negative numbers?
 There is the discussion on the engine2 list about whether to
 make  an unsigned right shift, or to introduce a new operator
 .

I'd be grateful, if the behaviour of  won't change, as I'm using it in some 
scripts for exactly this purpose. A  is the usual unsigned right-shift in 
c-style languages, it wouldn't hurt to introduce it to PHP as well, would it?

 Speak-up or potential loose your negative shift-ability

Done :)

Best Regards,
Alex

- -- 
| Alexander Wirtz   | eMail: [EMAIL PROTECTED]  |
| web@ctive GmbH|Accidents, Emergency, Ambulance |
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE7nNSEDTqTaMH1weIRAhdBAKCbojb6+0yw1alYGS1tQgydLAcfEQCg24wE
ssB1EoyRTzQY2R1jQhAcJDw=
=zebw
-END PGP SIGNATURE-

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Re: [Zend Engine 2] Re: [PHP-DEV] Re: [Zend Engine 2] Right/Left Shift Zero Fill operator

2001-09-10 Thread Jason Greene

Alexander,

Thanks for the input. If you are interested in other language changes subscribe to 
[EMAIL PROTECTED]

Everyone, 

Well guys we have one person so far who spoke up, 
and you know what they say for every one there is a hundred : )

Due to the existing users out there I would think the new
operator is the way to go.

-Jason




- Original Message - 
From: Alexander Wirtz [EMAIL PROTECTED]
To: Jason Greene [EMAIL PROTECTED]; [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; Andrei Zmievski [EMAIL PROTECTED]; Andi Gutmans 
[EMAIL PROTECTED]
Sent: Monday, September 10, 2001 9:56 AM
Subject: [Zend Engine 2] Re: [PHP-DEV] Re: [Zend Engine 2] Right/Left Shift Zero Fill 
operator


 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Hi Jason et al.,
 
 On Monday 10 September 2001 16:24, Jason Greene wrote:
  Is there anyone out there who uses  on negative numbers?
  There is the discussion on the engine2 list about whether to
  make  an unsigned right shift, or to introduce a new operator
  .
 
 I'd be grateful, if the behaviour of  won't change, as I'm using it in some 
 scripts for exactly this purpose. A  is the usual unsigned right-shift in 
 c-style languages, it wouldn't hurt to introduce it to PHP as well, would it?
 
  Speak-up or potential loose your negative shift-ability
 
 Done :)
 
 Best Regards,
 Alex
 
 - -- 
 | Alexander Wirtz   | eMail: [EMAIL PROTECTED]  |
 | web@ctive GmbH|Accidents, Emergency, Ambulance |
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.0.6 (GNU/Linux)
 Comment: For info see http://www.gnupg.org
 
 iD8DBQE7nNSEDTqTaMH1weIRAhdBAKCbojb6+0yw1alYGS1tQgydLAcfEQCg24wE
 ssB1EoyRTzQY2R1jQhAcJDw=
 =zebw
 -END PGP SIGNATURE-


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Re: [Zend Engine 2] Right/Left Shift Zero Fill operator

2001-09-10 Thread Jeroen van Wolffelaar

 Is there anyone out there who uses  on negative numbers?
 There is the discussion on the engine2 list about whether to
 make  an unsigned right shift, or to introduce a new operator
 .

In my opinion,  and  should consider integers as a row of bits, thus do
not treat the msb differently... I believe you call it shifting unsigned
longs?

You shouldn't use  and  for arithmetic, no 'quick' division by 2 etc...

--Jeroen


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Re: [Zend Engine 2] Right/Left Shift Zero Fill operator

2001-09-10 Thread Vlad Krupin

FWIW:
Signed shift seems to make little sense to me personally, since we are 
just dealing with a row of bits, and if you really want to do a quick 
multiplication/division, you might just as well use a * or / operator - 
it is not going to hurt that much:). *However*, it's been possible in 
different languages since before I had my first computer (e.g. SHL/SHR 
and SAL/SAR in asm x86), so we might provide the same functionality and 
create a new operator to discriminate between signed and unsigned 
shifts.Just a thought. Don't kill me if that would be polluting the 
language.

Vlad

Alexander Wirtz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Jason et al.,

On Monday 10 September 2001 16:24, Jason Greene wrote:

Is there anyone out there who uses  on negative numbers?
There is the discussion on the engine2 list about whether to
make  an unsigned right shift, or to introduce a new operator

.


I'd be grateful, if the behaviour of  won't change, as I'm using it in some 
scripts for exactly this purpose. A  is the usual unsigned right-shift in 
c-style languages, it wouldn't hurt to introduce it to PHP as well, would it?

Speak-up or potential loose your negative shift-ability


Done :)

Best Regards,
Alex

- -- 
| Alexander Wirtz   | eMail: [EMAIL PROTECTED]  |
| web@ctive GmbH|Accidents, Emergency, Ambulance |
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE7nNSEDTqTaMH1weIRAhdBAKCbojb6+0yw1alYGS1tQgydLAcfEQCg24wE
ssB1EoyRTzQY2R1jQhAcJDw=
=zebw
-END PGP SIGNATURE-





-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Re: [Zend Engine 2] Re: [PHP-DEV] Re: [Zend Engine 2] Right/Left Shift Zero Fill operator

2001-09-10 Thread Jeroen van Wolffelaar

 FWIW:
 Signed shift seems to make little sense to me personally, since we are
 just dealing with a row of bits, and if you really want to do a quick
 multiplication/division, you might just as well use a * or / operator -
 it is not going to hurt that much:).

I completely agree

 *However*, it's been possible in
 different languages since before I had my first computer (e.g. SHL/SHR
 and SAL/SAR in asm x86), so we might provide the same functionality and
 create a new operator to discriminate between signed and unsigned
 shifts.Just a thought. Don't kill me if that would be polluting the
 language.

IMHO: If other languages have strange things, I don't see why PHP should
take it over... Don't copy bad operators!
But... currently, how does PHP handle this? I'm afraid the wrong way?

--Jeroen



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Re: [Zend Engine 2] Right/Left Shift Zero Fill operator

2001-09-10 Thread Alexander Wirtz

Hi Jeroen,

to give a little bit background, as a student of computersciences I happen
to work with bitshift not as a means of having a quick multiplication or
division, but as using it to manipulate bit-patterns.
The distinction between signed and unsigned rightshift is nothing strange,
obscure or redundant, but is implemented down to the machine-language
itsself (dependent on cpu-architecture).
So this is no bad operator, but one of the most crucial operators on
bit-patterns. I don't want to sound arrogant (saying this is almost always a
sure sign, that it will ;-) ) but maybe you should inform yourself the next
time why other languages have this operator implemented.
Disabling signed shifting will force me to turn back to perl, as I use this
feature for quick hacking certain scripts I use at the University (and that
would be a very cruel thing to do :o) ) - besides, it would disregard the
holy BC...

Cheers  flames on (constructive comments are welcome),

Alexander

-- 
| Alexander Wirtz   | eMail: [EMAIL PROTECTED]  |
| web@ctive GmbH| Accidents, Emergency, Ambulance|

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Re: Re: [Zend Engine 2] Re: [PHP-DEV] Re: [Zend Engine 2] Right/Left Shift Zero Fill operator

2001-09-10 Thread Jason T . Greene


 
 From: Jeroen van Wolffelaar [EMAIL PROTECTED]
 Date: 2001/09/10 Mon PM 01:58:03 CDT
 To: Vlad Krupin [EMAIL PROTECTED],
   Alexander Wirtz [EMAIL PROTECTED]
 CC: Jason Greene [EMAIL PROTECTED],
   [EMAIL PROTECTED],
   [EMAIL PROTECTED],
   Andrei Zmievski [EMAIL PROTECTED],
   Andi Gutmans [EMAIL PROTECTED]
 Subject: Re: [Zend Engine 2] Re: [PHP-DEV] Re: [Zend Engine 2] Right/Left Shift Zero 
Fill operator
 
  FWIW:
  Signed shift seems to make little sense to me personally, since we are
  just dealing with a row of bits, and if you really want to do a quick
  multiplication/division, you might just as well use a * or / operator -
  it is not going to hurt that much:).
 
 I completely agree

Which is faster, adding a number several hundred times
or shifting a few bits?
(no need to answer just making a point)

 
  *However*, it's been possible in
  different languages since before I had my first computer (e.g. SHL/SHR
  and SAL/SAR in asm x86), so we might provide the same functionality and
  create a new operator to discriminate between signed and unsigned
  shifts.Just a thought. Don't kill me if that would be polluting the
  language.
 
 IMHO: If other languages have strange things, I don't see why PHP should
 take it over... Don't copy bad operators!
 But... currently, how does PHP handle this? I'm afraid the wrong way?
 
 --Jeroen
Yep the signed way.

PHP just calls C's , which shifts according to 
the datatype. If the datatype is signed (which in php it is)
it performs a signed shift, if it is unsigned it performs an unsigned shift. The 
problem lies in the fact that a loosely typed language has no concept of sign/unsigned 
types. Java got around this by creating a new operator for unsigned shifting . 

I personally have never had a need to shift signed values, but someone has spoken up 
that does, and as such I believe we should leave compatibility with this. 

It looks like we have no choice but to follow java on this one. Does anyone disagree?

-Jason





 
 


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]