clover: Optimize module serialization for vectors of fundamental types.
Tested-by: Tom Stellard <thomas.stellard@amd.com>
This commit is contained in:
@@ -69,7 +69,9 @@ namespace {
|
||||
|
||||
/// (De)serialize a vector.
|
||||
template<typename T>
|
||||
struct _serializer<compat::vector<T>> {
|
||||
struct _serializer<compat::vector<T>,
|
||||
typename std::enable_if<
|
||||
!std::is_scalar<T>::value>::type> {
|
||||
static void
|
||||
proc(compat::ostream &os, const compat::vector<T> &v) {
|
||||
_proc<uint32_t>(os, v.size());
|
||||
@@ -87,6 +89,25 @@ namespace {
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct _serializer<compat::vector<T>,
|
||||
typename std::enable_if<
|
||||
std::is_scalar<T>::value>::type> {
|
||||
static void
|
||||
proc(compat::ostream &os, const compat::vector<T> &v) {
|
||||
_proc<uint32_t>(os, v.size());
|
||||
os.write(reinterpret_cast<const char *>(v.begin()),
|
||||
v.size() * sizeof(T));
|
||||
}
|
||||
|
||||
static void
|
||||
proc(compat::istream &is, compat::vector<T> &v) {
|
||||
v.reserve(_proc<uint32_t>(is));
|
||||
is.read(reinterpret_cast<char *>(v.begin()),
|
||||
v.size() * sizeof(T));
|
||||
}
|
||||
};
|
||||
|
||||
/// (De)serialize a module::section.
|
||||
template<>
|
||||
struct _serializer<module::section> {
|
||||
|
||||
Reference in New Issue
Block a user