473,387 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

PHP on Solaris (2.6) and integer overflow

Hi all,

I have PHP version 4.4 installed on a Soaris 2.6 system and I'm getting
strange results doing math/boolean operators. I have a hashing
algorithm that does multiplication, bitwise operations and mod() calls
interatively on the characters of a filename. On a linux platform the
multiplications start to overflow (as I expect) and the overflow is
just dropped. The lower three bytes are masked off like this:

$result = $result & 0x00FFFFFF;

and the loop continues. On the Solaris platform the multiplication
fails very quickly in the loop, and it looks like the overflow bits are
wrapped around onto the lower order bytes, eventually I end up with an
interger value of 0x00FFFFFF because of the masking above. To solve the
problem I had to compile the gmp_* function support into PHP and work
with the gmp_* family of functions.

Has anyone ever seen this behavior before, and if so can you enlighten
me about it?

Thanks,
Doug

Dec 28 '05 #1
0 1094

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
by: junky_fellow | last post by:
Is there any way by which the overflow during addition of two integers may be detected ? eg. suppose we have three unsigned integers, a ,b, c. we are doing a check like if ((a +b) > c) do...
40
by: Robert Seacord | last post by:
The CERT/CC has released a beta version of a secure integer library for the C Programming Language. The library is available for download from the CERT/CC Secure Coding Initiative web page at:...
42
by: thomas.mertes | last post by:
Is it possible to use some C or compiler extension to catch integer overflow? The situation is as follows: I use C as target language for compiled Seed7 programs. For integer computions the C...
0
by: dot.yet | last post by:
Hi Everyone, environment: DB2 9.5 WSE with FP 2a Solaris 10 u5 - 64-bit SMP - 2 Quad CPUS - total 8 cores 16 GB RAM SAMPLE database Solaris Containers
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.