зеркало из https://github.com/github/ruby.git
* bignum.c (bignorm): sizeof(long) may be smaller than
sizeof(VALUE). [ruby-dev:29013] * ruby.h (FIXNUM_MAX): fixnum may be bigger than long. * ruby.h (SIGNED_VALUE): signed integer of size of VALUE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
fd66442a1d
Коммит
4bacdc1e46
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
|||
Tue Jul 11 13:40:52 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* bignum.c (bignorm): sizeof(long) may be smaller than
|
||||
sizeof(VALUE). [ruby-dev:29013]
|
||||
|
||||
* ruby.h (FIXNUM_MAX): fixnum may be bigger than long.
|
||||
|
||||
* ruby.h (SIGNED_VALUE): signed integer of size of VALUE.
|
||||
|
||||
Mon Jul 10 23:37:14 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* lib/soap/rpc/proxy.rb (Proxy::Operation::response_doc): remove
|
||||
splat star from return statements.
|
||||
|
||||
* lib/soap/rpc/proxy.rb (Proxy::Operation::response_obj): retrieve
|
||||
the first value from the result array if response has only one
|
||||
value.
|
||||
|
||||
Mon Jul 10 19:22:19 2006 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* gc.c (gc_sweep): expand heap earlier.
|
||||
|
|
12
bignum.c
12
bignum.c
|
@ -103,7 +103,7 @@ bignorm(VALUE x)
|
|||
RBIGNUM(x)->len = ++len;
|
||||
|
||||
if (len*SIZEOF_BDIGITS <= sizeof(VALUE)) {
|
||||
long num = 0;
|
||||
SIGNED_VALUE num = 0;
|
||||
while (len--) {
|
||||
num = BIGUP(num) + ds[len];
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ rb_big_norm(VALUE x)
|
|||
}
|
||||
|
||||
VALUE
|
||||
rb_uint2big(unsigned long n)
|
||||
rb_uint2big(VALUE n)
|
||||
{
|
||||
BDIGIT_DBL num = n;
|
||||
long i = 0;
|
||||
|
@ -146,7 +146,7 @@ rb_uint2big(unsigned long n)
|
|||
}
|
||||
|
||||
VALUE
|
||||
rb_int2big(long n)
|
||||
rb_int2big(SIGNED_VALUE n)
|
||||
{
|
||||
long neg = 0;
|
||||
VALUE big;
|
||||
|
@ -163,14 +163,14 @@ rb_int2big(long n)
|
|||
}
|
||||
|
||||
VALUE
|
||||
rb_uint2inum(unsigned long n)
|
||||
rb_uint2inum(VALUE n)
|
||||
{
|
||||
if (POSFIXABLE(n)) return LONG2FIX(n);
|
||||
return rb_uint2big(n);
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_int2inum(long n)
|
||||
rb_int2inum(SIGNED_VALUE n)
|
||||
{
|
||||
if (FIXABLE(n)) return LONG2FIX(n);
|
||||
return rb_int2big(n);
|
||||
|
@ -1236,7 +1236,7 @@ bigdivrem(VALUE x, VALUE y, VALUE *divp, VALUE *modp)
|
|||
}
|
||||
RBIGNUM(z)->sign = RBIGNUM(x)->sign==RBIGNUM(y)->sign;
|
||||
if (modp) {
|
||||
*modp = rb_uint2big((unsigned long)t2);
|
||||
*modp = rb_uint2big((VALUE)t2);
|
||||
RBIGNUM(*modp)->sign = RBIGNUM(x)->sign;
|
||||
}
|
||||
if (divp) *divp = z;
|
||||
|
|
|
@ -2496,14 +2496,25 @@ VpAlloc(U_LONG mx, const char *szVal)
|
|||
return vp;
|
||||
}
|
||||
|
||||
/* Skip all spaces */
|
||||
/* Skip all '_' after digit: 2006-6-30 */
|
||||
ni = 0;
|
||||
psz = ALLOCA_N(char,strlen(szVal)+1);
|
||||
i = 0;
|
||||
ipn = 0;
|
||||
while(psz[i]=szVal[ipn]) {
|
||||
if(ISSPACE(szVal[ipn])) {ipn++;continue;}
|
||||
if(ISDIGIT(psz[i])) ++ni;
|
||||
if(psz[i]=='_') {
|
||||
if(ni>0) {ipn++;continue;}
|
||||
psz[i]=0;
|
||||
break;
|
||||
}
|
||||
++i; ++ipn;
|
||||
}
|
||||
/* Skip trailing spaces */
|
||||
while((--i)>0) {
|
||||
if(ISSPACE(psz[i])) psz[i] = 0;
|
||||
else break;
|
||||
}
|
||||
szVal = psz;
|
||||
|
||||
/* Check on Inf & NaN */
|
||||
|
|
|
@ -46,11 +46,10 @@ class BigDecimal < Numeric
|
|||
numerator = sign*digits.to_i
|
||||
denomi_power = power - digits.size # base is always 10
|
||||
if denomi_power < 0
|
||||
denominator = base ** (-denomi_power)
|
||||
Rational(numerator,base ** (-denomi_power))
|
||||
else
|
||||
denominator = base ** denomi_power
|
||||
Rational(numerator * (base ** denomi_power),1)
|
||||
end
|
||||
Rational(numerator,denominator)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ class PP < PrettyPrint
|
|||
# Object#pretty_print_cycle is used when +obj+ is already
|
||||
# printed, a.k.a the object reference chain has a cycle.
|
||||
def pp(obj)
|
||||
id = obj.__id__
|
||||
id = obj.object_id
|
||||
|
||||
if check_inspect_key(id)
|
||||
group {obj.pretty_print_cycle self}
|
||||
|
@ -180,7 +180,7 @@ class PP < PrettyPrint
|
|||
end
|
||||
|
||||
def object_address_group(obj, &block)
|
||||
id = PointerFormat % (obj.__id__ * 2 & PointerMask)
|
||||
id = PointerFormat % (obj.object_id * 2 & PointerMask)
|
||||
group(1, "\#<#{obj.class}:0x#{id}", '>', &block)
|
||||
end
|
||||
|
||||
|
|
|
@ -788,7 +788,7 @@ public
|
|||
if ele.is_a?(Array)
|
||||
deep_map(ele, &block)
|
||||
else
|
||||
new_obj = block.call(ele)
|
||||
new_obj = yield(ele)
|
||||
new_obj.elename = ITEM_NAME
|
||||
new_obj
|
||||
end
|
||||
|
|
|
@ -345,7 +345,12 @@ private
|
|||
if @response_style == :rpc
|
||||
response_rpc(body, mapping_registry, literal_mapping_registry, opt)
|
||||
else
|
||||
response_doc(body, mapping_registry, literal_mapping_registry, opt)
|
||||
ret = response_doc(body, mapping_registry, literal_mapping_registry, opt)
|
||||
if ret.size == 1
|
||||
ret[0]
|
||||
else
|
||||
ret
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -439,9 +444,9 @@ private
|
|||
|
||||
def response_doc(body, mapping_registry, literal_mapping_registry, opt)
|
||||
if @response_use == :encoded
|
||||
return *response_doc_enc(body, mapping_registry, opt)
|
||||
return response_doc_enc(body, mapping_registry, opt)
|
||||
else
|
||||
return *response_doc_lit(body, literal_mapping_registry, opt)
|
||||
return response_doc_lit(body, literal_mapping_registry, opt)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
18
ruby.h
18
ruby.h
|
@ -93,9 +93,12 @@ extern "C" {
|
|||
#if SIZEOF_LONG == SIZEOF_VOIDP
|
||||
typedef unsigned long VALUE;
|
||||
typedef unsigned long ID;
|
||||
# define SIGNED_VALUE long
|
||||
#elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
|
||||
typedef unsigned LONG_LONG VALUE;
|
||||
typedef unsigned LONG_LONG ID;
|
||||
# define SIGNED_VALUE LONG_LONG
|
||||
# define LONG_LONG_VALUE 1
|
||||
#else
|
||||
# error ---->> ruby requires sizeof(void*) == sizeof(long) to be compiled. <<----
|
||||
#endif
|
||||
|
@ -145,18 +148,23 @@ typedef unsigned LONG_LONG ID;
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#define FIXNUM_MAX (LONG_MAX>>1)
|
||||
#define FIXNUM_MIN RSHIFT((long)LONG_MIN,1)
|
||||
#if LONG_LONG_VALUE
|
||||
# define FIXNUM_MAX (LLONG_MAX>>1)
|
||||
# define FIXNUM_MIN RSHIFT((LONG_LONG)LLONG_MIN,1)
|
||||
#else
|
||||
# define FIXNUM_MAX (LONG_MAX>>1)
|
||||
# define FIXNUM_MIN RSHIFT((long)LONG_MIN,1)
|
||||
#endif
|
||||
|
||||
#define FIXNUM_FLAG 0x01
|
||||
#define INT2FIX(i) ((VALUE)(((long)(i))<<1 | FIXNUM_FLAG))
|
||||
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
|
||||
#define LONG2FIX(i) INT2FIX(i)
|
||||
#define rb_fix_new(v) INT2FIX(v)
|
||||
VALUE rb_int2inum(long);
|
||||
VALUE rb_int2inum(SIGNED_VALUE);
|
||||
#define INT2NUM(v) rb_int2inum(v)
|
||||
#define LONG2NUM(v) INT2NUM(v)
|
||||
#define rb_int_new(v) rb_int2inum(v)
|
||||
VALUE rb_uint2inum(unsigned long);
|
||||
VALUE rb_uint2inum(VALUE);
|
||||
#define UINT2NUM(v) rb_uint2inum(v)
|
||||
#define ULONG2NUM(v) UINT2NUM(v)
|
||||
#define rb_uint_new(v) rb_uint2inum(v)
|
||||
|
|
Загрузка…
Ссылка в новой задаче