LUT: disable when running on big-endian systems
authorØyvind Kolås <pippin@gimp.org>
Sat, 22 Apr 2023 13:29:33 +0000 (15:29 +0200)
committerØyvind Kolås <pippin@gimp.org>
Sat, 22 Apr 2023 13:29:33 +0000 (15:29 +0200)
We are crashing due to endian assumptions - we now only try to do the LUT
optimizations on little endian - no functionality is lost on big-endian
though conversion might be a tad slower. Hopefully fixing issue #91

babl/babl-fish-path.c

index c01cc2d7c0cca6c51abaf4d1230db1b48fb0d356..ef195f8e59c74f28e36ee245b15530a93867df0d 100644 (file)
@@ -648,6 +648,14 @@ _babl_legal_error (void)
   else
     enable_lut = 1;
 
+  { 
+    const uint32_t u32 = 1;
+    if ( *((char*)&u32) == 0)
+    {  /* disable use of LUTs if we are running on big endian */
+       enable_lut = 0;
+    }
+  }
+
   return error;
 }