summaryrefslogtreecommitdiff
path: root/drivers/etc1/rg_etc1.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/etc1/rg_etc1.cpp')
-rw-r--r--drivers/etc1/rg_etc1.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/etc1/rg_etc1.cpp b/drivers/etc1/rg_etc1.cpp
index cad9af8830..28502191da 100644
--- a/drivers/etc1/rg_etc1.cpp
+++ b/drivers/etc1/rg_etc1.cpp
@@ -24,6 +24,9 @@
namespace rg_etc1
{
+ inline long labs(long val) {
+ return val < 0 ? -val : val;
+ }
inline int intabs(int val) {
@@ -1915,7 +1918,11 @@ done:
int v = etc1_decode_value(diff, inten, selector, packed_c);
uint err = intabs(v - color);
//printf("err: %d - %u = %u\n",v,color,err);
+ #ifdef JAVASCRIPT_ENABLED
+ if (err < best_error || best_error == cUINT32_MAX)
+ #else
if (err < best_error)
+ #endif
{
best_error = err;
best_packed_c = packed_c;