Re: bit manipulation and java arrays

2010-11-05 Thread Meikel Brandmeyer
Hi, On 5 Nov., 16:33, Jochen wrote: > > user=> (aset (make-array Integer/TYPE 1) 0 (int (- 0x8000))) > > -2147483648 > >user=> (aset (make-array Integer/TYPE 1) 0 (.intValue 0x8000)) > >-2147483648 > > cool, that (both) works! I often forget that in clojure I can drop > back to Java any

Re: bit manipulation and java arrays

2010-11-05 Thread Jochen
Hi... > user=> (aset (make-array Integer/TYPE 1) 0 (int (- 0x8000))) > -2147483648 >user=> (aset (make-array Integer/TYPE 1) 0 (.intValue 0x8000)) >-2147483648 cool, that (both) works! I often forget that in clojure I can drop back to Java any time. Thanks a lot! Ciao ...Jochen -- Yo

Re: bit manipulation and java arrays

2010-11-05 Thread Meikel Brandmeyer
Hi again, On 5 Nov., 16:09, Meikel Brandmeyer wrote: > user=> (aset (make-array Integer/TYPE 1) 0 (int (- 0x8000))) > -2147483648 Of course only a special case. But this works: user=> (aset (make-array Integer/TYPE 1) 0 (.intValue 0x8000)) -2147483648 user=> (aset (make-array Integer/T

Re: bit manipulation and java arrays

2010-11-05 Thread Meikel Brandmeyer
Hi, On 5 Nov., 15:42, Jochen wrote: > Thanks for your quick reply! > I use 1.2.0. aset does not work. It seems that aset is only useable > for arrays of Reference types, but I need to use primitive types, so > aset-int is the only option. To me it looks that there should be > unchecked-xxx versi

Re: bit manipulation and java arrays

2010-11-05 Thread Jochen
Hi Mikel... Thanks for your quick reply! I use 1.2.0. aset does not work. It seems that aset is only useable for arrays of Reference types, but I need to use primitive types, so aset-int is the only option. To me it looks that there should be unchecked-xxx versions of the coerce functions (e.g. un

Re: bit manipulation and java arrays

2010-11-05 Thread Meikel Brandmeyer
Hi, On 5 Nov., 13:04, Jochen wrote: > (aset-int (make-array Integer/TYPE 1) 0 0x8000) > > I found that 0x8000 is propagated to a long (other than java which > on 8 character hex literals keeps an int) so I try to cast using (int > 0x8000) as possible in Java but still the error occur