1--TEST--
2Test >> operator : 64bit long tests
3--SKIPIF--
4<?php
5if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
6if (strtolower(php_uname('m')) != 'x86_64') die("skip this test is for x86_64 platforms only");
7?>
8--FILE--
9<?php
10
11define("MAX_64Bit", 9223372036854775807);
12define("MAX_32Bit", 2147483647);
13define("MIN_64Bit", -9223372036854775807 - 1);
14define("MIN_32Bit", -2147483647 - 1);
15
16$longVals = array(
17    MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
18    MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
19    MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
20);
21
22$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MAX_64Bit);
23
24error_reporting(E_ERROR);
25
26foreach ($longVals as $longVal) {
27   foreach($otherVals as $otherVal) {
28	   echo "--- testing: $longVal >> $otherVal ---\n";
29      var_dump($longVal>>$otherVal);
30   }
31}
32
33foreach ($otherVals as $otherVal) {
34   foreach($longVals as $longVal) {
35	   echo "--- testing: $otherVal >> $longVal ---\n";
36      var_dump($otherVal>>$longVal);
37   }
38}
39
40?>
41===DONE===
42--EXPECT--
43--- testing: 9223372036854775807 >> 0 ---
44int(9223372036854775807)
45--- testing: 9223372036854775807 >> 1 ---
46int(4611686018427387903)
47--- testing: 9223372036854775807 >> -1 ---
48int(0)
49--- testing: 9223372036854775807 >> 7 ---
50int(72057594037927935)
51--- testing: 9223372036854775807 >> 9 ---
52int(18014398509481983)
53--- testing: 9223372036854775807 >> 65 ---
54int(4611686018427387903)
55--- testing: 9223372036854775807 >> -44 ---
56int(8796093022207)
57--- testing: 9223372036854775807 >> 2147483647 ---
58int(0)
59--- testing: 9223372036854775807 >> 9223372036854775807 ---
60int(0)
61--- testing: -9223372036854775808 >> 0 ---
62int(-9223372036854775808)
63--- testing: -9223372036854775808 >> 1 ---
64int(-4611686018427387904)
65--- testing: -9223372036854775808 >> -1 ---
66int(-1)
67--- testing: -9223372036854775808 >> 7 ---
68int(-72057594037927936)
69--- testing: -9223372036854775808 >> 9 ---
70int(-18014398509481984)
71--- testing: -9223372036854775808 >> 65 ---
72int(-4611686018427387904)
73--- testing: -9223372036854775808 >> -44 ---
74int(-8796093022208)
75--- testing: -9223372036854775808 >> 2147483647 ---
76int(-1)
77--- testing: -9223372036854775808 >> 9223372036854775807 ---
78int(-1)
79--- testing: 2147483647 >> 0 ---
80int(2147483647)
81--- testing: 2147483647 >> 1 ---
82int(1073741823)
83--- testing: 2147483647 >> -1 ---
84int(0)
85--- testing: 2147483647 >> 7 ---
86int(16777215)
87--- testing: 2147483647 >> 9 ---
88int(4194303)
89--- testing: 2147483647 >> 65 ---
90int(1073741823)
91--- testing: 2147483647 >> -44 ---
92int(2047)
93--- testing: 2147483647 >> 2147483647 ---
94int(0)
95--- testing: 2147483647 >> 9223372036854775807 ---
96int(0)
97--- testing: -2147483648 >> 0 ---
98int(-2147483648)
99--- testing: -2147483648 >> 1 ---
100int(-1073741824)
101--- testing: -2147483648 >> -1 ---
102int(-1)
103--- testing: -2147483648 >> 7 ---
104int(-16777216)
105--- testing: -2147483648 >> 9 ---
106int(-4194304)
107--- testing: -2147483648 >> 65 ---
108int(-1073741824)
109--- testing: -2147483648 >> -44 ---
110int(-2048)
111--- testing: -2147483648 >> 2147483647 ---
112int(-1)
113--- testing: -2147483648 >> 9223372036854775807 ---
114int(-1)
115--- testing: 9223372034707292160 >> 0 ---
116int(9223372034707292160)
117--- testing: 9223372034707292160 >> 1 ---
118int(4611686017353646080)
119--- testing: 9223372034707292160 >> -1 ---
120int(0)
121--- testing: 9223372034707292160 >> 7 ---
122int(72057594021150720)
123--- testing: 9223372034707292160 >> 9 ---
124int(18014398505287680)
125--- testing: 9223372034707292160 >> 65 ---
126int(4611686017353646080)
127--- testing: 9223372034707292160 >> -44 ---
128int(8796093020160)
129--- testing: 9223372034707292160 >> 2147483647 ---
130int(0)
131--- testing: 9223372034707292160 >> 9223372036854775807 ---
132int(0)
133--- testing: -9223372034707292160 >> 0 ---
134int(-9223372034707292160)
135--- testing: -9223372034707292160 >> 1 ---
136int(-4611686017353646080)
137--- testing: -9223372034707292160 >> -1 ---
138int(-1)
139--- testing: -9223372034707292160 >> 7 ---
140int(-72057594021150720)
141--- testing: -9223372034707292160 >> 9 ---
142int(-18014398505287680)
143--- testing: -9223372034707292160 >> 65 ---
144int(-4611686017353646080)
145--- testing: -9223372034707292160 >> -44 ---
146int(-8796093020160)
147--- testing: -9223372034707292160 >> 2147483647 ---
148int(-1)
149--- testing: -9223372034707292160 >> 9223372036854775807 ---
150int(-1)
151--- testing: 2147483648 >> 0 ---
152int(2147483648)
153--- testing: 2147483648 >> 1 ---
154int(1073741824)
155--- testing: 2147483648 >> -1 ---
156int(0)
157--- testing: 2147483648 >> 7 ---
158int(16777216)
159--- testing: 2147483648 >> 9 ---
160int(4194304)
161--- testing: 2147483648 >> 65 ---
162int(1073741824)
163--- testing: 2147483648 >> -44 ---
164int(2048)
165--- testing: 2147483648 >> 2147483647 ---
166int(0)
167--- testing: 2147483648 >> 9223372036854775807 ---
168int(0)
169--- testing: -2147483649 >> 0 ---
170int(-2147483649)
171--- testing: -2147483649 >> 1 ---
172int(-1073741825)
173--- testing: -2147483649 >> -1 ---
174int(-1)
175--- testing: -2147483649 >> 7 ---
176int(-16777217)
177--- testing: -2147483649 >> 9 ---
178int(-4194305)
179--- testing: -2147483649 >> 65 ---
180int(-1073741825)
181--- testing: -2147483649 >> -44 ---
182int(-2049)
183--- testing: -2147483649 >> 2147483647 ---
184int(-1)
185--- testing: -2147483649 >> 9223372036854775807 ---
186int(-1)
187--- testing: 4294967294 >> 0 ---
188int(4294967294)
189--- testing: 4294967294 >> 1 ---
190int(2147483647)
191--- testing: 4294967294 >> -1 ---
192int(0)
193--- testing: 4294967294 >> 7 ---
194int(33554431)
195--- testing: 4294967294 >> 9 ---
196int(8388607)
197--- testing: 4294967294 >> 65 ---
198int(2147483647)
199--- testing: 4294967294 >> -44 ---
200int(4095)
201--- testing: 4294967294 >> 2147483647 ---
202int(0)
203--- testing: 4294967294 >> 9223372036854775807 ---
204int(0)
205--- testing: 4294967295 >> 0 ---
206int(4294967295)
207--- testing: 4294967295 >> 1 ---
208int(2147483647)
209--- testing: 4294967295 >> -1 ---
210int(0)
211--- testing: 4294967295 >> 7 ---
212int(33554431)
213--- testing: 4294967295 >> 9 ---
214int(8388607)
215--- testing: 4294967295 >> 65 ---
216int(2147483647)
217--- testing: 4294967295 >> -44 ---
218int(4095)
219--- testing: 4294967295 >> 2147483647 ---
220int(0)
221--- testing: 4294967295 >> 9223372036854775807 ---
222int(0)
223--- testing: 4294967293 >> 0 ---
224int(4294967293)
225--- testing: 4294967293 >> 1 ---
226int(2147483646)
227--- testing: 4294967293 >> -1 ---
228int(0)
229--- testing: 4294967293 >> 7 ---
230int(33554431)
231--- testing: 4294967293 >> 9 ---
232int(8388607)
233--- testing: 4294967293 >> 65 ---
234int(2147483646)
235--- testing: 4294967293 >> -44 ---
236int(4095)
237--- testing: 4294967293 >> 2147483647 ---
238int(0)
239--- testing: 4294967293 >> 9223372036854775807 ---
240int(0)
241--- testing: 9223372036854775806 >> 0 ---
242int(9223372036854775806)
243--- testing: 9223372036854775806 >> 1 ---
244int(4611686018427387903)
245--- testing: 9223372036854775806 >> -1 ---
246int(0)
247--- testing: 9223372036854775806 >> 7 ---
248int(72057594037927935)
249--- testing: 9223372036854775806 >> 9 ---
250int(18014398509481983)
251--- testing: 9223372036854775806 >> 65 ---
252int(4611686018427387903)
253--- testing: 9223372036854775806 >> -44 ---
254int(8796093022207)
255--- testing: 9223372036854775806 >> 2147483647 ---
256int(0)
257--- testing: 9223372036854775806 >> 9223372036854775807 ---
258int(0)
259--- testing: 9.2233720368548E+18 >> 0 ---
260int(-9223372036854775808)
261--- testing: 9.2233720368548E+18 >> 1 ---
262int(-4611686018427387904)
263--- testing: 9.2233720368548E+18 >> -1 ---
264int(-1)
265--- testing: 9.2233720368548E+18 >> 7 ---
266int(-72057594037927936)
267--- testing: 9.2233720368548E+18 >> 9 ---
268int(-18014398509481984)
269--- testing: 9.2233720368548E+18 >> 65 ---
270int(-4611686018427387904)
271--- testing: 9.2233720368548E+18 >> -44 ---
272int(-8796093022208)
273--- testing: 9.2233720368548E+18 >> 2147483647 ---
274int(-1)
275--- testing: 9.2233720368548E+18 >> 9223372036854775807 ---
276int(-1)
277--- testing: -9223372036854775807 >> 0 ---
278int(-9223372036854775807)
279--- testing: -9223372036854775807 >> 1 ---
280int(-4611686018427387904)
281--- testing: -9223372036854775807 >> -1 ---
282int(-1)
283--- testing: -9223372036854775807 >> 7 ---
284int(-72057594037927936)
285--- testing: -9223372036854775807 >> 9 ---
286int(-18014398509481984)
287--- testing: -9223372036854775807 >> 65 ---
288int(-4611686018427387904)
289--- testing: -9223372036854775807 >> -44 ---
290int(-8796093022208)
291--- testing: -9223372036854775807 >> 2147483647 ---
292int(-1)
293--- testing: -9223372036854775807 >> 9223372036854775807 ---
294int(-1)
295--- testing: -9.2233720368548E+18 >> 0 ---
296int(-9223372036854775808)
297--- testing: -9.2233720368548E+18 >> 1 ---
298int(-4611686018427387904)
299--- testing: -9.2233720368548E+18 >> -1 ---
300int(-1)
301--- testing: -9.2233720368548E+18 >> 7 ---
302int(-72057594037927936)
303--- testing: -9.2233720368548E+18 >> 9 ---
304int(-18014398509481984)
305--- testing: -9.2233720368548E+18 >> 65 ---
306int(-4611686018427387904)
307--- testing: -9.2233720368548E+18 >> -44 ---
308int(-8796093022208)
309--- testing: -9.2233720368548E+18 >> 2147483647 ---
310int(-1)
311--- testing: -9.2233720368548E+18 >> 9223372036854775807 ---
312int(-1)
313--- testing: 0 >> 9223372036854775807 ---
314int(0)
315--- testing: 0 >> -9223372036854775808 ---
316int(0)
317--- testing: 0 >> 2147483647 ---
318int(0)
319--- testing: 0 >> -2147483648 ---
320int(0)
321--- testing: 0 >> 9223372034707292160 ---
322int(0)
323--- testing: 0 >> -9223372034707292160 ---
324int(0)
325--- testing: 0 >> 2147483648 ---
326int(0)
327--- testing: 0 >> -2147483649 ---
328int(0)
329--- testing: 0 >> 4294967294 ---
330int(0)
331--- testing: 0 >> 4294967295 ---
332int(0)
333--- testing: 0 >> 4294967293 ---
334int(0)
335--- testing: 0 >> 9223372036854775806 ---
336int(0)
337--- testing: 0 >> 9.2233720368548E+18 ---
338int(0)
339--- testing: 0 >> -9223372036854775807 ---
340int(0)
341--- testing: 0 >> -9.2233720368548E+18 ---
342int(0)
343--- testing: 1 >> 9223372036854775807 ---
344int(0)
345--- testing: 1 >> -9223372036854775808 ---
346int(1)
347--- testing: 1 >> 2147483647 ---
348int(0)
349--- testing: 1 >> -2147483648 ---
350int(1)
351--- testing: 1 >> 9223372034707292160 ---
352int(1)
353--- testing: 1 >> -9223372034707292160 ---
354int(1)
355--- testing: 1 >> 2147483648 ---
356int(1)
357--- testing: 1 >> -2147483649 ---
358int(0)
359--- testing: 1 >> 4294967294 ---
360int(0)
361--- testing: 1 >> 4294967295 ---
362int(0)
363--- testing: 1 >> 4294967293 ---
364int(0)
365--- testing: 1 >> 9223372036854775806 ---
366int(0)
367--- testing: 1 >> 9.2233720368548E+18 ---
368int(1)
369--- testing: 1 >> -9223372036854775807 ---
370int(0)
371--- testing: 1 >> -9.2233720368548E+18 ---
372int(1)
373--- testing: -1 >> 9223372036854775807 ---
374int(-1)
375--- testing: -1 >> -9223372036854775808 ---
376int(-1)
377--- testing: -1 >> 2147483647 ---
378int(-1)
379--- testing: -1 >> -2147483648 ---
380int(-1)
381--- testing: -1 >> 9223372034707292160 ---
382int(-1)
383--- testing: -1 >> -9223372034707292160 ---
384int(-1)
385--- testing: -1 >> 2147483648 ---
386int(-1)
387--- testing: -1 >> -2147483649 ---
388int(-1)
389--- testing: -1 >> 4294967294 ---
390int(-1)
391--- testing: -1 >> 4294967295 ---
392int(-1)
393--- testing: -1 >> 4294967293 ---
394int(-1)
395--- testing: -1 >> 9223372036854775806 ---
396int(-1)
397--- testing: -1 >> 9.2233720368548E+18 ---
398int(-1)
399--- testing: -1 >> -9223372036854775807 ---
400int(-1)
401--- testing: -1 >> -9.2233720368548E+18 ---
402int(-1)
403--- testing: 7 >> 9223372036854775807 ---
404int(0)
405--- testing: 7 >> -9223372036854775808 ---
406int(7)
407--- testing: 7 >> 2147483647 ---
408int(0)
409--- testing: 7 >> -2147483648 ---
410int(7)
411--- testing: 7 >> 9223372034707292160 ---
412int(7)
413--- testing: 7 >> -9223372034707292160 ---
414int(7)
415--- testing: 7 >> 2147483648 ---
416int(7)
417--- testing: 7 >> -2147483649 ---
418int(0)
419--- testing: 7 >> 4294967294 ---
420int(0)
421--- testing: 7 >> 4294967295 ---
422int(0)
423--- testing: 7 >> 4294967293 ---
424int(0)
425--- testing: 7 >> 9223372036854775806 ---
426int(0)
427--- testing: 7 >> 9.2233720368548E+18 ---
428int(7)
429--- testing: 7 >> -9223372036854775807 ---
430int(3)
431--- testing: 7 >> -9.2233720368548E+18 ---
432int(7)
433--- testing: 9 >> 9223372036854775807 ---
434int(0)
435--- testing: 9 >> -9223372036854775808 ---
436int(9)
437--- testing: 9 >> 2147483647 ---
438int(0)
439--- testing: 9 >> -2147483648 ---
440int(9)
441--- testing: 9 >> 9223372034707292160 ---
442int(9)
443--- testing: 9 >> -9223372034707292160 ---
444int(9)
445--- testing: 9 >> 2147483648 ---
446int(9)
447--- testing: 9 >> -2147483649 ---
448int(0)
449--- testing: 9 >> 4294967294 ---
450int(0)
451--- testing: 9 >> 4294967295 ---
452int(0)
453--- testing: 9 >> 4294967293 ---
454int(0)
455--- testing: 9 >> 9223372036854775806 ---
456int(0)
457--- testing: 9 >> 9.2233720368548E+18 ---
458int(9)
459--- testing: 9 >> -9223372036854775807 ---
460int(4)
461--- testing: 9 >> -9.2233720368548E+18 ---
462int(9)
463--- testing: 65 >> 9223372036854775807 ---
464int(0)
465--- testing: 65 >> -9223372036854775808 ---
466int(65)
467--- testing: 65 >> 2147483647 ---
468int(0)
469--- testing: 65 >> -2147483648 ---
470int(65)
471--- testing: 65 >> 9223372034707292160 ---
472int(65)
473--- testing: 65 >> -9223372034707292160 ---
474int(65)
475--- testing: 65 >> 2147483648 ---
476int(65)
477--- testing: 65 >> -2147483649 ---
478int(0)
479--- testing: 65 >> 4294967294 ---
480int(0)
481--- testing: 65 >> 4294967295 ---
482int(0)
483--- testing: 65 >> 4294967293 ---
484int(0)
485--- testing: 65 >> 9223372036854775806 ---
486int(0)
487--- testing: 65 >> 9.2233720368548E+18 ---
488int(65)
489--- testing: 65 >> -9223372036854775807 ---
490int(32)
491--- testing: 65 >> -9.2233720368548E+18 ---
492int(65)
493--- testing: -44 >> 9223372036854775807 ---
494int(-1)
495--- testing: -44 >> -9223372036854775808 ---
496int(-44)
497--- testing: -44 >> 2147483647 ---
498int(-1)
499--- testing: -44 >> -2147483648 ---
500int(-44)
501--- testing: -44 >> 9223372034707292160 ---
502int(-44)
503--- testing: -44 >> -9223372034707292160 ---
504int(-44)
505--- testing: -44 >> 2147483648 ---
506int(-44)
507--- testing: -44 >> -2147483649 ---
508int(-1)
509--- testing: -44 >> 4294967294 ---
510int(-1)
511--- testing: -44 >> 4294967295 ---
512int(-1)
513--- testing: -44 >> 4294967293 ---
514int(-1)
515--- testing: -44 >> 9223372036854775806 ---
516int(-1)
517--- testing: -44 >> 9.2233720368548E+18 ---
518int(-44)
519--- testing: -44 >> -9223372036854775807 ---
520int(-22)
521--- testing: -44 >> -9.2233720368548E+18 ---
522int(-44)
523--- testing: 2147483647 >> 9223372036854775807 ---
524int(0)
525--- testing: 2147483647 >> -9223372036854775808 ---
526int(2147483647)
527--- testing: 2147483647 >> 2147483647 ---
528int(0)
529--- testing: 2147483647 >> -2147483648 ---
530int(2147483647)
531--- testing: 2147483647 >> 9223372034707292160 ---
532int(2147483647)
533--- testing: 2147483647 >> -9223372034707292160 ---
534int(2147483647)
535--- testing: 2147483647 >> 2147483648 ---
536int(2147483647)
537--- testing: 2147483647 >> -2147483649 ---
538int(0)
539--- testing: 2147483647 >> 4294967294 ---
540int(0)
541--- testing: 2147483647 >> 4294967295 ---
542int(0)
543--- testing: 2147483647 >> 4294967293 ---
544int(0)
545--- testing: 2147483647 >> 9223372036854775806 ---
546int(0)
547--- testing: 2147483647 >> 9.2233720368548E+18 ---
548int(2147483647)
549--- testing: 2147483647 >> -9223372036854775807 ---
550int(1073741823)
551--- testing: 2147483647 >> -9.2233720368548E+18 ---
552int(2147483647)
553--- testing: 9223372036854775807 >> 9223372036854775807 ---
554int(0)
555--- testing: 9223372036854775807 >> -9223372036854775808 ---
556int(9223372036854775807)
557--- testing: 9223372036854775807 >> 2147483647 ---
558int(0)
559--- testing: 9223372036854775807 >> -2147483648 ---
560int(9223372036854775807)
561--- testing: 9223372036854775807 >> 9223372034707292160 ---
562int(9223372036854775807)
563--- testing: 9223372036854775807 >> -9223372034707292160 ---
564int(9223372036854775807)
565--- testing: 9223372036854775807 >> 2147483648 ---
566int(9223372036854775807)
567--- testing: 9223372036854775807 >> -2147483649 ---
568int(0)
569--- testing: 9223372036854775807 >> 4294967294 ---
570int(1)
571--- testing: 9223372036854775807 >> 4294967295 ---
572int(0)
573--- testing: 9223372036854775807 >> 4294967293 ---
574int(3)
575--- testing: 9223372036854775807 >> 9223372036854775806 ---
576int(1)
577--- testing: 9223372036854775807 >> 9.2233720368548E+18 ---
578int(9223372036854775807)
579--- testing: 9223372036854775807 >> -9223372036854775807 ---
580int(4611686018427387903)
581--- testing: 9223372036854775807 >> -9.2233720368548E+18 ---
582int(9223372036854775807)
583===DONE===
584