aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/source/flsupport.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'externals/grill/flext/source/flsupport.cpp')
-rw-r--r--externals/grill/flext/source/flsupport.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/externals/grill/flext/source/flsupport.cpp b/externals/grill/flext/source/flsupport.cpp
index 3c6ab8f3..f3309ab0 100644
--- a/externals/grill/flext/source/flsupport.cpp
+++ b/externals/grill/flext/source/flsupport.cpp
@@ -128,13 +128,22 @@ void flext::GetAString(const t_atom &a,char *buf,int szbuf)
#endif
}
+unsigned long flext::AtomHash(const t_atom &a)
+{
+#if FLEXT_SYS == FLEXT_SYS_MAX || FLEXT_SYS == FLEXT_SYS_PD
+ return ((unsigned long)a.a_type<<28)^*(unsigned long *)&a.a_w;
+#else
+#error Not implemented
+#endif
+}
+
unsigned int flext::FoldBits(unsigned long h,int bits)
{
if(!bits) return 0;
const int hmax = (1<<bits)-1;
unsigned int ret = 0;
for(unsigned int i = 0; i < sizeof(h)*8; i += bits)
- ret = ret^((h>>i)&hmax);
+ ret ^= (h>>i)&hmax;
return ret;
}