nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
14ccd03
)
lib/core/bytes: Adding a redef of has method
author
Florian Deljarry
<deljarry.florian@gmail.com>
Tue, 28 May 2019 16:03:12 +0000
(12:03 -0400)
committer
Florian Deljarry
<deljarry.florian@gmail.com>
Tue, 28 May 2019 16:20:16 +0000
(12:20 -0400)
Adding the redef of the `has` method to take care of the negative numbers
Signed-off-by: Florian Deljarry <deljarry.florian@gmail.com>
lib/core/bytes.nit
patch
|
blob
|
history
diff --git
a/lib/core/bytes.nit
b/lib/core/bytes.nit
index
f386c47
..
3013321
100644
(file)
--- a/
lib/core/bytes.nit
+++ b/
lib/core/bytes.nit
@@
-538,6
+538,12
@@
class Bytes
length += cln
end
+ redef fun has(c)
+ do
+ if not c isa Int then return false
+ return super(c&255)
+ end
+
# var b = new Bytes.empty
# b.append([104, 101, 108, 108, 111])
# assert b.to_s == "hello"