uitils: add floored and euclidian modulo functions

C/C++ only implements a so called "truncated modulo" function. Lets also
add a floored and an euclidian modulo function to be more complete.

The functions will be used to generalize the following Change:
I5fb2b0ada8d409730ac22963741fb4ab0026abdd

Change-Id: If61cd54f43643325c45f64531c57fe4c5802a9cf
diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h
index d0e2e9b..ee7cfa4 100644
--- a/include/osmocom/core/utils.h
+++ b/include/osmocom/core/utils.h
@@ -182,6 +182,18 @@
 
 uint32_t osmo_isqrt32(uint32_t x);
 
+/*! Floored Modulo (See also: Daan Leijen, Division and Modulus for Computer Scientists).
+ * \param[in] x dividend.
+ * \param[in] y divisor.
+ * \returns remainder of x divided by y. */
+#define OSMO_MOD_FLR(x, y) (((x) > 0 && (y) < 0) || ((x) < 0 && (y) > 0) ? (x) % (y) + (y) : (x) % (y))
+
+/*! Euclidean Modulo (See also: Daan Leijen, Division and Modulus for Computer Scientists).
+ * \param[in] x dividend.
+ * \param[in] y divisor.
+ * \returns remainder of x divided by y. */
+#define OSMO_MOD_EUC(x, y) ((x) % (y) < 0 ? (y) > 0 ? (x) % (y) + (y) : (x) % (y) - (y) : (x) % (y))
+
 char osmo_luhn(const char* in, int in_len);
 
 /*! State for OSMO_STRBUF_APPEND() and OSMO_STRBUF_PRINTF(). See there for examples. */