Skip to content

Commit

Permalink
kram - fix bug in length() call, and warnings in lodepng
Browse files Browse the repository at this point in the history
  • Loading branch information
alecazam committed May 13, 2021
1 parent 4be8f27 commit f0f81cb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion libkram/kram/float4a.h
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ inline float length_squared(const float4& vv)
}
inline float length(const float4& vv)
{
return sqrtf(length(vv));
return sqrtf(length_squared(vv));
}

// sse4.1 ops
Expand Down
6 changes: 3 additions & 3 deletions libkram/lodepng/lodepng.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ static unsigned HuffmanTree_makeTable(HuffmanTree* tree) {
size = headsize;
for(i = 0; i < headsize; ++i) {
unsigned l = maxlens[i];
if(l > FIRSTBITS) size += (1u << (l - FIRSTBITS));
if(l > FIRSTBITS) size += (unsigned)(1u << (l - FIRSTBITS));
}
tree->table_len = (unsigned char*)lodepng_malloc(size * sizeof(*tree->table_len));
tree->table_value = (unsigned short*)lodepng_malloc(size * sizeof(*tree->table_value));
Expand All @@ -734,7 +734,7 @@ static unsigned HuffmanTree_makeTable(HuffmanTree* tree) {
if(l <= FIRSTBITS) continue;
tree->table_len[i] = l;
tree->table_value[i] = pointer;
pointer += (1u << (l - FIRSTBITS));
pointer += (unsigned)(1u << (l - FIRSTBITS));
}
lodepng_free(maxlens);

Expand Down Expand Up @@ -5447,7 +5447,7 @@ static size_t ilog2i(size_t i) {
l = ilog2(i);
/* approximate i*log2(i): l is integer logarithm, ((i - (1u << l)) << 1u)
linearly approximates the missing fractional part multiplied by i */
return i * l + ((i - (1u << l)) << 1u);
return i * l + ((i - ((size_t)1 << l)) << (size_t)1);
}

static unsigned filter(unsigned char* out, const unsigned char* in, unsigned w, unsigned h,
Expand Down

0 comments on commit f0f81cb

Please sign in to comment.