Skip to content

Commit

Permalink
should fix the formatting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ajfriend committed Sep 26, 2024
1 parent 944a62b commit 6159f5c
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 25 deletions.
4 changes: 2 additions & 2 deletions src/apps/applib/include/args.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ int _parseArgsList(int argc, char *argv[], int numArgs, Arg *args[],
// common arguments

#define ARG_HELP \
{.names = {"-h", "--help"}, .helpText = "Show this help message."}
{ .names = {"-h", "--help"}, .helpText = "Show this help message." }
#define DEFINE_INDEX_ARG(varName, argName) \
H3Index varName = 0; \
Arg argName = { \
Expand All @@ -109,7 +109,7 @@ int _parseArgsList(int argc, char *argv[], int numArgs, Arg *args[],
.value = &varName, \
.helpText = "H3 Cell"}
#define ARG_KML \
{.names = {"-k", "--kml"}, .helpText = "Print output in KML format."}
{ .names = {"-k", "--kml"}, .helpText = "Print output in KML format." }
#define DEFINE_KML_NAME_ARG(varName, argName) \
char varName[BUFF_SIZE] = {0}; \
Arg argName = { \
Expand Down
10 changes: 6 additions & 4 deletions src/apps/benchmarks/benchmarkGridPathCells.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ int64_t size;
H3_EXPORT(gridPathCellsSize)(startIndex, endFar, &size);
H3Index *out = calloc(size, sizeof(H3Index));

BENCHMARK(gridPathCellsNear, 10000,
{ H3_EXPORT(gridPathCells)(startIndex, endNear, out); });
BENCHMARK(gridPathCellsFar, 1000,
{ H3_EXPORT(gridPathCells)(startIndex, endFar, out); });
BENCHMARK(gridPathCellsNear, 10000, {
H3_EXPORT(gridPathCells)(startIndex, endNear, out);
});
BENCHMARK(gridPathCellsFar, 1000, {
H3_EXPORT(gridPathCells)(startIndex, endFar, out);
});

free(out);

Expand Down
5 changes: 3 additions & 2 deletions src/apps/benchmarks/benchmarkH3Api.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ BENCHMARK(latLngToCell, 10000, { H3_EXPORT(latLngToCell)(&coord, 9, &h); });

BENCHMARK(cellToLatLng, 10000, { H3_EXPORT(cellToLatLng)(hex, &outCoord); });

BENCHMARK(cellToBoundary, 10000,
{ H3_EXPORT(cellToBoundary)(hex, &outBoundary); });
BENCHMARK(cellToBoundary, 10000, {
H3_EXPORT(cellToBoundary)(hex, &outBoundary);
});

END_BENCHMARKS();
5 changes: 3 additions & 2 deletions src/apps/benchmarks/benchmarkVertex.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ H3Index *vertexes = calloc(6, sizeof(H3Index));

BENCHMARK(cellToVertexes, 10000, { H3_EXPORT(cellToVertexes)(hex, vertexes); });

BENCHMARK(cellToVertexesPent, 10000,
{ H3_EXPORT(cellToVertexes)(pentagon, vertexes); });
BENCHMARK(cellToVertexesPent, 10000, {
H3_EXPORT(cellToVertexes)(pentagon, vertexes);
});

BENCHMARK(cellToVertexesRing, 10000, {
for (int i = 0; i < ring2Count; i++) {
Expand Down
27 changes: 12 additions & 15 deletions src/h3lib/include/h3Index.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,50 +92,47 @@
/**
* Gets the highest bit of the H3 index.
*/
#define H3_GET_HIGH_BIT(h3) \
((int)((((h3) & H3_HIGH_BIT_MASK) >> H3_MAX_OFFSET)))
#define H3_GET_HIGH_BIT(h3) ((int)((((h3)&H3_HIGH_BIT_MASK) >> H3_MAX_OFFSET)))

/**
* Sets the highest bit of the h3 to v.
*/
#define H3_SET_HIGH_BIT(h3, v) \
(h3) = (((h3) & H3_HIGH_BIT_MASK_NEGATIVE) | \
#define H3_SET_HIGH_BIT(h3, v) \
(h3) = (((h3)&H3_HIGH_BIT_MASK_NEGATIVE) | \
(((uint64_t)(v)) << H3_MAX_OFFSET))

/**
* Gets the integer mode of h3.
*/
#define H3_GET_MODE(h3) ((int)((((h3) & H3_MODE_MASK) >> H3_MODE_OFFSET)))
#define H3_GET_MODE(h3) ((int)((((h3)&H3_MODE_MASK) >> H3_MODE_OFFSET)))

/**
* Sets the integer mode of h3 to v.
*/
#define H3_SET_MODE(h3, v) \
(h3) = \
(((h3) & H3_MODE_MASK_NEGATIVE) | (((uint64_t)(v)) << H3_MODE_OFFSET))
(h3) = (((h3)&H3_MODE_MASK_NEGATIVE) | (((uint64_t)(v)) << H3_MODE_OFFSET))

/**
* Gets the integer base cell of h3.
*/
#define H3_GET_BASE_CELL(h3) ((int)((((h3) & H3_BC_MASK) >> H3_BC_OFFSET)))
#define H3_GET_BASE_CELL(h3) ((int)((((h3)&H3_BC_MASK) >> H3_BC_OFFSET)))

/**
* Sets the integer base cell of h3 to bc.
*/
#define H3_SET_BASE_CELL(h3, bc) \
(h3) = (((h3) & H3_BC_MASK_NEGATIVE) | (((uint64_t)(bc)) << H3_BC_OFFSET))
(h3) = (((h3)&H3_BC_MASK_NEGATIVE) | (((uint64_t)(bc)) << H3_BC_OFFSET))

/**
* Gets the integer resolution of h3.
*/
#define H3_GET_RESOLUTION(h3) ((int)((((h3) & H3_RES_MASK) >> H3_RES_OFFSET)))
#define H3_GET_RESOLUTION(h3) ((int)((((h3)&H3_RES_MASK) >> H3_RES_OFFSET)))

/**
* Sets the integer resolution of h3.
*/
#define H3_SET_RESOLUTION(h3, res) \
(h3) = \
(((h3) & H3_RES_MASK_NEGATIVE) | (((uint64_t)(res)) << H3_RES_OFFSET))
(h3) = (((h3)&H3_RES_MASK_NEGATIVE) | (((uint64_t)(res)) << H3_RES_OFFSET))

/**
* Gets the resolution res integer digit (0-7) of h3.
Expand All @@ -148,15 +145,15 @@
* Sets a value in the reserved space. Setting to non-zero may produce invalid
* indexes.
*/
#define H3_SET_RESERVED_BITS(h3, v) \
(h3) = (((h3) & H3_RESERVED_MASK_NEGATIVE) | \
#define H3_SET_RESERVED_BITS(h3, v) \
(h3) = (((h3)&H3_RESERVED_MASK_NEGATIVE) | \
(((uint64_t)(v)) << H3_RESERVED_OFFSET))

/**
* Gets a value in the reserved space. Should always be zero for valid indexes.
*/
#define H3_GET_RESERVED_BITS(h3) \
((int)((((h3) & H3_RESERVED_MASK) >> H3_RESERVED_OFFSET)))
((int)((((h3)&H3_RESERVED_MASK) >> H3_RESERVED_OFFSET)))

/**
* Sets the resolution res digit of h3 to the integer digit (0-7)
Expand Down

0 comments on commit 6159f5c

Please sign in to comment.