Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/41593 )

Change subject: scons: Introduce a version of reverseBits for 8 bit types.
......................................................................

scons: Introduce a version of reverseBits for 8 bit types.

These types shouldn't be shifted by 8, since shifting a type by its
width is technically undefined behavior. We never actually use the
result from this shift, but it still upsets certain versions of clang.

Change-Id: I425431473fa44a6e0de2edf780c265ff4e3f440e
---
M src/base/bitfield.hh
1 file changed, 9 insertions(+), 1 deletion(-)



diff --git a/src/base/bitfield.hh b/src/base/bitfield.hh
index 1ec684f..470941a 100644
--- a/src/base/bitfield.hh
+++ b/src/base/bitfield.hh
@@ -209,7 +209,7 @@
  * @ingroup api_bitfield
  */
 template <class T>
-std::enable_if_t<std::is_integral<T>::value, T>
+std::enable_if_t<std::is_integral<T>::value && sizeof(T) != 1, T>
 reverseBits(T val, size_t size=sizeof(T))
 {
     assert(size <= sizeof(T));
@@ -223,6 +223,14 @@
     return output;
 }

+template <class T>
+std::enable_if_t<std::is_integral<T>::value && sizeof(T) == 1, T>
+reverseBits(T val, size_t size=sizeof(T))
+{
+    assert(size == 1);
+    return reverseBitsLookUpTable[val];
+}
+
 /**
  * Returns the bit position of the MSB that is set in the input
  *

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41593
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I425431473fa44a6e0de2edf780c265ff4e3f440e
Gerrit-Change-Number: 41593
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to