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