Jump to content

operater xor (^)


peeratep

Recommended Posts

intersting relationship between the second integer and the linux result

[code]<?php
$a = 1136121015;
$b = -1011362633;
echo '<pre>';
printf ('%032s %12d<br>%032s %12d linux<br>',
decbin($a), $a, decbin($b), $b);
echo '</pre>';
?>[/code]

-->[pre]
01000011101101111101010010110111  1136121015
11000011101101111101010010110111  -1011362633 linux
[/pre]
Link to comment
https://forums.phpfreaks.com/topic/15863-operater-xor/#findComment-65415
Share on other sites

From wiki:

[quote]
The standard Unix time_t (data type representing a point in time) is a signed integer data type, traditionally of 32 bits (but see below), directly encoding the Unix time number as described in the preceding section. Being integer means that it has a resolution of one second; many Unix applications therefore handle time only to that resolution. [b]Being 32 bits (of which one bit is the sign bit)[/b] means that it covers a range of about 68 years in total.
[/quote]

How does Windows handle signed integers?
Link to comment
https://forums.phpfreaks.com/topic/15863-operater-xor/#findComment-65426
Share on other sites

Does this clarify ?

[code]
<?php
$a = 31;
$b = -31;
echo '<pre>';
printf ('%032s %12d<br>%032s %12d<br>',
decbin($a), $a, decbin($b), $b);
echo '</pre>';
?>[/code]
-->[pre]
00000000000000000000000000011111          31
11111111111111111111111111100001          -31
[/pre]
Link to comment
https://forums.phpfreaks.com/topic/15863-operater-xor/#findComment-65429
Share on other sites

From the guys (ikegami) over at www.perlmonks.net:

[quote]
Unix and Windows handle signs the same way: 2's complement.
The problem is that -2147483648 is the largest negative that can be stored in 32 bits.
Well, the problem is that -2694274578 is larger than -2147483648, but you are using 32 bit numbers.
[/quote]
Link to comment
https://forums.phpfreaks.com/topic/15863-operater-xor/#findComment-65430
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.