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)])))) > > when run with (set! *warn-on-reflection* true) I receive the following > error: > > Reflection warning...type-hint.clj:7 - call to and can't be resolved.
There is no bit-and for bytes; you need ints. At least that's what it looks like to me. (defn unsign-byte-from-buffer [#^java.nio.ByteBuffer buffer] (bit-and 0xff (int (.get buffer)))) seems to solve the issue for me. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en