summaryrefslogtreecommitdiff
path: root/drivers/etc1
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/etc1')
-rw-r--r--drivers/etc1/SCsub3
-rw-r--r--drivers/etc1/rg_etc1.cpp5
2 files changed, 6 insertions, 2 deletions
diff --git a/drivers/etc1/SCsub b/drivers/etc1/SCsub
index 152dc3f4d0..251c3ffb86 100644
--- a/drivers/etc1/SCsub
+++ b/drivers/etc1/SCsub
@@ -6,7 +6,8 @@ etc_sources = [
"etc1/rg_etc1.cpp"
]
-env.drivers_sources+=etc_sources
+if (env["etc1"] != "no"):
+ env.drivers_sources+=etc_sources
#env.add_source_files(env.drivers_sources, etc_sources)
diff --git a/drivers/etc1/rg_etc1.cpp b/drivers/etc1/rg_etc1.cpp
index 63877e6d12..fd109f003c 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) {
@@ -1913,7 +1916,7 @@ done:
for (uint packed_c = 0; packed_c < limit; packed_c++)
{
int v = etc1_decode_value(diff, inten, selector, packed_c);
- uint err = intabs(v - color);
+ uint err = labs(v - static_cast<int>(color));
//printf("err: %d - %u = %u\n",v,color,err);
if (err < best_error)
{