fix most-negative number and _int64 on a 64-bit platform
Closes PR 12703 Merge to 5.3
This commit is contained in:
parent
2d6073f59f
commit
6566bf5d15
|
@ -10,6 +10,21 @@
|
|||
(test #f malloc 0 _int)
|
||||
(test #f malloc _int 0)
|
||||
|
||||
(let ()
|
||||
(define (try-int-boundary N _int _uint)
|
||||
(test (- (expt 2 N)) cast (- (expt 2 N)) _int _int)
|
||||
(test (sub1 (expt 2 N)) cast (sub1 (expt 2 N)) _int _int)
|
||||
(test (expt 2 N) cast (expt 2 N) _uint _uint)
|
||||
(test (sub1 (expt 2 (add1 N))) cast (sub1 (expt 2 (add1 N))) _uint _uint)
|
||||
(err/rt-test (cast (expt 2 N) _int _int))
|
||||
(err/rt-test (cast (sub1 (- (expt 2 N))) _int _int))
|
||||
(err/rt-test (cast -1 _uint _uint))
|
||||
(err/rt-test (cast (- (expt 2 N)) _uint _uint)))
|
||||
;(try-int-boundary 7 _int8 _uint8)
|
||||
;(try-int-boundary 15 _int16 _uint16)
|
||||
(try-int-boundary 31 _int32 _uint32)
|
||||
(try-int-boundary 63 _int64 _uint64))
|
||||
|
||||
(let ([big/little (if (system-big-endian?) (lambda (x y) x) (lambda (x y) y))]
|
||||
[p (malloc _int32)])
|
||||
(ptr-set! p _int32 0)
|
||||
|
|
|
@ -406,7 +406,7 @@ int scheme_bignum_get_long_long_val(const Scheme_Object *o, mzlonglong *v)
|
|||
*v = 0;
|
||||
return 1;
|
||||
} else if (SCHEME_BIGDIG(o)[MAX_BN_SIZE_FOR_LL - 1] == FIRST_BIT_MASK_LL
|
||||
# ifndef USE_LONG_LONG_FOR_BIGDIG
|
||||
# if !defined(USE_LONG_LONG_FOR_BIGDIG) && !defined(SIXTY_FOUR_BIT_INTEGERS)
|
||||
&& !SCHEME_BIGDIG(o)[0]
|
||||
# endif
|
||||
&& !SCHEME_BIGPOS(o)) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user