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