numbers getting changed (wrongly) with convert_to_long_ex()?
| From: | Leon Breedt | Date: | Mon, 12 Jun 2000 04:56:59 +0000 |
| Subject: | numbers getting changed (wrongly) with convert_to_long_ex()? | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-21074@lists.php.net to get a copy of this message | ||
Hi.
This is my first attempt to hack PHP, so if I'm making any stupid
assumptions, I apologize...
However, I'm having problems with adding on an ntohl() function.
It seems that when I pass the argument 4294967295 (max size of ulong)
to my ntohl() wrapper, some bits get lost or changed, as after a
convert_to_long_ex(), i'm left with 2147483648 in the lval (this
is when I cast the lval to an unsigned long value and do a debug
php_error() message.
This could be a problem if you're trying to interface with a binary
TCP protocol, I think...Or is it just a problem with using long
literals of that length/size in php source code?
Attached is the source for the wrapper function, and the source I
used to test.
Any comments/suggestions appreciated, note that I'm not
subscribed to the list yet, please CC me with replies.
Thanks,
Leon.
--
( Leon Breedt : ljb@debian.org )
( Developer, Obsidian Systems : http://obsidianlinux.com )
Attachment: [text/x-csrc] qlib.c
Attachment: [application/x-httpd-php] test.php
Attachment: [text/x-csrc] qlib.c
Attachment: [application/x-httpd-php] test.php