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_half.h')
-rw-r--r--intern/cycles/util/util_half.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/intern/cycles/util/util_half.h b/intern/cycles/util/util_half.h
index 612228dd1c1..f6c507906f3 100644
--- a/intern/cycles/util/util_half.h
+++ b/intern/cycles/util/util_half.h
@@ -36,7 +36,16 @@ CCL_NAMESPACE_BEGIN
/* CUDA has its own half data type, no need to define then */
#ifndef __KERNEL_CUDA__
-typedef unsigned short half;
+/* Implementing this as a class rather than a typedef so that the compiler can tell it apart from unsigned shorts. */
+class half {
+public:
+ half() : v(0) {}
+ half(const unsigned short& i) : v(i) {}
+ operator unsigned short() { return v; }
+ half & operator =(const unsigned short& i) { v = i; return *this; }
+private:
+ unsigned short v;
+};
#endif
struct half4 { half x, y, z, w; };