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:
authorJacques Lucke <jacques@blender.org>2020-11-18 14:00:45 +0300
committerJacques Lucke <jacques@blender.org>2020-12-02 17:38:47 +0300
commitd65628466a35682f6bb80def6835abee3766ff1b (patch)
treec3c244df932278599113231fddd4a107451877ed /source/blender/blenlib/BLI_float2.hh
parent8268b9827a4f344e1a9414a7fb33e02ccaed95c1 (diff)
Functions: add float2 cpp type
This also adds a hash function for `float2`, because `CPPType` expects that currently.
Diffstat (limited to 'source/blender/blenlib/BLI_float2.hh')
-rw-r--r--source/blender/blenlib/BLI_float2.hh7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_float2.hh b/source/blender/blenlib/BLI_float2.hh
index 1290eb6c65c..d41c4d262d3 100644
--- a/source/blender/blenlib/BLI_float2.hh
+++ b/source/blender/blenlib/BLI_float2.hh
@@ -80,6 +80,13 @@ struct float2 {
return *this;
}
+ uint64_t hash() const
+ {
+ uint64_t x1 = *reinterpret_cast<const uint32_t *>(&x);
+ uint64_t x2 = *reinterpret_cast<const uint32_t *>(&y);
+ return (x1 * 812519) ^ (x2 * 707951);
+ }
+
friend float2 operator+(const float2 &a, const float2 &b)
{
return {a.x + b.x, a.y + b.y};