Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/cycles/util/util_hash.h')
-rw-r--r--intern/cycles/util/util_hash.h55
1 files changed, 31 insertions, 24 deletions
diff --git a/intern/cycles/util/util_hash.h b/intern/cycles/util/util_hash.h
index f343252eaca..785482967db 100644
--- a/intern/cycles/util/util_hash.h
+++ b/intern/cycles/util/util_hash.h
@@ -23,49 +23,56 @@ CCL_NAMESPACE_BEGIN
ccl_device_inline uint hash_int_2d(uint kx, uint ky)
{
-#define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k))))
-
- uint a, b, c;
-
- a = b = c = 0xdeadbeef + (2 << 2) + 13;
- a += kx;
- b += ky;
-
- c ^= b; c -= rot(b,14);
- a ^= c; a -= rot(c,11);
- b ^= a; b -= rot(a,25);
- c ^= b; c -= rot(b,16);
- a ^= c; a -= rot(c,4);
- b ^= a; b -= rot(a,14);
- c ^= b; c -= rot(b,24);
-
- return c;
+#define rot(x, k) (((x) << (k)) | ((x) >> (32 - (k))))
+
+ uint a, b, c;
+
+ a = b = c = 0xdeadbeef + (2 << 2) + 13;
+ a += kx;
+ b += ky;
+
+ c ^= b;
+ c -= rot(b, 14);
+ a ^= c;
+ a -= rot(c, 11);
+ b ^= a;
+ b -= rot(a, 25);
+ c ^= b;
+ c -= rot(b, 16);
+ a ^= c;
+ a -= rot(c, 4);
+ b ^= a;
+ b -= rot(a, 14);
+ c ^= b;
+ c -= rot(b, 24);
+
+ return c;
#undef rot
}
ccl_device_inline uint hash_int(uint k)
{
- return hash_int_2d(k, 0);
+ return hash_int_2d(k, 0);
}
#ifndef __KERNEL_GPU__
static inline uint hash_string(const char *str)
{
- uint i = 0, c;
+ uint i = 0, c;
- while((c = *str++))
- i = i * 37 + c;
+ while ((c = *str++))
+ i = i * 37 + c;
- return i;
+ return i;
}
#endif
ccl_device_inline float hash_int_01(uint k)
{
- return (float)hash_int(k) * (1.0f/(float)0xFFFFFFFF);
+ return (float)hash_int(k) * (1.0f / (float)0xFFFFFFFF);
}
CCL_NAMESPACE_END
-#endif /* __UTIL_HASH_H__ */
+#endif /* __UTIL_HASH_H__ */