#ifndef INCLUDED_FSWAP_
#define INCLUDED_FSWAP_

#include <cstring>
#include <cstdint>

namespace FBB
{

class FSwap
{
    template <typename Tp, size_t size>
    struct Xch
    {
        static void fswap(Tp &lhs, Tp &rhs);            // 1.f
    };
    
    template <typename Tp>
    struct Xch<Tp, 1>
    {
        static void fswap(Tp &lhs, Tp &rhs);            // 2.f
    };

    template <typename Tp>
    struct Xch<Tp, 2>
    {
        static void fswap(Tp &lhs, Tp &rhs);            // 3.f
    };

    template <typename Tp>
    struct Xch<Tp, 4>
    {
        static void fswap(Tp &lhs, Tp &rhs);            // 4.f
    };

    template <typename Tp>
    struct Xch<Tp, 8>
    {
        static void fswap(Tp &lhs, Tp &rhs);            // 5.f
    };
    
    template <typename SwapType, typename Type>
    static void tswap(Type &lhs, Type &rhs);                // .f
};

#include "tswap.f"
#include "fswap1.f"
#include "fswap2.f"
#include "fswap3.f"
#include "fswap4.f"
#include "fswap5.f"

    // Free function
#include "fswap.f"              // fswap(Type &, Type &

} // FBB

#endif
