mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* bignum.c (rb_cmpint): moved from compar.c, to check bignum
zero. * range.c (range_step): add step for each iteration if begin and end are numeric. [ruby-core:15990] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									a06fc80da6
								
							
						
					
					
						commit
						bdc00ba604
					
				
					 6 changed files with 54 additions and 34 deletions
				
			
		
							
								
								
									
										16
									
								
								compar.c
									
										
									
									
									
								
							
							
						
						
									
										16
									
								
								compar.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -15,22 +15,6 @@ VALUE rb_mComparable;
 | 
			
		|||
 | 
			
		||||
static ID cmp;
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
rb_cmpint(VALUE val, VALUE a, VALUE b)
 | 
			
		||||
{
 | 
			
		||||
    if (NIL_P(val)) {
 | 
			
		||||
	rb_cmperr(a, b);
 | 
			
		||||
    }
 | 
			
		||||
    if (FIXNUM_P(val)) return FIX2INT(val);
 | 
			
		||||
    if (TYPE(val) == T_BIGNUM) {
 | 
			
		||||
	if (RBIGNUM_SIGN(val)) return 1;
 | 
			
		||||
	return -1;
 | 
			
		||||
    }
 | 
			
		||||
    if (RTEST(rb_funcall(val, '>', 1, INT2FIX(0)))) return 1;
 | 
			
		||||
    if (RTEST(rb_funcall(val, '<', 1, INT2FIX(0)))) return -1;
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
rb_cmperr(VALUE x, VALUE y)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue