29 #define H3_NUM_BITS 64
32 #define H3_MAX_OFFSET 63
35 #define H3_MODE_OFFSET 59
38 #define H3_BC_OFFSET 45
41 #define H3_RES_OFFSET 52
44 #define H3_RESERVED_OFFSET 56
47 #define H3_PER_DIGIT_OFFSET 3
50 #define H3_HIGH_BIT_MASK ((uint64_t)(1) << H3_MAX_OFFSET)
53 #define H3_HIGH_BIT_MASK_NEGATIVE (~H3_HIGH_BIT_MASK)
56 #define H3_MODE_MASK ((uint64_t)(15) << H3_MODE_OFFSET)
59 #define H3_MODE_MASK_NEGATIVE (~H3_MODE_MASK)
62 #define H3_BC_MASK ((uint64_t)(127) << H3_BC_OFFSET)
65 #define H3_BC_MASK_NEGATIVE (~H3_BC_MASK)
68 #define H3_RES_MASK (UINT64_C(15) << H3_RES_OFFSET)
71 #define H3_RES_MASK_NEGATIVE (~H3_RES_MASK)
74 #define H3_RESERVED_MASK ((uint64_t)(7) << H3_RESERVED_OFFSET)
77 #define H3_RESERVED_MASK_NEGATIVE (~H3_RESERVED_MASK)
80 #define H3_DIGIT_MASK ((uint64_t)(7))
83 #define H3_DIGIT_MASK_NEGATIVE (~H3_DIGIT_MASK)
90 #define H3_INIT (UINT64_C(35184372088831))
95 #define H3_GET_HIGH_BIT(h3) ((int)((((h3)&H3_HIGH_BIT_MASK) >> H3_MAX_OFFSET)))
100 #define H3_SET_HIGH_BIT(h3, v) \
101 (h3) = (((h3)&H3_HIGH_BIT_MASK_NEGATIVE) | (((uint64_t)(v)) << H3_MAX_OFFSET))
106 #define H3_GET_MODE(h3) ((int)((((h3)&H3_MODE_MASK) >> H3_MODE_OFFSET)))
111 #define H3_SET_MODE(h3, v) \
112 (h3) = (((h3)&H3_MODE_MASK_NEGATIVE) | (((uint64_t)(v)) << H3_MODE_OFFSET))
117 #define H3_GET_BASE_CELL(h3) ((int)((((h3)&H3_BC_MASK) >> H3_BC_OFFSET)))
122 #define H3_SET_BASE_CELL(h3, bc) \
123 (h3) = (((h3)&H3_BC_MASK_NEGATIVE) | (((uint64_t)(bc)) << H3_BC_OFFSET))
128 #define H3_GET_RESOLUTION(h3) ((int)((((h3)&H3_RES_MASK) >> H3_RES_OFFSET)))
133 #define H3_SET_RESOLUTION(h3, res) \
134 (h3) = (((h3)&H3_RES_MASK_NEGATIVE) | (((uint64_t)(res)) << H3_RES_OFFSET))
139 #define H3_GET_INDEX_DIGIT(h3, res) \
140 ((Direction)((((h3) >> ((MAX_H3_RES - (res)) * H3_PER_DIGIT_OFFSET)) & H3_DIGIT_MASK)))
146 #define H3_SET_RESERVED_BITS(h3, v) \
147 (h3) = (((h3)&H3_RESERVED_MASK_NEGATIVE) | (((uint64_t)(v)) << H3_RESERVED_OFFSET))
152 #define H3_GET_RESERVED_BITS(h3) ((int)((((h3)&H3_RESERVED_MASK) >> H3_RESERVED_OFFSET)))
157 #define H3_SET_INDEX_DIGIT(h3, res, digit) \
158 (h3) = (((h3) & ~((H3_DIGIT_MASK << ((MAX_H3_RES - (res)) * H3_PER_DIGIT_OFFSET)))) | \
159 (((uint64_t)(digit)) << ((MAX_H3_RES - (res)) * H3_PER_DIGIT_OFFSET)))
171 #define COMPACT_SUCCESS 0
172 #define COMPACT_LOOP_EXCEEDED -1
173 #define COMPACT_DUPLICATE -2
174 #define COMPACT_ALLOC_FAILED -3
EXTENSION_NOINLINE bool _h3ToGeo(H3Index h3, GeoCoord(g))
EXTENSION_INLINE int _h3LeadingNonZeroDigit(H3Index h)
EXTENSION_NOINLINE int _h3ToFaceIjkWithInitializedFijk(H3Index h, FaceIJK(fijk))
#define GeoCoord(variable_name)
EXTENSION_NOINLINE H3Index _h3RotatePent60cw(H3Index h)
#define EXTENSION_NOINLINE
#define FaceIJK(variable_name)
EXTENSION_NOINLINE H3Index _faceIjkToH3(const FaceIJK(fijk), int res)
#define H3Index
the H3Index fits within a 64-bit unsigned integer
EXTENSION_NOINLINE H3Index _h3RotatePent60ccw(H3Index h)
EXTENSION_NOINLINE bool _h3ToFaceIjk(H3Index h, FaceIJK(fijk))
FaceIJK functions including conversion to/from lat/lon.
Primary H3 core library entry points.
EXTENSION_NOINLINE H3Index _h3Rotate60cw(H3Index h)
EXTENSION_NOINLINE H3Index _h3Rotate60ccw(H3Index h)