Bug 1537

Summary: ByteBuffer should use unsigned comparison with bound
Product: frysk Reporter: Jeff Johnston <jjohnstn>
Component: generalAssignee: Unassigned <frysk-bugzilla>
Status: RESOLVED FIXED    
Severity: normal CC: pmuldoon, qiyaoltc, timoore
Priority: P1    
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Bug Depends on: 3388    
Bug Blocks: 2127, 2231, 3119    

Description Jeff Johnston 2005-10-24 21:32:49 UTC
The ByteBuffer get methods use a java comparison between the offset and the
upper bound.  This is a signed comparison and doesn't work if we have mapped the
ByteBuffer onto a 64-bit memory space like on AMD64.  A special unsigned
comparison routine is required.  In Java, this could be:

boolean uLongLessThan (a, b)
{
   if (a >=0 && b >= 0 || a < 0 && b < 0)
        return a < b;
   else
        return b < 0;
}

Alternatively, the comparison could be pushed down to cni code and done in C
where unsigned comparisons can be made.
Comment 1 Yao Qi 2006-10-31 03:36:55 UTC
Hi, Tim,
Since you are working on this issue, I add you in the cc list.

Any help on ppc64 side, let me know.  Thanks!
Comment 2 Tim Moore 2006-11-28 17:47:54 UTC
Fixed with inua/eio/ByteBuffer.java 1.4
Comment 3 Mark Wielaard 2007-07-23 09:48:01 UTC
*** Bug 3388 has been marked as a duplicate of this bug. ***