Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mu-impl-fast
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
40
Issues
40
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
mu
mu-impl-fast
Commits
db68888b
Commit
db68888b
authored
Nov 15, 2016
by
John Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
3D vector product test added
parent
60f30ac4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
test_rpython.py
tests/test_jit/test_rpython.py
+20
-0
No files found.
tests/test_jit/test_rpython.py
View file @
db68888b
...
...
@@ -19,6 +19,26 @@ def rand_list_of(n):
return
[
rffi
.
r_longlong
(
unpack
(
'i'
,
pack
(
'I'
,
getrandbits
(
32
)))[
0
])
for
i
in
range
(
n
)]
def
test_vec3prod
():
def
prod
(
v1
,
v2
):
a
=
v1
[
0
]
*
v2
[
0
]
b
=
v1
[
1
]
*
v2
[
1
]
c
=
v1
[
2
]
*
v2
[
2
]
return
a
+
b
+
c
fnc
,
(
db
,
bdlgen
)
=
fncptr_from_rpy_func
(
prod
,
[
rffi
.
CArrayPtr
(
rffi
.
LONGLONG
),
rffi
.
CArrayPtr
(
rffi
.
LONGLONG
)],
rffi
.
LONGLONG
)
bdlgen
.
mu
.
current_thread_as_mu_thread
(
rmu
.
null
(
rmu
.
MuCPtr
))
with
lltype
.
scoped_alloc
(
rffi
.
CArray
(
rffi
.
LONGLONG
),
3
)
as
vec1
:
vec1
[
0
]
=
1
vec1
[
1
]
=
2
vec1
[
2
]
=
3
with
lltype
.
scoped_alloc
(
rffi
.
CArray
(
rffi
.
LONGLONG
),
3
)
as
vec2
:
vec2
[
0
]
=
4
vec2
[
1
]
=
5
vec2
[
2
]
=
6
assert
fnc
(
vec1
,
vec2
)
==
32
def
test_find_min
():
def
find_min
(
xs
,
sz
):
m
=
xs
[
0
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment