alien.c-types: make behavior of int/uint/long/ulong/longlong/ulonglong struct field setters consistent across 32-bit and 64-bit when supplied with floats (reported by Anton Gorenko)

db4
Slava Pestov 2010-10-14 22:21:12 -07:00
parent 345447b961
commit 559b1ae876
2 changed files with 15 additions and 0 deletions

View File

@ -12,6 +12,15 @@ CONSTANT: xyz 123
[ -1 ] [ -1 <short> *short ] unit-test
[ -1 ] [ -1 <int> *int ] unit-test
! I don't care if this throws an error or works, but at least
! it should be consistent between platforms
[ -1 ] [ -1.0 <int> *int ] unit-test
[ -1 ] [ -1.0 <long> *long ] unit-test
[ -1 ] [ -1.0 <longlong> *longlong ] unit-test
[ 1 ] [ 1.0 <uint> *uint ] unit-test
[ 1 ] [ 1.0 <ulong> *ulong ] unit-test
[ 1 ] [ 1.0 <ulonglong> *ulonglong ] unit-test
UNION-STRUCT: foo
{ a int }
{ b int } ;

View File

@ -365,6 +365,7 @@ M: pointer c-type
8 >>align-first
"from_signed_cell" >>boxer
"to_fixnum" >>unboxer
[ >integer ] >>unboxer-quot
\ longlong define-primitive-type
<c-type>
@ -377,6 +378,7 @@ M: pointer c-type
8 >>align-first
"from_unsigned_cell" >>boxer
"to_cell" >>unboxer
[ >integer ] >>unboxer-quot
\ ulonglong define-primitive-type
os windows? [
@ -403,6 +405,7 @@ M: pointer c-type
4 >>align-first
"from_signed_cell" >>boxer
"to_fixnum" >>unboxer
[ >integer ] >>unboxer-quot
\ int define-primitive-type
<c-type>
@ -415,6 +418,7 @@ M: pointer c-type
4 >>align-first
"from_unsigned_cell" >>boxer
"to_cell" >>unboxer
[ >integer ] >>unboxer-quot
\ uint define-primitive-type
<long-long-type>
@ -426,6 +430,7 @@ M: pointer c-type
8-byte-alignment
"from_signed_8" >>boxer
"to_signed_8" >>unboxer
[ >integer ] >>unboxer-quot
\ longlong define-primitive-type
<long-long-type>
@ -437,6 +442,7 @@ M: pointer c-type
8-byte-alignment
"from_unsigned_8" >>boxer
"to_unsigned_8" >>unboxer
[ >integer ] >>unboxer-quot
\ ulonglong define-primitive-type
\ int c-type \ long define-primitive-type