Fix PR comments

This commit is contained in:
Patrick Niklaus 2017-04-11 22:27:43 +00:00 committed by Patrick Niklaus
parent a66918a303
commit 609801ae99
2 changed files with 30 additions and 4 deletions

View File

@ -0,0 +1,22 @@
#ifndef OSRM_EXTRACTOR_PACKED_OSM_IDS_HPP
#define OSRM_EXTRACTOR_PACKED_OSM_IDS_HPP
#include "util/packed_vector.hpp"
#include "util/typedefs.hpp"
namespace osrm
{
namespace extractor
{
namespace detail
{
template <storage::Ownership Ownership>
using PackedOSMIDs = util::detail::PackedVector<OSMNodeID, 33, Ownership>;
}
using PackedOSMIDsView = detail::PackedOSMIDs<storage::Ownership::View>;
using PackedOSMIDs = detail::PackedOSMIDs<storage::Ownership::Container>;
}
}
#endif

View File

@ -33,10 +33,12 @@ namespace detail
{
template <typename T, std::size_t Bits, storage::Ownership Ownership> class PackedVector
{
static_assert(std::is_integral<T>, "T must be an integral type.");
static_assert(sizeof(T) <= sizeof(std::uint64_t), "Maximum size of type T is 8 bytes");
static_assert(Bits <= sizeof(std::uint64_t)*CHAR_BIT, "Maximum number of bits it 64.");
static_assert(Bits > 0, "Minimum number of bits is 0.");
static_assert(Bits <= sizeof(std::uint64_t) * CHAR_BIT, "Maximum number of bits is 64.");
static const constexpr std::size_t ELEMSIZE = sizeof(std::uint64_t)*CHAR_BIT;
static const constexpr std::size_t ELEMSIZE = sizeof(std::uint64_t) * CHAR_BIT;
static const constexpr std::size_t PACKSIZE = Bits * ELEMSIZE;
public:
@ -213,8 +215,10 @@ template <typename T, std::size_t Bits, storage::Ownership Ownership> class Pack
};
}
template <typename T, std::size_t Bits> using PackedVector = detail::PackedVector<T, Bits, storage::Ownership::Container>;
template <typename T, std::size_t Bits> using PackedVectorView = detail::PackedVector<T, Bits, storage::Ownership::View>;
template <typename T, std::size_t Bits>
using PackedVector = detail::PackedVector<T, Bits, storage::Ownership::Container>;
template <typename T, std::size_t Bits>
using PackedVectorView = detail::PackedVector<T, Bits, storage::Ownership::View>;
}
}