RECLAIM/OIDC: code cleanup
[oweals/gnunet.git] / src / include / gnunet_common.h
index 3a847945590871a6737b7b3cad26d68ac7c4c0f9..2c40aef797e348700a4b92699726843707ffe043 100644 (file)
@@ -256,6 +256,27 @@ extern "C"
 
 GNUNET_NETWORK_STRUCT_BEGIN
 
+/**
+ * @brief A 512-bit hashcode.  These are the default length for GNUnet, using SHA-512.
+ */
+struct GNUNET_HashCode
+{
+  uint32_t bits[512 / 8 / sizeof (uint32_t)];   /* = 16 */
+};
+
+
+
+/**
+ * @brief A 256-bit hashcode.  Used under special conditions, like when space
+ * is critical and security is not impacted by it.
+ */
+struct GNUNET_ShortHashCode
+{
+  uint32_t bits[256 / 8 / sizeof (uint32_t)];   /* = 8 */
+};
+
+
+
 /**
  * Header for all communications.
  */
@@ -919,8 +940,8 @@ GNUNET_ntoh_double (double d);
  * the same pointer type.
  */
 #define GNUNET_memcmp(a,b) ({ \
-  const typeof(b) _a = (a); \
-  const typeof(a) _b = (b); \
+  const typeof(*b) * _a = (a); \
+  const typeof(*a) * _b = (b); \
   memcmp(_a, \
          _b, \
          sizeof (*a)); })
@@ -933,8 +954,8 @@ GNUNET_ntoh_double (double d);
  *          entire memory being zero'ed out.
  */
 #define GNUNET_is_zero(a) ({ \
-  const typeof(*a) _z = { 0 };      \
-  memcmp(a, \
+  static const typeof(*a) _z;      \
+  memcmp((a), \
          &_z, \
          sizeof (_z)); })