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(-2)
47--- testing: 9223372036854775807 << -1 ---
48int(-9223372036854775808)
49--- testing: 9223372036854775807 << 7 ---
50int(-128)
51--- testing: 9223372036854775807 << 9 ---
52int(-512)
53--- testing: 9223372036854775807 << 65 ---
54int(-2)
55--- testing: 9223372036854775807 << -44 ---
56int(-1048576)
57--- testing: 9223372036854775807 << 2147483647 ---
58int(-9223372036854775808)
59--- testing: 9223372036854775807 << 9223372036854775807 ---
60int(-9223372036854775808)
61--- testing: -9223372036854775808 << 0 ---
62int(-9223372036854775808)
63--- testing: -9223372036854775808 << 1 ---
64int(0)
65--- testing: -9223372036854775808 << -1 ---
66int(0)
67--- testing: -9223372036854775808 << 7 ---
68int(0)
69--- testing: -9223372036854775808 << 9 ---
70int(0)
71--- testing: -9223372036854775808 << 65 ---
72int(0)
73--- testing: -9223372036854775808 << -44 ---
74int(0)
75--- testing: -9223372036854775808 << 2147483647 ---
76int(0)
77--- testing: -9223372036854775808 << 9223372036854775807 ---
78int(0)
79--- testing: 2147483647 << 0 ---
80int(2147483647)
81--- testing: 2147483647 << 1 ---
82int(4294967294)
83--- testing: 2147483647 << -1 ---
84int(-9223372036854775808)
85--- testing: 2147483647 << 7 ---
86int(274877906816)
87--- testing: 2147483647 << 9 ---
88int(1099511627264)
89--- testing: 2147483647 << 65 ---
90int(4294967294)
91--- testing: 2147483647 << -44 ---
92int(2251799812636672)
93--- testing: 2147483647 << 2147483647 ---
94int(-9223372036854775808)
95--- testing: 2147483647 << 9223372036854775807 ---
96int(-9223372036854775808)
97--- testing: -2147483648 << 0 ---
98int(-2147483648)
99--- testing: -2147483648 << 1 ---
100int(-4294967296)
101--- testing: -2147483648 << -1 ---
102int(0)
103--- testing: -2147483648 << 7 ---
104int(-274877906944)
105--- testing: -2147483648 << 9 ---
106int(-1099511627776)
107--- testing: -2147483648 << 65 ---
108int(-4294967296)
109--- testing: -2147483648 << -44 ---
110int(-2251799813685248)
111--- testing: -2147483648 << 2147483647 ---
112int(0)
113--- testing: -2147483648 << 9223372036854775807 ---
114int(0)
115--- testing: 9223372034707292160 << 0 ---
116int(9223372034707292160)
117--- testing: 9223372034707292160 << 1 ---
118int(-4294967296)
119--- testing: 9223372034707292160 << -1 ---
120int(0)
121--- testing: 9223372034707292160 << 7 ---
122int(-274877906944)
123--- testing: 9223372034707292160 << 9 ---
124int(-1099511627776)
125--- testing: 9223372034707292160 << 65 ---
126int(-4294967296)
127--- testing: 9223372034707292160 << -44 ---
128int(-2251799813685248)
129--- testing: 9223372034707292160 << 2147483647 ---
130int(0)
131--- testing: 9223372034707292160 << 9223372036854775807 ---
132int(0)
133--- testing: -9223372034707292160 << 0 ---
134int(-9223372034707292160)
135--- testing: -9223372034707292160 << 1 ---
136int(4294967296)
137--- testing: -9223372034707292160 << -1 ---
138int(0)
139--- testing: -9223372034707292160 << 7 ---
140int(274877906944)
141--- testing: -9223372034707292160 << 9 ---
142int(1099511627776)
143--- testing: -9223372034707292160 << 65 ---
144int(4294967296)
145--- testing: -9223372034707292160 << -44 ---
146int(2251799813685248)
147--- testing: -9223372034707292160 << 2147483647 ---
148int(0)
149--- testing: -9223372034707292160 << 9223372036854775807 ---
150int(0)
151--- testing: 2147483648 << 0 ---
152int(2147483648)
153--- testing: 2147483648 << 1 ---
154int(4294967296)
155--- testing: 2147483648 << -1 ---
156int(0)
157--- testing: 2147483648 << 7 ---
158int(274877906944)
159--- testing: 2147483648 << 9 ---
160int(1099511627776)
161--- testing: 2147483648 << 65 ---
162int(4294967296)
163--- testing: 2147483648 << -44 ---
164int(2251799813685248)
165--- testing: 2147483648 << 2147483647 ---
166int(0)
167--- testing: 2147483648 << 9223372036854775807 ---
168int(0)
169--- testing: -2147483649 << 0 ---
170int(-2147483649)
171--- testing: -2147483649 << 1 ---
172int(-4294967298)
173--- testing: -2147483649 << -1 ---
174int(-9223372036854775808)
175--- testing: -2147483649 << 7 ---
176int(-274877907072)
177--- testing: -2147483649 << 9 ---
178int(-1099511628288)
179--- testing: -2147483649 << 65 ---
180int(-4294967298)
181--- testing: -2147483649 << -44 ---
182int(-2251799814733824)
183--- testing: -2147483649 << 2147483647 ---
184int(-9223372036854775808)
185--- testing: -2147483649 << 9223372036854775807 ---
186int(-9223372036854775808)
187--- testing: 4294967294 << 0 ---
188int(4294967294)
189--- testing: 4294967294 << 1 ---
190int(8589934588)
191--- testing: 4294967294 << -1 ---
192int(0)
193--- testing: 4294967294 << 7 ---
194int(549755813632)
195--- testing: 4294967294 << 9 ---
196int(2199023254528)
197--- testing: 4294967294 << 65 ---
198int(8589934588)
199--- testing: 4294967294 << -44 ---
200int(4503599625273344)
201--- testing: 4294967294 << 2147483647 ---
202int(0)
203--- testing: 4294967294 << 9223372036854775807 ---
204int(0)
205--- testing: 4294967295 << 0 ---
206int(4294967295)
207--- testing: 4294967295 << 1 ---
208int(8589934590)
209--- testing: 4294967295 << -1 ---
210int(-9223372036854775808)
211--- testing: 4294967295 << 7 ---
212int(549755813760)
213--- testing: 4294967295 << 9 ---
214int(2199023255040)
215--- testing: 4294967295 << 65 ---
216int(8589934590)
217--- testing: 4294967295 << -44 ---
218int(4503599626321920)
219--- testing: 4294967295 << 2147483647 ---
220int(-9223372036854775808)
221--- testing: 4294967295 << 9223372036854775807 ---
222int(-9223372036854775808)
223--- testing: 4294967293 << 0 ---
224int(4294967293)
225--- testing: 4294967293 << 1 ---
226int(8589934586)
227--- testing: 4294967293 << -1 ---
228int(-9223372036854775808)
229--- testing: 4294967293 << 7 ---
230int(549755813504)
231--- testing: 4294967293 << 9 ---
232int(2199023254016)
233--- testing: 4294967293 << 65 ---
234int(8589934586)
235--- testing: 4294967293 << -44 ---
236int(4503599624224768)
237--- testing: 4294967293 << 2147483647 ---
238int(-9223372036854775808)
239--- testing: 4294967293 << 9223372036854775807 ---
240int(-9223372036854775808)
241--- testing: 9223372036854775806 << 0 ---
242int(9223372036854775806)
243--- testing: 9223372036854775806 << 1 ---
244int(-4)
245--- testing: 9223372036854775806 << -1 ---
246int(0)
247--- testing: 9223372036854775806 << 7 ---
248int(-256)
249--- testing: 9223372036854775806 << 9 ---
250int(-1024)
251--- testing: 9223372036854775806 << 65 ---
252int(-4)
253--- testing: 9223372036854775806 << -44 ---
254int(-2097152)
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(0)
263--- testing: 9.2233720368548E+18 << -1 ---
264int(0)
265--- testing: 9.2233720368548E+18 << 7 ---
266int(0)
267--- testing: 9.2233720368548E+18 << 9 ---
268int(0)
269--- testing: 9.2233720368548E+18 << 65 ---
270int(0)
271--- testing: 9.2233720368548E+18 << -44 ---
272int(0)
273--- testing: 9.2233720368548E+18 << 2147483647 ---
274int(0)
275--- testing: 9.2233720368548E+18 << 9223372036854775807 ---
276int(0)
277--- testing: -9223372036854775807 << 0 ---
278int(-9223372036854775807)
279--- testing: -9223372036854775807 << 1 ---
280int(2)
281--- testing: -9223372036854775807 << -1 ---
282int(-9223372036854775808)
283--- testing: -9223372036854775807 << 7 ---
284int(128)
285--- testing: -9223372036854775807 << 9 ---
286int(512)
287--- testing: -9223372036854775807 << 65 ---
288int(2)
289--- testing: -9223372036854775807 << -44 ---
290int(1048576)
291--- testing: -9223372036854775807 << 2147483647 ---
292int(-9223372036854775808)
293--- testing: -9223372036854775807 << 9223372036854775807 ---
294int(-9223372036854775808)
295--- testing: -9.2233720368548E+18 << 0 ---
296int(-9223372036854775808)
297--- testing: -9.2233720368548E+18 << 1 ---
298int(0)
299--- testing: -9.2233720368548E+18 << -1 ---
300int(0)
301--- testing: -9.2233720368548E+18 << 7 ---
302int(0)
303--- testing: -9.2233720368548E+18 << 9 ---
304int(0)
305--- testing: -9.2233720368548E+18 << 65 ---
306int(0)
307--- testing: -9.2233720368548E+18 << -44 ---
308int(0)
309--- testing: -9.2233720368548E+18 << 2147483647 ---
310int(0)
311--- testing: -9.2233720368548E+18 << 9223372036854775807 ---
312int(0)
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(-9223372036854775808)
345--- testing: 1 << -9223372036854775808 ---
346int(1)
347--- testing: 1 << 2147483647 ---
348int(-9223372036854775808)
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(-9223372036854775808)
359--- testing: 1 << 4294967294 ---
360int(4611686018427387904)
361--- testing: 1 << 4294967295 ---
362int(-9223372036854775808)
363--- testing: 1 << 4294967293 ---
364int(2305843009213693952)
365--- testing: 1 << 9223372036854775806 ---
366int(4611686018427387904)
367--- testing: 1 << 9.2233720368548E+18 ---
368int(1)
369--- testing: 1 << -9223372036854775807 ---
370int(2)
371--- testing: 1 << -9.2233720368548E+18 ---
372int(1)
373--- testing: -1 << 9223372036854775807 ---
374int(-9223372036854775808)
375--- testing: -1 << -9223372036854775808 ---
376int(-1)
377--- testing: -1 << 2147483647 ---
378int(-9223372036854775808)
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(-9223372036854775808)
389--- testing: -1 << 4294967294 ---
390int(-4611686018427387904)
391--- testing: -1 << 4294967295 ---
392int(-9223372036854775808)
393--- testing: -1 << 4294967293 ---
394int(-2305843009213693952)
395--- testing: -1 << 9223372036854775806 ---
396int(-4611686018427387904)
397--- testing: -1 << 9.2233720368548E+18 ---
398int(-1)
399--- testing: -1 << -9223372036854775807 ---
400int(-2)
401--- testing: -1 << -9.2233720368548E+18 ---
402int(-1)
403--- testing: 7 << 9223372036854775807 ---
404int(-9223372036854775808)
405--- testing: 7 << -9223372036854775808 ---
406int(7)
407--- testing: 7 << 2147483647 ---
408int(-9223372036854775808)
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(-9223372036854775808)
419--- testing: 7 << 4294967294 ---
420int(-4611686018427387904)
421--- testing: 7 << 4294967295 ---
422int(-9223372036854775808)
423--- testing: 7 << 4294967293 ---
424int(-2305843009213693952)
425--- testing: 7 << 9223372036854775806 ---
426int(-4611686018427387904)
427--- testing: 7 << 9.2233720368548E+18 ---
428int(7)
429--- testing: 7 << -9223372036854775807 ---
430int(14)
431--- testing: 7 << -9.2233720368548E+18 ---
432int(7)
433--- testing: 9 << 9223372036854775807 ---
434int(-9223372036854775808)
435--- testing: 9 << -9223372036854775808 ---
436int(9)
437--- testing: 9 << 2147483647 ---
438int(-9223372036854775808)
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(-9223372036854775808)
449--- testing: 9 << 4294967294 ---
450int(4611686018427387904)
451--- testing: 9 << 4294967295 ---
452int(-9223372036854775808)
453--- testing: 9 << 4294967293 ---
454int(2305843009213693952)
455--- testing: 9 << 9223372036854775806 ---
456int(4611686018427387904)
457--- testing: 9 << 9.2233720368548E+18 ---
458int(9)
459--- testing: 9 << -9223372036854775807 ---
460int(18)
461--- testing: 9 << -9.2233720368548E+18 ---
462int(9)
463--- testing: 65 << 9223372036854775807 ---
464int(-9223372036854775808)
465--- testing: 65 << -9223372036854775808 ---
466int(65)
467--- testing: 65 << 2147483647 ---
468int(-9223372036854775808)
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(-9223372036854775808)
479--- testing: 65 << 4294967294 ---
480int(4611686018427387904)
481--- testing: 65 << 4294967295 ---
482int(-9223372036854775808)
483--- testing: 65 << 4294967293 ---
484int(2305843009213693952)
485--- testing: 65 << 9223372036854775806 ---
486int(4611686018427387904)
487--- testing: 65 << 9.2233720368548E+18 ---
488int(65)
489--- testing: 65 << -9223372036854775807 ---
490int(130)
491--- testing: 65 << -9.2233720368548E+18 ---
492int(65)
493--- testing: -44 << 9223372036854775807 ---
494int(0)
495--- testing: -44 << -9223372036854775808 ---
496int(-44)
497--- testing: -44 << 2147483647 ---
498int(0)
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(0)
509--- testing: -44 << 4294967294 ---
510int(0)
511--- testing: -44 << 4294967295 ---
512int(0)
513--- testing: -44 << 4294967293 ---
514int(-9223372036854775808)
515--- testing: -44 << 9223372036854775806 ---
516int(0)
517--- testing: -44 << 9.2233720368548E+18 ---
518int(-44)
519--- testing: -44 << -9223372036854775807 ---
520int(-88)
521--- testing: -44 << -9.2233720368548E+18 ---
522int(-44)
523--- testing: 2147483647 << 9223372036854775807 ---
524int(-9223372036854775808)
525--- testing: 2147483647 << -9223372036854775808 ---
526int(2147483647)
527--- testing: 2147483647 << 2147483647 ---
528int(-9223372036854775808)
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(-9223372036854775808)
539--- testing: 2147483647 << 4294967294 ---
540int(-4611686018427387904)
541--- testing: 2147483647 << 4294967295 ---
542int(-9223372036854775808)
543--- testing: 2147483647 << 4294967293 ---
544int(-2305843009213693952)
545--- testing: 2147483647 << 9223372036854775806 ---
546int(-4611686018427387904)
547--- testing: 2147483647 << 9.2233720368548E+18 ---
548int(2147483647)
549--- testing: 2147483647 << -9223372036854775807 ---
550int(4294967294)
551--- testing: 2147483647 << -9.2233720368548E+18 ---
552int(2147483647)
553--- testing: 9223372036854775807 << 9223372036854775807 ---
554int(-9223372036854775808)
555--- testing: 9223372036854775807 << -9223372036854775808 ---
556int(9223372036854775807)
557--- testing: 9223372036854775807 << 2147483647 ---
558int(-9223372036854775808)
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(-9223372036854775808)
569--- testing: 9223372036854775807 << 4294967294 ---
570int(-4611686018427387904)
571--- testing: 9223372036854775807 << 4294967295 ---
572int(-9223372036854775808)
573--- testing: 9223372036854775807 << 4294967293 ---
574int(-2305843009213693952)
575--- testing: 9223372036854775807 << 9223372036854775806 ---
576int(-4611686018427387904)
577--- testing: 9223372036854775807 << 9.2233720368548E+18 ---
578int(9223372036854775807)
579--- testing: 9223372036854775807 << -9223372036854775807 ---
580int(-2)
581--- testing: 9223372036854775807 << -9.2233720368548E+18 ---
582int(9223372036854775807)
583===DONE===
584