Java Utililty Methods Long Number Align

List of utility methods to do Long Number Align

Description

The list of methods to do Long Number Align are organized into topic(s).

Method

longalign(final long value, final long alignment)
align
return (value + (alignment - 1)) & ~(alignment - 1);
longalign(long size, long boundary)
align
return (size + boundary - 1) & ~(boundary - 1);
longalign(long value, int al)
align
int rest = (int) (value % (long) al);
return value - rest;
longalign(long value, long alignment)
align
return divideAndRoundUp(value, alignment) * alignment;
longalignDown(long value, long granularity)
align Down
return (value / granularity) * granularity;
longalignLength(int sectorSize, long remoteOffset, long len)
align Length
long alignedSize = len + namespaceSectorOffset(sectorSize, remoteOffset);
if (namespaceSectorOffset(sectorSize, alignedSize) != 0) {
    alignedSize += (long) sectorSize - namespaceSectorOffset(sectorSize, alignedSize);
return alignedSize;
longalignOffset(int sectorSize, long fileOffset)
align Offset
return fileOffset - namespaceSectorOffset(sectorSize, fileOffset);
longalignQueryTimestampToBaseAggregationTime(long queryTimestamp)
align Query Timestamp To Base Aggregation Time
if (isBaseAggregationTimestamp(queryTimestamp)) {
    return queryTimestamp;
} else {
    return queryTimestamp - queryTimestamp % AGGREGATION_TIME_INTERVAL;
longalignSize(long size)
align Size
long i = size % SIZE_OF_OBJECT_INSTANCE;
if (i == 0) {
    return size;
return size + SIZE_OF_OBJECT_INSTANCE - i;
longalignSize(long size, long alignment)
align Size
if (alignment > 1) {
    long r = size % alignment;
    if (r != 0) {
        size += alignment - r;
return size;