guile: fix integer test on 64 bit systems
This commit is contained in:
parent
fb7b45becc
commit
3e0247e553
2 changed files with 38 additions and 12 deletions
|
|
@ -16,5 +16,16 @@
|
|||
unsigned long unsigned_long_identity(unsigned long x) { return x; }
|
||||
signed long long signed_long_long_identity(signed long long x) { return x; }
|
||||
unsigned long long unsigned_long_long_identity(unsigned long long x) { return x; }
|
||||
|
||||
size_t signed_char_size() { return sizeof (signed char); }
|
||||
size_t unsigned_char_size() { return sizeof (unsigned char); }
|
||||
size_t signed_short_size() { return sizeof (signed short); }
|
||||
size_t unsigned_short_size() { return sizeof (unsigned short); }
|
||||
size_t signed_int_size() { return sizeof (signed int); }
|
||||
size_t unsigned_int_size() { return sizeof (unsigned int); }
|
||||
size_t signed_long_size() { return sizeof (signed long); }
|
||||
size_t unsigned_long_size() { return sizeof (unsigned long); }
|
||||
size_t signed_long_long_size() { return sizeof (signed long long); }
|
||||
size_t unsigned_long_long_size() { return sizeof (unsigned long long); }
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,17 +12,32 @@
|
|||
(check-equality (throws-exception? (,function (- ,from 1))) #t)
|
||||
(check-equality (throws-exception? (,function (+ ,to 1))) #t)))
|
||||
|
||||
;;; signed char, unsigned char typemaps deal with characters, not integers.
|
||||
;; (check-range signed-char-identity (- (expt 2 7)) (- (expt 2 7) 1))
|
||||
;; (check-range unsigned-char-identity 0 (- (expt 2 8) 1))
|
||||
(check-range signed-short-identity (- (expt 2 15)) (- (expt 2 15) 1))
|
||||
(check-range unsigned-short-identity 0 (- (expt 2 16) 1))
|
||||
(check-range signed-int-identity (- (expt 2 31)) (- (expt 2 31) 1))
|
||||
(check-range unsigned-int-identity 0 (- (expt 2 32) 1))
|
||||
(check-range signed-long-identity (- (expt 2 31)) (- (expt 2 31) 1))
|
||||
(check-range unsigned-long-identity 0 (- (expt 2 32) 1))
|
||||
;;; long long not implemented in Guile and MzScheme.
|
||||
;; (check-range signed-long-long-identity (- (expt 2 63)) (- (expt 2 63) 1))
|
||||
;; (check-range unsigned-long-long-identity 0 (- (expt 2 64) 1))
|
||||
(let ((signed-short-min (- (expt 2 (- (* (signed-short-size) 8) 1))))
|
||||
(signed-short-max (- (expt 2 (- (* (signed-short-size) 8) 1)) 1))
|
||||
(unsigned-short-max (- (expt 2 (* (unsigned-short-size) 8)) 1))
|
||||
(signed-int-min (- (expt 2 (- (* (signed-int-size) 8) 1))))
|
||||
(signed-int-max (- (expt 2 (- (* (signed-int-size) 8) 1)) 1))
|
||||
(unsigned-int-max (- (expt 2 (* (unsigned-int-size) 8)) 1))
|
||||
(signed-long-min (- (expt 2 (- (* (signed-long-size) 8) 1))))
|
||||
(signed-long-max (- (expt 2 (- (* (signed-long-size) 8) 1)) 1))
|
||||
(unsigned-long-max (- (expt 2 (* (unsigned-long-size) 8)) 1))
|
||||
(signed-long-long-min (- (expt 2 (- (* (signed-long-long-size) 8) 1))))
|
||||
(signed-long-long-max (- (expt 2 (- (* (signed-long-long-size) 8) 1)) 1))
|
||||
(unsigned-long-long-max (- (expt 2 (* (unsigned-long-long-size) 8)) 1))
|
||||
)
|
||||
|
||||
;;; signed char, unsigned char typemaps deal with characters, not integers.
|
||||
;; (check-range signed-char-identity (- (expt 2 7)) (- (expt 2 7) 1))
|
||||
;; (check-range unsigned-char-identity 0 (- (expt 2 8) 1))
|
||||
(check-range signed-short-identity signed-short-min signed-short-max)
|
||||
(check-range unsigned-short-identity 0 unsigned-short-max)
|
||||
(check-range signed-int-identity signed-int-min signed-int-max)
|
||||
(check-range unsigned-int-identity 0 unsigned-int-max)
|
||||
(check-range signed-long-identity signed-long-min signed-long-max)
|
||||
(check-range unsigned-long-identity 0 unsigned-long-max)
|
||||
;;; long long not implemented in Guile and MzScheme.
|
||||
(check-range signed-long-long-identity signed-long-long-min signed-long-long-max)
|
||||
(check-range unsigned-long-long-identity 0 unsigned-long-long-max)
|
||||
)
|
||||
|
||||
(exit 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue