From 6159f5ca866a2b9c17c5784e44b44fe8190e3fea Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Thu, 26 Sep 2024 10:51:30 -0700 Subject: [PATCH] should fix the formatting issue --- src/apps/applib/include/args.h | 4 +-- src/apps/benchmarks/benchmarkGridPathCells.c | 10 +++++--- src/apps/benchmarks/benchmarkH3Api.c | 5 ++-- src/apps/benchmarks/benchmarkVertex.c | 5 ++-- src/h3lib/include/h3Index.h | 27 +++++++++----------- 5 files changed, 26 insertions(+), 25 deletions(-) diff --git a/src/apps/applib/include/args.h b/src/apps/applib/include/args.h index 038038b03..511913836 100644 --- a/src/apps/applib/include/args.h +++ b/src/apps/applib/include/args.h @@ -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 = { \ @@ -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 = { \ diff --git a/src/apps/benchmarks/benchmarkGridPathCells.c b/src/apps/benchmarks/benchmarkGridPathCells.c index 333fe967e..2fcbaeb92 100644 --- a/src/apps/benchmarks/benchmarkGridPathCells.c +++ b/src/apps/benchmarks/benchmarkGridPathCells.c @@ -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); diff --git a/src/apps/benchmarks/benchmarkH3Api.c b/src/apps/benchmarks/benchmarkH3Api.c index 22ec3ca8f..d54b66597 100644 --- a/src/apps/benchmarks/benchmarkH3Api.c +++ b/src/apps/benchmarks/benchmarkH3Api.c @@ -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(); diff --git a/src/apps/benchmarks/benchmarkVertex.c b/src/apps/benchmarks/benchmarkVertex.c index 38e90cff0..a0bd6c01d 100644 --- a/src/apps/benchmarks/benchmarkVertex.c +++ b/src/apps/benchmarks/benchmarkVertex.c @@ -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++) { diff --git a/src/h3lib/include/h3Index.h b/src/h3lib/include/h3Index.h index 5dfa7ce3d..6ced3c4cd 100644 --- a/src/h3lib/include/h3Index.h +++ b/src/h3lib/include/h3Index.h @@ -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. @@ -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)