+/*----- Bitwise operations ------------------------------------------------*/
+
+/* --- @mpx_and@, @mpx_or@, @mpx_xor@, @mpx_not@ --- *
+ *
+ * Arguments: @mpw *dv, *dvl@ = destination vector
+ * @const mpw *av, *avl@ = first source vector
+ * @const mpw *bv, *bvl@ = second source vector
+ *
+ * Returns: ---
+ *
+ * Use; Does the obvious bitwise operations.
+ */
+
+#define MPX_BITBINOP(name, op) \
+ \
+void mpx_##name(mpw *dv, mpw *dvl, const mpw *av, const mpw *avl, \
+ const mpw *bv, const mpw *bvl) \
+{ \
+ MPX_SHRINK(av, avl); \
+ MPX_SHRINK(bv, bvl); \
+ \
+ while (dv < dvl) { \
+ mpw a, b; \
+ a = (av < avl) ? *av++ : 0; \
+ b = (bv < bvl) ? *bv++ : 0; \
+ *dv++ = a op b; \
+ } \
+}
+
+MPX_BITBINOP(and, &)
+MPX_BITBINOP(or, |)
+MPX_BITBINOP(xor, ^)
+
+void mpx_not(mpw *dv, mpw *dvl, const mpw *av, const mpw *avl)
+{
+ MPX_SHRINK(av, avl);
+
+ while (dv < dvl) {
+ mpw a;
+ a = (av < avl) ? *av++ : 0;
+ *dv++ = ~a;
+ }
+}
+