-
Notifications
You must be signed in to change notification settings - Fork 138
/
64bit.t
91 lines (65 loc) · 1.78 KB
/
64bit.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!./parrot
# Copyright (C) 2001-2010, Parrot Foundation.
=head1 NAME
t/op/64bit.t - Testing integer ops on 64-bit platforms
=head1 SYNOPSIS
% prove t/op/64bit.t
=head1 DESCRIPTION
Test integer operations on platforms with 64-bit integers.
Tests are skipped on other platforms.
=cut
.sub main :main
.include "iglobals.pasm"
.include 'test_more.pir'
# Check to see if this is 64 bit
.local pmc interp # a handle to our interpreter object.
interp = getinterp
.local pmc config
config = interp[.IGLOBALS_CONFIG_HASH]
.local int intvalsize
intvalsize = config['intvalsize']
plan(5)
if intvalsize == 8 goto is_64_bit
skip(5, "this is not a 64 bit platform")
goto end
is_64_bit:
# setup TODO for platform 'MSWin32'
.local string osname
osname = config['osname']
.local int todo_1
todo_1 = 0
unless osname == "MSWin32" goto do_test
todo_1 = 1
do_test:
bitops64(todo_1)
end:
.end
.sub bitops64
# check bitops for 8-byte ints
.param int todo_1
set $I0, 0xffffffffffffffff
if todo_1 goto do_todo
is( $I0, -1, 'bitops64' )
goto test_2
do_todo:
if $I0 == -1 goto todo_pass
todo ( 0, 'bitops64', 'not working on MSWin32, amd64' )
goto test_2
todo_pass:
todo ( 1, 'bitops64', 'not working on MSWin32, amd64' )
test_2:
set $I1, 0x00000000ffffffff
is( $I1, 4294967295, 'bitops64' )
set $I0, $I1
shl $I0, $I0, 32
is( $I0, -4294967296, 'bitops64' )
band $I2, $I0, $I1
is( $I2, 0, 'bitops64' )
bor $I2, $I0, $I1
is( $I2, -1, 'bitops64' )
.end
# Local Variables:
# mode: pir
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir: