io.netty.util.internal.MathUtil Java Examples
The following examples show how to use
io.netty.util.internal.MathUtil.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CustomChannelId.java From netty-4.1.22 with Apache License 2.0 | 5 votes |
@Override public int compareTo(final ChannelId o) { if (o instanceof CustomChannelId) { return MathUtil.compare(id, ((CustomChannelId) o).id); } return asLongText().compareTo(o.asLongText()); }
Example #2
Source File: CodecOutputList.java From netty-4.1.22 with Apache License 2.0 | 5 votes |
CodecOutputLists(int numElements) { elements = new CodecOutputList[MathUtil.safeFindNextPositivePowerOfTwo(numElements)]; for (int i = 0; i < elements.length; ++i) { // Size of 16 should be good enough for the majority of all users as an initial capacity. elements[i] = new CodecOutputList(this, 16); } count = elements.length; currentIdx = elements.length; mask = elements.length - 1; }
Example #3
Source File: CharByteBufUtil.java From rsocket-java with Apache License 2.0 | 5 votes |
private static char[] checkCharSequenceBounds(char[] seq, int start, int end) { if (MathUtil.isOutOfBounds(start, end - start, seq.length)) { throw new IndexOutOfBoundsException( "expected: 0 <= start(" + start + ") <= end (" + end + ") <= seq.length(" + seq.length + ')'); } return seq; }
Example #4
Source File: WeightedFairQueueByteDistributor.java From netty-4.1.22 with Apache License 2.0 | 4 votes |
@Override public int compare(State o1, State o2) { return MathUtil.compare(o1.pseudoTimeToWrite, o2.pseudoTimeToWrite); }
Example #5
Source File: PoolThreadCache.java From netty-4.1.22 with Apache License 2.0 | 4 votes |
MemoryRegionCache(int size, SizeClass sizeClass) { this.size = MathUtil.safeFindNextPositivePowerOfTwo(size); queue = PlatformDependent.newFixedMpscQueue(this.size); this.sizeClass = sizeClass; }
Example #6
Source File: AbstractPool.java From activemq-artemis with Apache License 2.0 | 4 votes |
public AbstractPool(final int capacity) { entries = (O[]) new Object[MathUtil.findNextPositivePowerOfTwo(capacity)]; mask = entries.length - 1; //log2 of entries.length shift = 31 - Integer.numberOfLeadingZeros(entries.length); }
Example #7
Source File: AbstractByteBufPool.java From activemq-artemis with Apache License 2.0 | 4 votes |
public AbstractByteBufPool(final int capacity) { entries = (T[]) new Object[MathUtil.findNextPositivePowerOfTwo(capacity)]; mask = entries.length - 1; //log2 of entries.length shift = 31 - Integer.numberOfLeadingZeros(entries.length); }