You are here: Re: Xor bug in all PHP versions « PHP Programming Language « IT news, forums, messages
Re: Xor bug in all PHP versions

Posted by Chung Leong on 01/24/06 17:45

Oli Filth wrote:

> As a side-note:
> I don't like the fact that even basic PHP code isn't portable between
> platforms, i.e. it doesn't abstract away differences in platform bitwise
> implementations of signed values.

I don't really see why the operation would be platform dependent. If I
remember correctly, a long is defined as 32 bit. Int is the one that
varies between architectures. In PHP, a convert from double to integer
is done by the DVAL_TO_LVAL macro, which is defined as:

(l) = (d) > LONG_MAX ? (unsigned long) (d) : (long) (d)

A cast to long should be the same even on a 64 bit OS/CPU.

I wonder if it's a difference in the compiler or C library. Typically a
cast from a float to a long is handled with a call to ftol(). Maybe the
overflow behavior is different.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация