Re: Bit twiddling in org.apache.logging.log4j.core.impl.Log4jLogEvent.hashCode()

2016-09-21 Thread Remko Popma
Is there really a problem to solve here? The code to compute the hashCode for a long is actually the canonical way to do this, documented in Effective Java. FindBugs is complaining about nothing... Sent from my iPhone > On 2016/09/21, at 18:02, Gary Gregory wrote: > >

Re: Bit twiddling in org.apache.logging.log4j.core.impl.Log4jLogEvent.hashCode()

2016-09-21 Thread Gary Gregory
But that generates lots of temp arrays... it's just as easy to use an IDE code generator to create the methods... I'll try that tomorrow [AFK ATM] Gary On Sep 21, 2016 12:23 AM, "Greg Thomas" wrote: > Though, on reflection, (no pun intended), the Objects class *is* in

Re: Bit twiddling in org.apache.logging.log4j.core.impl.Log4jLogEvent.hashCode()

2016-09-21 Thread Greg Thomas
Though, on reflection, (no pun intended), the Objects class *is* in Java 7; https://docs.oracle.com/javase/7/docs/api/java/util/Objects.html It makes implement .equals and .hashcode trivial; Assuming a TestClass with three fields, foo, bar and foobar, you have ... @Override public int

Re: Bit twiddling in org.apache.logging.log4j.core.impl.Log4jLogEvent.hashCode()

2016-09-20 Thread Greg Thomas
As was Objects.hashcode(...). Sorry for the noise, as you were ... Greg -- Sent from my iPhone > On 21 Sep 2016, at 03:17, Remko Popma wrote: > > Sorry I was thinking of Long.hashCode(long), but I see now that this was > introduced in java 1.8... > > Sent from my

Re: Bit twiddling in org.apache.logging.log4j.core.impl.Log4jLogEvent.hashCode()

2016-09-20 Thread Remko Popma
Sorry I was thinking of Long.hashCode(long), but I see now that this was introduced in java 1.8... Sent from my iPhone > On 2016/09/21, at 10:09, Gary Gregory wrote: > > Where do you see such a method? > > Gary > >> On Tue, Sep 20, 2016 at 4:43 PM, Remko Popma

Re: Bit twiddling in org.apache.logging.log4j.core.impl.Log4jLogEvent.hashCode()

2016-09-20 Thread Gary Gregory
Where do you see such a method? Gary On Tue, Sep 20, 2016 at 4:43 PM, Remko Popma wrote: > Objects.hashCode(long) does exactly the same, but is certainly easier to > read. Go for it! > > Sent from my iPhone > > On 2016/09/21, at 5:06, Greg Thomas

Re: Bit twiddling in org.apache.logging.log4j.core.impl.Log4jLogEvent.hashCode()

2016-09-20 Thread Remko Popma
Objects.hashCode(long) does exactly the same, but is certainly easier to read. Go for it! Sent from my iPhone > On 2016/09/21, at 5:06, Greg Thomas wrote: > > Could you use simply > > return Objects.hashcode(...) > > To avoid the maths In the first place ?? > -- >

Re: Bit twiddling in org.apache.logging.log4j.core.impl.Log4jLogEvent.hashCode()

2016-09-20 Thread Greg Thomas
Could you use simply return Objects.hashcode(...) To avoid the maths In the first place ?? -- Sent from my iPhone > On 20 Sep 2016, at 19:53, Gary Gregory wrote: > > I see a Findbugs error in: > > org.apache.logging.log4j.core.impl.Log4jLogEvent.hashCode() > > for:

Bit twiddling in org.apache.logging.log4j.core.impl.Log4jLogEvent.hashCode()

2016-09-20 Thread Gary Gregory
I see a Findbugs error in: org.apache.logging.log4j.core.impl.Log4jLogEvent.hashCode() for: result = 31 * result + (threadPriority ^ (threadPriority >>> 32)); "The code performs shift of a 32 bit int by a constant amount outside the range -31..31. The effect of this is to use the lower