X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.db.procore%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fprocore%2Fcluster%2FBitUtility.java;fp=bundles%2Forg.simantics.db.procore%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fprocore%2Fcluster%2FBitUtility.java;h=4c200ba47f6e7d0393786690d49c247d28215182;hp=8e47ae8dd9546925f5265f350e2482521d04549e;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/BitUtility.java b/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/BitUtility.java index 8e47ae8dd..4c200ba47 100644 --- a/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/BitUtility.java +++ b/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/BitUtility.java @@ -1,58 +1,58 @@ -package org.simantics.db.procore.cluster; - -final class BitUtility { - static final long LongBits = 64; - static final int IntBits = 32; - static final short ShortBits = 16; - static final long ClearHighIntMask = (1L << IntBits) - 1; - static final long ClearLowIntMask = -1l ^ ClearHighIntMask; - static final long ClearHighShortMask = (1L << ShortBits) - 1; - static final long ClearLowShortMask = -1L ^ ClearHighShortMask; - - static final int getHighInt(long longValue) { - return (int) (longValue >>> IntBits); - } - - static final long setHighInt(long longValue, int highValue) { - longValue = (longValue & ClearHighIntMask) | (long) highValue << IntBits; - return longValue; - } - - static final int getLowInt(long longValue) { - return (int) longValue; - } - - static final long setLowInt(long longValue, int lowValue) { - longValue = (longValue & ClearLowIntMask) | lowValue; - return longValue; - } - - static final long setLowAndHighInt(long longValue, int lowValue, int highValue) { - longValue = ((long) lowValue & ClearHighIntMask) | ((long) highValue << IntBits); - return longValue; - } - - static final short getLowShort(long longValue) { - return (short)longValue; - } - - static final long setLowShort(long longValue, short lowValue) { - longValue = (longValue & ClearLowShortMask) | (lowValue & ClearHighShortMask); - return longValue; - } - - static final int getMiddle(final long longValue, final int skip, final int size) { - return (int)(longValue >>> skip) & (1<>> IntBits); + } + + static final long setHighInt(long longValue, int highValue) { + longValue = (longValue & ClearHighIntMask) | (long) highValue << IntBits; + return longValue; + } + + static final int getLowInt(long longValue) { + return (int) longValue; + } + + static final long setLowInt(long longValue, int lowValue) { + longValue = (longValue & ClearLowIntMask) | lowValue; + return longValue; + } + + static final long setLowAndHighInt(long longValue, int lowValue, int highValue) { + longValue = ((long) lowValue & ClearHighIntMask) | ((long) highValue << IntBits); + return longValue; + } + + static final short getLowShort(long longValue) { + return (short)longValue; + } + + static final long setLowShort(long longValue, short lowValue) { + longValue = (longValue & ClearLowShortMask) | (lowValue & ClearHighShortMask); + return longValue; + } + + static final int getMiddle(final long longValue, final int skip, final int size) { + return (int)(longValue >>> skip) & (1<