dev,sim: Fix compiler not finding specialized byte_swap

The specialized version of byte_swap cannot be found by
the compiler. As a temporary workaround to get the major
patch going, move the specialization to the base header
file.

Change-Id: I7d2bfc1c29b70042860ae06cdc043c0490cd8916
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/46322
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
This commit is contained in:
Daniel R. Carvalho
2021-06-01 10:08:52 -03:00
committed by Daniel Carvalho
parent 223b0b388e
commit 6be82cc3ae
2 changed files with 21 additions and 8 deletions

View File

@@ -68,17 +68,18 @@ class VirtQueue;
* of byte swapping.
*/
static inline vring_used_elem
swap_byte(vring_used_elem v)
template <typename T>
inline std::enable_if_t<std::is_same<T, vring_used_elem>::value, T>
swap_byte(T v)
{
v.id = swap_byte(v.id);
v.len = swap_byte(v.len);
return v;
}
static inline vring_desc
swap_byte(vring_desc v)
template <typename T>
inline std::enable_if_t<std::is_same<T, vring_desc>::value, T>
swap_byte(T v)
{
v.addr = swap_byte(v.addr);
v.len = swap_byte(v.len);