Skip to content

Commit

Permalink
clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
zeux committed Jun 7, 2021
1 parent 4acb6de commit 293187a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
13 changes: 6 additions & 7 deletions gltf/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,10 @@ static int readInt16(const std::string& data, size_t offset)

static int readInt32(const std::string& data, size_t offset)
{
return
((unsigned)(unsigned char)data[offset] << 24) |
((unsigned)(unsigned char)data[offset + 1] << 16) |
((unsigned)(unsigned char)data[offset + 2] << 8) |
(unsigned)(unsigned char)data[offset + 3];
return (unsigned((unsigned char)data[offset]) << 24) |
(unsigned((unsigned char)data[offset + 1]) << 16) |
(unsigned((unsigned char)data[offset + 2]) << 8) |
unsigned((unsigned char)data[offset + 3]);
}

static bool getDimensionsPng(const std::string& data, int& width, int& height)
Expand All @@ -138,8 +137,8 @@ static bool getDimensionsPng(const std::string& data, int& width, int& height)
if (data.compare(12, 4, "IHDR") != 0)
return false;

width = readInt16(data, 18);
height = readInt16(data, 22);
width = readInt32(data, 18);
height = readInt32(data, 22);

return true;
}
Expand Down
3 changes: 1 addition & 2 deletions src/clusterizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,7 @@ static size_t kdtreeBuild(size_t offset, KDNode* nodes, size_t node_count, const
}

// split axis is one where the variance is largest
unsigned int axis = vars[0] >= vars[1] && vars[0] >= vars[2] ? 0 : vars[1] >= vars[2] ? 1
: 2;
unsigned int axis = vars[0] >= vars[1] && vars[0] >= vars[2] ? 0 : vars[1] >= vars[2] ? 1 : 2;

float split = mean[axis];
size_t middle = kdtreePartition(indices, count, points, stride, axis, split);
Expand Down
4 changes: 2 additions & 2 deletions src/simplifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -952,8 +952,8 @@ static size_t performEdgeCollapses(unsigned int* collapse_remap, unsigned char*
float error_goal_perfect = edge_collapse_goal < collapse_count ? collapses[collapse_order[edge_collapse_goal]].error : 0.f;

printf("removed %d triangles, error %e (goal %e); evaluated %d/%d collapses (done %d, skipped %d, invalid %d)\n",
int(triangle_collapses), sqrtf(result_error), sqrtf(error_goal_perfect),
int(stats[0]), int(collapse_count), int(edge_collapses), int(stats[1]), int(stats[2]));
int(triangle_collapses), sqrtf(result_error), sqrtf(error_goal_perfect),
int(stats[0]), int(collapse_count), int(edge_collapses), int(stats[1]), int(stats[2]));
#endif

return edge_collapses;
Expand Down
3 changes: 2 additions & 1 deletion src/vertexfilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ static void decodeFilterExp(unsigned int* data, size_t count)
#endif

#if defined(SIMD_SSE) || defined(SIMD_NEON) || defined(SIMD_WASM)
template <typename T> static void dispatchSimd(void (*process)(T*, size_t), T* data, size_t count, size_t stride)
template <typename T>
static void dispatchSimd(void (*process)(T*, size_t), T* data, size_t count, size_t stride)
{
assert(stride <= 4);

Expand Down

0 comments on commit 293187a

Please sign in to comment.