nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge: curl: basic Unix domain socket support
[nit.git]
/
tests
/
shootout_binarytrees.nit
diff --git
a/tests/shootout_binarytrees.nit
b/tests/shootout_binarytrees.nit
index
5416e6a
..
5eea74f
100644
(file)
--- a/
tests/shootout_binarytrees.nit
+++ b/
tests/shootout_binarytrees.nit
@@
-20,9
+20,9
@@
# contributed by Jean Privat
class TreeNode
# contributed by Jean Privat
class TreeNode
- attr _left: nullable TreeNode
- attr _right: nullable TreeNode
- attr _item: Int
+ var left: nullable TreeNode
+ var right: nullable TreeNode
+ var item: Int
init(left: nullable TreeNode, right: nullable TreeNode, item: Int)
init(left: nullable TreeNode, right: nullable TreeNode, item: Int)
@@
-33,7
+33,7
@@
class TreeNode
end
end
- meth item_check: Int
+ fun item_check: Int
do
if _left == null then
return _item
do
if _left == null then
return _item
@@
-43,7
+43,7
@@
class TreeNode
end
end
end
end
-meth bottom_up_tree(item: Int, depth: Int): TreeNode
+fun bottom_up_tree(item: Int, depth: Int): TreeNode
do
if depth > 0 then
var item_item = 2 * item
do
if depth > 0 then
var item_item = 2 * item
@@
-75,7
+75,7
@@
var long_lived_tree = bottom_up_tree(0, max_depth)
var depth = min_depth
while depth <= max_depth do
var depth = min_depth
while depth <= max_depth do
- var iterations = 1.lshift(max_depth - depth + min_depth)
+ var iterations = 1 << (max_depth - depth + min_depth)
var check_res = 0
for i in [1..(iterations+1)[ do
var check_res = 0
for i in [1..(iterations+1)[ do