MUTILS_API quint32 next_rand32(void);
MUTILS_API quint64 next_rand64(void);
+ //Parity
+ MUTILS_API bool parity(quint32 value);
+
//Remove File/Dir
MUTILS_API bool remove_file(const QString &fileName);
MUTILS_API bool remove_directory(const QString &folderPath, const bool &recursive);
}
///////////////////////////////////////////////////////////////////////////////
+// COMPUTE PARITY
+///////////////////////////////////////////////////////////////////////////////
+
+/*
+ * Compute parity in parallel
+ * http://www.graphics.stanford.edu/~seander/bithacks.html#ParityParallel
+ */
+bool MUtils::parity(quint32 value)
+{
+ value ^= value >> 16;
+ value ^= value >> 8;
+ value ^= value >> 4;
+ value &= 0xf;
+ return ((0x6996 >> value) & 1) != 0;
+}
+
+///////////////////////////////////////////////////////////////////////////////
// TEMP FOLDER
///////////////////////////////////////////////////////////////////////////////