dev: Overload swap_bytes, don't specialize the template.

The effect is the same, the rules for overloads are easier to work with
than the rules for templates, and it removes the assumption that
swap_bytes actually is a template.

Also some minor style fixes.

Change-Id: Id9439177185b5269dd89605bbd05b09390a18d40
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45285
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Gabe Black
2021-05-10 05:27:59 -07:00
parent 8076a41183
commit 00caced648

View File

@@ -68,15 +68,17 @@ class VirtQueue;
*/
template <> inline vring_used_elem
swap_byte(vring_used_elem v) {
static inline vring_used_elem
swap_byte(vring_used_elem v)
{
v.id = swap_byte(v.id);
v.len = swap_byte(v.len);
return v;
}
template <> inline vring_desc
swap_byte(vring_desc v) {
static inline vring_desc
swap_byte(vring_desc v)
{
v.addr = swap_byte(v.addr);
v.len = swap_byte(v.len);
v.flags = swap_byte(v.flags);