Merge remote-tracking branch 'origin/master' into blender2.8
authorDalai Felinto <dfelinto@gmail.com>
Thu, 1 Feb 2018 15:13:44 +0000 (13:13 -0200)
committerDalai Felinto <dfelinto@gmail.com>
Thu, 1 Feb 2018 15:13:44 +0000 (13:13 -0200)
intern/cycles/util/util_simd.h
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenlib/BLI_fileops.h

index f432fd7957a33807f28529f3d9c0aa0ea7685d52..04341451afbccd36552fac51c03ac2c871493050 100644 (file)
@@ -454,12 +454,21 @@ ccl_device_inline int bitscan(int value)
 {
        assert(value != 0);
        int bit = 0;
-       while(value >>= 1) {
+       while((value & (1 << bit)) == 0) {
                ++bit;
        }
        return bit;
 }
 
+ccl_device_inline int __bsr(int value)
+{
+       assert(value != 0);
+       int bit = 0;
+       while(value >>= 1) {
+               ++bit;
+       }
+       return bit;
+}
 
 #endif /* __KERNEL_SSE2__ */
 
index fbecf326d3287bebe4460b42639dff71e382d033..d71735ca8c44427bf9ea47e2cdc578ab351c902c 100644 (file)
@@ -1660,7 +1660,7 @@ static void shapekey_layers_to_keyblocks(DerivedMesh *dm, Mesh *me, int actshape
                cos = CustomData_get_layer_n(&dm->vertData, CD_SHAPEKEY, i);
                kb->totelem = dm->numVertData;
 
-               kb->data = kbcos = MEM_malloc_arrayN(kb->totelem, sizeof(float), "kbcos DerivedMesh.c");
+               kb->data = kbcos = MEM_malloc_arrayN(kb->totelem, 3 * sizeof(float), "kbcos DerivedMesh.c");
                if (kb->uid == actshape_uid) {
                        MVert *mvert = dm->getVertArray(dm);
                        
index 5c1fa57886a2a326f520a791b2c566f14319f470..bb23c63bdb35099ddc3c6ca2979bfa4d14166e38 100644 (file)
@@ -35,6 +35,7 @@
 
 #include <stdio.h>
 #include <sys/stat.h>
+#include <stdint.h>
 
 #ifdef __cplusplus
 extern "C" {