[Mulgara-dev] [Mulgara-svn] r667 - trunk/src/jar/resolver-distributed/java/org/mulgara/resolver/distributed

Life is hard, and then you die ronald at innovation.ch
Tue Mar 4 21:46:04 UTC 2008


On Tue, Mar 04, 2008 at 03:05:19PM -0600, Paul Gearon wrote:
> Nope, and yes, it's annoying.  We have a class called Constants which  
> contains constants like SIZEOF_LONG and SIZEOF_INT.  Crazy.

Well, sizeof makes no sense in java because A) for primitives the
sizes are fixed, B) there are no 'struct's, and C) the size of an
object is not something you can rely on (and can conceivably change
during the lifetime of an object).

However, there are constants available, if you like: Long.SIZE,
Integer.SIZE, Float.SIZE, etc.

> Now that I've had more sleep, then a name like SIZEOF_LONG_IN_BITS  
> might work, but it seems excessive.  After all, we're supposed to know  
> that it's 64.  I just had a thinko when I did it.

Agreed.


  Cheers,

  Ronald


> On Mar 4, 2008, at 1:24 AM, William Mills wrote:
> 
> > Java doesnt have sizeof()?  how quaint...
> >
> > ----- Original Message ----
> > From: Paul Gearon <gearon at ieee.org>
> > To: Mulgara Developers <mulgara-dev at mulgara.org>
> > Sent: Monday, March 3, 2008 5:57:38 PM
> > Subject: Re: [Mulgara-dev] [Mulgara-svn] r667 - trunk/src/jar/ 
> > resolver-distributed/java/org/mulgara/resolver/distributed
> >
> > This would usually be the case, but IMO a constant with a "meaningful
> > name" would be less meaningful here than the number 32.
> >
> > As I said, I forgot it was a 4 bit number.  You have kids.  You should
> > have some idea of how much sleep I had when I did this.  :-)
> >
> > Paul
> >
> > On Mon, Mar 3, 2008 at 5:29 PM, William Mills  
> > <wmills_92105 at yahoo.com> wrote:
> >> Would that be because you were using magic numbers and not  
> >> constants with meaningfull names?
> >>
> >> Cheap shot, I admit.
> >>
> >> -bill
> >>
> >>
> >>
> >> ----- Original Message ----
> >> From: Paul Gearon <gearon at ieee.org>
> >> To: Mulgara Developers <mulgara-dev at mulgara.org>
> >> Sent: Monday, March 3, 2008 2:46:50 PM
> >> Subject: Re: [Mulgara-dev] [Mulgara-svn] r667 - trunk/src/jar/ 
> >> resolver-distributed/java/org/mulgara/resolver/distributed
> >>
> >> On Mon, Mar 3, 2008 at 2:57 PM, Life is hard, and then you die
> >> <ronald at innovation.ch> wrote:
> >>> On Mon, Mar 03, 2008 at 07:37:28AM -0800, pag at mulgara.org wrote:
> >>>>   public int hashCode() {
> >>>> -    return serverHashCode ^ (int)(nodeId ^ (nodeId >>>32));
> >>>> +    return serverHashCode ^ (int)(nodeId ^ (nodeId >>> 16));
> >>>
> >>> I'm curious: what was wrong with the shift-by-32?
> >>
> >> It was me forgetting that nodeId is a 64 bit number.
> >>
> >> Paul
> >>



More information about the Mulgara-dev mailing list