Re: bit-and type hint

2010-07-28 Thread Peter Ryan
thanks! that worked. the cast to int makes sense is since the jvm will convert the byte value to an int for the & computation On Jul 27, 2:47 pm, Joost wrote: > Peter Ryan wrote: > > I am trying to avoid a reflective callback with this function: > > > (defn unsign-byte-from-buffer [#^java.nio.Byt

Re: bit-and type hint

2010-07-27 Thread Joost
Peter Ryan wrote: > I am trying to avoid a reflective callback with this function: > > (defn unsign-byte-from-buffer [#^java.nio.ByteBuffer buffer] > (bit-and 0xFF (.get buffer))) > > (println "should be 254" (unsign-byte-from-buffer (java.nio.ByteBuffer/ > wrap (byte-array [(byte 0xFE)] >

bit-and type hint

2010-07-27 Thread Peter Ryan
I am trying to avoid a reflective callback with this function: (defn unsign-byte-from-buffer [#^java.nio.ByteBuffer buffer] (bit-and 0xFF (.get buffer))) (println "should be 254" (unsign-byte-from-buffer (java.nio.ByteBuffer/ wrap (byte-array [(byte 0xFE)] when run with (set! *warn-on-refl