nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
707d2ae
)
lib/stc/kernel: add << and >> in Int
author
Jean Privat
<jean@pryen.org>
Wed, 15 Apr 2015 05:36:24 +0000
(12:36 +0700)
committer
Jean Privat
<jean@pryen.org>
Wed, 15 Apr 2015 05:43:58 +0000
(12:43 +0700)
Signed-off-by: Jean Privat <jean@pryen.org>
lib/standard/kernel.nit
patch
|
blob
|
history
diff --git
a/lib/standard/kernel.nit
b/lib/standard/kernel.nit
index
dfff892
..
3f32a62
100644
(file)
--- a/
lib/standard/kernel.nit
+++ b/
lib/standard/kernel.nit
@@
-446,11
+446,17
@@
universal Int
# assert 5.lshift(1) == 10
fun lshift(i: Int): Int is intern
+ # alias of `lshift`
+ fun <<(i: Int): Int do return lshift(i)
+
# `i` bits shift fo the right (aka >>)
#
# assert 5.rshift(1) == 2
fun rshift(i: Int): Int is intern
+ # alias of `rshift`
+ fun >>(i: Int): Int do return rshift(i)
+
redef fun to_i do return self
redef fun to_f is intern