[Kst] extragear/graphics/kst/src/datasources/scuba2

Andrew Walker arwalker at sumusltd.com
Fri Feb 9 23:32:58 CET 2007


SVN commit 632080 by arwalker:

correctly handle sign bit

 M  +8 -8      scuba.cpp  


--- trunk/extragear/graphics/kst/src/datasources/scuba2/scuba.cpp #632079:632080
@@ -534,14 +534,14 @@
                               lvalue >>= 14;
                               lvalue &= 0x3FFFF;
                               if (lvalue & 0x40000) {
+                                lvalue &= 0x1FFFF;
                                 lvalue *= -1;
-                                lvalue &= 0x1FFFF;
                               }
                             } else {
                               lvalue &= 0x3FFF;
                               if (lvalue & 0x4000) {
+                                lvalue &= 0x1FFF;
                                 lvalue *= -1;
-                                lvalue &= 0x1FFF;
                               }
                             }
                             break;
@@ -550,14 +550,14 @@
                               lvalue >>= 8;
                               lvalue  &= 0xFFFFFF;
                               if (lvalue & 0x800000) {
+                                lvalue &= 0x7FFFFF;
                                 lvalue *= -1;
-                                lvalue &= 0x7FFFFF;
                               }
                             } else {
                               lvalue &= 0xFF;
                               if (lvalue & 0x80) {
+                                lvalue &= 0x7F;
                                 lvalue *= -1;
-                                lvalue &= 0x7F;
                               }
                             }
                             break;
@@ -722,14 +722,14 @@
                             lvalue >>= 14;
                             lvalue &= 0x3FFFF;
                             if (lvalue & 0x40000) {
+                              lvalue &= 0x1FFFF;
                               lvalue *= -1;
-                              lvalue &= 0x1FFFF;
                             }
                           } else {
                             lvalue &= 0x3FFF;
                             if (lvalue & 0x4000) {
+                              lvalue &= 0x1FFF;
                               lvalue *= -1;
-                              lvalue &= 0x1FFF;
                             }
                           }
                           break;
@@ -738,14 +738,14 @@
                             lvalue >>= 8;
                             lvalue  &= 0xFFFFFF;
                             if (lvalue & 0x800000) {
+                              lvalue &= 0x7FFFFF;
                               lvalue *= -1;
-                              lvalue &= 0x7FFFFF;
                             }
                           } else {
                             lvalue &= 0xFF;
                             if (lvalue & 0x80) {
+                              lvalue &= 0x7F;
                               lvalue *= -1;
-                              lvalue &= 0x7F;
                             }
                           }
                           break;


More information about the Kst mailing list