From 32b10ee9b7d0f59416e1831aef9938167d448aae Mon Sep 17 00:00:00 2001 From: Gonzalo Garramuno Date: Wed, 23 May 2007 12:46:57 +0000 Subject: [PATCH] Dramatically sped up comparison functions for integers. This speeds up most std::set, etc. insertion operations. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9830 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Lib/ruby/rubyclasses.swg | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Lib/ruby/rubyclasses.swg b/Lib/ruby/rubyclasses.swg index 71fc1b6fe..db5482694 100644 --- a/Lib/ruby/rubyclasses.swg +++ b/Lib/ruby/rubyclasses.swg @@ -38,7 +38,8 @@ namespace swig { %nodirector GC_VALUE; - // We ignore the constructor so that user can never create a GC_VALUE manually + // We ignore the constructor so that user can never create a GC_VALUE + // manually %ignore GC_VALUE::GC_VALUE; struct GC_VALUE { @@ -215,6 +216,10 @@ namespace swig { #define GC_VALUE_CMP( op_id, op, cmp, cmpval ) \ bool op( const GC_VALUE& other ) const \ { \ + if ( FIXNUM_P(_obj) && FIXNUM_P(other._obj) ) \ + { \ + return _obj cmp other._obj; \ + } \ bool res = false; \ VALUE ret = Qnil; \ SWIG_RUBY_THREAD_BEGIN_BLOCK; \