Class BitUtil
java.lang.Object
org.springframework.data.elasticsearch.utils.geohash.BitUtil
/** Code copied from Elasticsearch 7.10, Apache License V2
https://github.com/elastic/elasticsearch/blob/7.10/libs/geo/src/main/java/org/elasticsearch/geometry/utils/BitUtil.java
Utilities for common Bit twiddling methods. Borrowed heavily from Lucene (org.apache.lucene.util.BitUtil).
Utilities for common Bit twiddling methods. Borrowed heavily from Lucene (org.apache.lucene.util.BitUtil).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic long
deinterleave
(long b) Extract just the even-bits value as a long from the bit-interleaved valuestatic long
flipFlop
(long b) flip flops odd with even bitsstatic long
interleave
(int even, int odd) Interleaves the first 32 bits of each long value Adapted from: https://graphics.stanford.edu/~seander/bithacks.html#InterleaveBMN
-
Constructor Details
-
BitUtil
public BitUtil()
-
-
Method Details
-
interleave
public static long interleave(int even, int odd) Interleaves the first 32 bits of each long value Adapted from: https://graphics.stanford.edu/~seander/bithacks.html#InterleaveBMN -
deinterleave
public static long deinterleave(long b) Extract just the even-bits value as a long from the bit-interleaved value -
flipFlop
public static long flipFlop(long b) flip flops odd with even bits
-