static PrimitiveTypeCodec mapPrimitiveType(final PrimitiveType type)
    {
        if (type == null)
        {
            return PrimitiveTypeCodec.NONE;
        }

        switch (type)
        {
            case INT8:
                return PrimitiveTypeCodec.INT8;

            case INT16:
                return PrimitiveTypeCodec.INT16;

            case INT32:
                return PrimitiveTypeCodec.INT32;

            case INT64:
                return PrimitiveTypeCodec.INT64;

            case UINT8:
                return PrimitiveTypeCodec.UINT8;

            case UINT16:
                return PrimitiveTypeCodec.UINT16;

            case UINT32:
                return PrimitiveTypeCodec.UINT32;

            case UINT64:
                return PrimitiveTypeCodec.UINT64;

            case FLOAT:
                return PrimitiveTypeCodec.FLOAT;

            case DOUBLE:
                return PrimitiveTypeCodec.DOUBLE;

            case CHAR:
                return PrimitiveTypeCodec.CHAR;

            default:
                return PrimitiveTypeCodec.NONE;
        }
    }
Utility functions for working with {@link Ir}.
sbe-tool/src/main/java/uk/co/real_logic/sbe/ir/IrUtil.java