Ver código fonte

trying 128bit stuff

Nicolas Winkler 5 anos atrás
pai
commit
dd18f9f960
3 arquivos alterados com 22 adições e 5 exclusões
  1. 1 1
      Almond.pro
  2. 1 1
      customgenerator.ui
  3. 20 3
      libmandel/src/opencl/fixed128.cl

+ 1 - 1
Almond.pro

@@ -126,7 +126,7 @@ unix|win32: LIBS += -L$FFMPEGPATH -lswscale
 RESOURCES += Almond.qrc \
     splash.qrc
 
-unix|win32: LIBS += -L$$PWD/libmandel/ -L$$PWD/libalmond/ -lmandel -lqd -lasmjit -lalmond -lpng
+unix|win32: LIBS += -L$$PWD/libmandel/ -L$$PWD/libalmond/ -lmandel -lqd -lasmjit -lalmond -llibpng16_static -lzlibstatic
 unix: LIBS += -lrt
 
 INCLUDEPATH += $$PWD/libmandel/include $$PWD/libmandel/qd-2.3.22/include $$PWD/libalmond/include

+ 1 - 1
customgenerator.ui

@@ -11,7 +11,7 @@
    </rect>
   </property>
   <property name="windowTitle">
-   <string>Dialog</string>
+   <string>Custom Generator</string>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
    <item>

+ 20 - 3
libmandel/src/opencl/fixed128.cl

@@ -1,9 +1,26 @@
 
 
 long2 mul(long2 a, long2 b) {
-    long upper = mul_hi(a, b);
-    long lower = a * b;
-    return (upper << 16) + ((lower >> 48) & 0xFFFF);
+    long a0 = mul_hi(a[0], b[0]);
+    long b0 = a[0] * b[0];
+    long b1 = mul_hi(a[0], b[1]);
+    long b2 = mul_hi(a[1], b[0]);
+    long c0 = a[1] * b[0];
+    long c1 = a[0] * b[1];
+    long c2 = mul_hi(a[1], b[1]);
+    long c3 = mul_hi(a[1], b[1]);
+
+    long carry = 0;
+    long r1 = b0 + b1;
+    if (r1 < b0)
+        carry++;
+    long r2 = r1 + b2;
+    if (r2 < r1)
+        carry++;
+
+    a0 += carry;
+
+    long newUpper = (a0 << 16) + ((r2 >> 48) & 0xFFFF);
 }