diff --git a/ChangeLog b/ChangeLog
index 53896792ee6e3356ca5cc6cd748ffd377bf60a50..bb140378a0cf54d589713bed0528916bbac5d4be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2019-03-27  Niels Möller  <nisse@lysator.liu.se>
+
+	* xts.c (xts_shift): Arrange with a single write to u64[1].
+	* cmac.c (block_mulx): Rewrite to work in the same way as
+	xts_shift, with 64-bit operations. XTS and CMAC use opposite
+	endianness, but otherwise, these two functions are identical.
+
 2019-03-24  Niels Möller  <nisse@lysator.liu.se>
 
 	From Simo Sorce:
diff --git a/cmac.c b/cmac.c
index d08bd8325b16ee3c2f24699855d0661150a63c5a..ed3b5eb8f613c7115f11ffada7f88c3608c79cf4 100644
--- a/cmac.c
+++ b/cmac.c
@@ -47,22 +47,27 @@
 #include "macros.h"
 
 /* shift one and XOR with 0x87. */
+#if WORDS_BIGENDIAN
 static void
 block_mulx(union nettle_block16 *dst,
 	   const union nettle_block16 *src)
 {
-  uint64_t b1 = READ_UINT64(src->b);
-  uint64_t b2 = READ_UINT64(src->b+8);
-
-  b1 = (b1 << 1) | (b2 >> 63);
-  b2 <<= 1;
-
-  if (src->b[0] & 0x80)
-    b2 ^= 0x87;
-
-  WRITE_UINT64(dst->b, b1);
-  WRITE_UINT64(dst->b+8, b2);
+  uint64_t carry = src->u64[0] >> 63;
+  dst->u64[0] = (src->u64[0] << 1) | (src->u64[1] >> 63);
+  dst->u64[1] = (src->u64[1] << 1) ^ (0x87 & -carry);
+}
+#else /* !WORDS_BIGENDIAN */
+#define LE_SHIFT(x) ((((x) & 0x7f7f7f7f7f7f7f7f) << 1) | \
+                     (((x) & 0x8080808080808080) >> 15))
+static void
+block_mulx(union nettle_block16 *dst,
+	   const union nettle_block16 *src)
+{
+  uint64_t carry = (src->u64[0] & 0x80) >> 7;
+  dst->u64[0] = LE_SHIFT(src->u64[0]) | ((src->u64[1] & 0x80) << 49);
+  dst->u64[1] = LE_SHIFT(src->u64[1]) ^ (0x8700000000000000 & -carry);
 }
+#endif /* !WORDS_BIGENDIAN */
 
 void
 cmac128_set_key(struct cmac128_ctx *ctx, const void *cipher,
diff --git a/xts.c b/xts.c
index ea2ceea90619ea2b77386d308d4dfd2e24113d74..6730b3ad76ffaff4cd4f28fa06a883cf814c6fb8 100644
--- a/xts.c
+++ b/xts.c
@@ -57,8 +57,7 @@ xts_shift(union nettle_block16 *dst,
 {
   uint64_t carry = (src->u64[1] & 0x80) >> 7;
   dst->u64[1] = BE_SHIFT(src->u64[1]) | ((src->u64[0] & 0x80) << 49);
-  dst->u64[0] = BE_SHIFT(src->u64[0]);
-  dst->u64[0] ^= 0x8700000000000000 & -carry;
+  dst->u64[0] = BE_SHIFT(src->u64[0]) ^ (0x8700000000000000 & -carry);
 }
 #else /* !WORDS_BIGENDIAN */
 static void
@@ -67,8 +66,7 @@ xts_shift(union nettle_block16 *dst,
 {
   uint64_t carry = src->u64[1] >> 63;
   dst->u64[1] = (src->u64[1] << 1) | (src->u64[0] >> 63);
-  dst->u64[0] = src->u64[0] << 1;
-  dst->u64[0] ^= 0x87 & -carry;
+  dst->u64[0] = (src->u64[0] << 1) ^ (0x87 & -carry);
 }
 #endif /* !WORDS_BIGNDIAN */