diff --git a/Data/Bits.hs b/Data/Bits.hs
index 2385ab9..80bb3d5 100644
--- a/Data/Bits.hs
+++ b/Data/Bits.hs
@@ -36,13 +36,14 @@ module Data.Bits (
     shiftL, shiftR,
     unsafeShiftL, unsafeShiftR,
     rotateL, rotateR,
-    popCount
+    popCount, bSwap
   ),
   FiniteBits(finiteBitSize),
 
   bitDefault,
   testBitDefault,
-  popCountDefault
+  popCountDefault,
+  bSwapDefault
  ) where
 
 -- Defines the @Bits@ class containing bit-based operations.
@@ -79,8 +80,8 @@ The 'Bits' class defines bitwise operations over integral types.
 
 Minimal complete definition: '.&.', '.|.', 'xor', 'complement',
 ('shift' or ('shiftL' and 'shiftR')), ('rotate' or ('rotateL' and 'rotateR')),
-'bitSize', 'isSigned', 'testBit', 'bit', and 'popCount'.  The latter three can
-be implemented using `testBitDefault', 'bitDefault, and 'popCountDefault', if
+'bitSize', 'isSigned', 'testBit', 'bit', 'popCount' and 'bSwap'.  The latter four can
+be implemented using `testBitDefault', 'bitDefault, 'popCountDefault' and 'bSwapDefault', if
 @a@ is also an instance of 'Num'.
 -}
 class Eq a => Bits a where
@@ -247,6 +248,10 @@ class Eq a => Bits a where
         known as the population count or the Hamming weight. -}
     popCount          :: a -> Int
 
+    {-| Swap the order of bytes (group of 8 bits) in the argument.
+        This is usually referred as endianness swap. -}
+    bSwap             :: a -> a
+
 class Bits b => FiniteBits b where
     finiteBitSize :: b -> Int
 
@@ -279,6 +284,16 @@ popCountDefault = go 0
    go c w = go (c+1) (w .&. (w - 1)) -- clear the least significant
 {-# INLINABLE popCountDefault #-}
 
+-- | Default implementation for 'bSwap'
+--
+-- This implementation is intentionally naive. Instances are expected to provide
+-- an optimized implementation for their size.
+bSwapDefault :: (Bits a, Num a) => a -> a
+bSwapDefault = go 0
+  where
+    go !c 0 = c
+    go c  w = go ((c `unsafeShiftL` 8) .|. (w .&. 0xff)) (w `unsafeShiftR` 8)
+
 instance Bits Int where
     {-# INLINE shift #-}
     {-# INLINE bit #-}
@@ -317,10 +332,12 @@ instance Bits Int where
     bitSize i              = finiteBitSize i
 
     popCount (I# x#) = I# (word2Int# (popCnt# (int2Word# x#)))
+    bSwap (I# x#) = I# (word2Int# (bSwap# (int2Word# x#)))
 
 #else /* !__GLASGOW_HASKELL__ */
 
     popCount               = popCountDefault
+    bSwap                  = bSwapDefault
 
 #ifdef __HUGS__
     (.&.)                  = primAndInt
@@ -376,6 +393,7 @@ instance Bits Word where
     bitSize i                = finiteBitSize i
     isSigned _               = False
     popCount (W# x#)         = I# (word2Int# (popCnt# x#))
+    bSwap    (W# x#)         = W# (bSwap# x#)
     bit                      = bitDefault
     testBit                  = testBitDefault
 
@@ -415,6 +433,7 @@ instance Bits Integer where
 
    bit        = bitDefault
    popCount   = popCountDefault
+   bSwap      = bSwapDefault
 
    rotate x i = shift x i   -- since an Integer never wraps around
 
