lib/core: Avoid boxing when comparing two NativeString instances
authorLucas Bajolet <r4pass@hotmail.com>
Tue, 8 Dec 2015 18:26:36 +0000 (13:26 -0500)
committerLucas Bajolet <r4pass@hotmail.com>
Tue, 29 Dec 2015 04:49:28 +0000 (23:49 -0500)
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

lib/core/text/native.nit

index 3eb41f2..1c9e262 100644 (file)
@@ -84,6 +84,10 @@ extern class NativeString `{ char* `}
        # Copy `self` to `dest`.
        fun copy_to(dest: NativeString, length: Int, from: Int, to: Int) is intern
 
+       redef fun ==(o) is intern do return is_same_instance(o)
+
+       redef fun !=(o) is intern do return not is_same_instance(o)
+
        # Position of the first nul character.
        fun cstring_length: Int
        do