From cb38e845dcd097a952fb412d0fc6aa7c96635759 Mon Sep 17 00:00:00 2001 From: Florian Deljarry Date: Tue, 28 May 2019 12:03:12 -0400 Subject: [PATCH] lib/core/bytes: Adding a redef of has method Adding the redef of the `has` method to take care of the negative numbers Signed-off-by: Florian Deljarry --- lib/core/bytes.nit | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/core/bytes.nit b/lib/core/bytes.nit index f386c47..3013321 100644 --- 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" -- 1.7.9.5