On 03/13/2014 02:26 PM, David M. Lloyd wrote: > On 03/13/2014 07:19 AM, Andrew Haley wrote: >> On 03/13/2014 11:57 AM, Paul Sandoz wrote: >>> Now i am in two minds to whether to add ByteBuffer.compareUnsigned or add >>> Arrays.compareUnsigned. >>> >>> An explosion of methods on Arrays for all types (plus to/from versions) >>> would be annoying. >> >> Surely it's a no brainer? All we have to do is add the intrinsics for >> ByteBuffers, then we get fast ByteBuffers and fast array comparisons too. >> I don't see the problem. > > Why such a hangup on ByteBuffers and Arrays? I think it'd be super > useful to simply have methods on Long, Integer, etc: > > public static void getBytesBE(long orig, byte[] dst, int off) > public static void getBytesLE(long orig, byte[] dst, int off) > > public static int compareBE(long orig, byte[] other, int off) > public static int compareLE(long orig, byte[] other, int off) > > public static long getLongFromBytesBE(byte[] src, int off) > public static long getLongFromBytesLE(byte[] src, int off)
I take your point, but this is a whole lot of new library work, both in implementation and specification, whereas we already have this in ByteBuffers, albeit with a suboptimal implementation. Andrew.