base: Tag API methods and variables in bitunion.hh
Change-Id: I322645801e9832014f54d4ed633796b082b06c6b Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/32958 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -121,6 +121,7 @@ class BitfieldType : public BitfieldTypeImpl<Base>
|
||||
BitfieldType(const BitfieldType &) = default;
|
||||
|
||||
operator Type () const { return Impl::operator Type(); }
|
||||
|
||||
Type operator=(const Type val) { return Impl::operator=(val); }
|
||||
Type
|
||||
operator=(BitfieldType<Base> const & other)
|
||||
@@ -321,10 +322,14 @@ namespace BitfieldBackend
|
||||
union { \
|
||||
type __storage;
|
||||
|
||||
//This closes off the class and union started by the above macro. It is
|
||||
//followed by a typedef which makes "name" refer to a BitfieldOperator
|
||||
//class inheriting from the class and union just defined, which completes
|
||||
//building up the type for the user.
|
||||
/**
|
||||
* This closes off the class and union started by the above macro. It is
|
||||
* followed by a typedef which makes "name" refer to a BitfieldOperator
|
||||
* class inheriting from the class and union just defined, which completes
|
||||
* building up the type for the user.
|
||||
*
|
||||
* @ingroup api_bitunion
|
||||
*/
|
||||
#define EndBitUnion(name) \
|
||||
}; \
|
||||
}; \
|
||||
@@ -343,11 +348,15 @@ namespace BitfieldBackend
|
||||
union { \
|
||||
fieldType<__VA_ARGS__> __storage;
|
||||
|
||||
//This closes off the union created above and gives it a name. Unlike the top
|
||||
//level BitUnion, we're interested in creating an object instead of a type.
|
||||
//The operators are defined in the macro itself instead of a class for
|
||||
//technical reasons. If someone determines a way to move them to one, please
|
||||
//do so.
|
||||
/**
|
||||
* This closes off the union created above and gives it a name. Unlike the top
|
||||
* level BitUnion, we're interested in creating an object instead of a type.
|
||||
* The operators are defined in the macro itself instead of a class for
|
||||
* technical reasons. If someone determines a way to move them to one, please
|
||||
* do so.
|
||||
*
|
||||
* @ingroup api_bitunion
|
||||
*/
|
||||
#define EndSubBitUnion(name) \
|
||||
}; \
|
||||
inline operator __StorageType () const \
|
||||
@@ -357,20 +366,36 @@ namespace BitfieldBackend
|
||||
{ return __storage = _storage;} \
|
||||
} name;
|
||||
|
||||
//Regular bitfields
|
||||
//These define macros for read/write regular bitfield based subbitfields.
|
||||
/**
|
||||
* Regular bitfields
|
||||
* These define macros for read/write regular bitfield based subbitfields.
|
||||
*
|
||||
* @ingroup api_bitunion
|
||||
*/
|
||||
#define SubBitUnion(name, first, last) \
|
||||
__SubBitUnion(name, Bitfield, first, last)
|
||||
|
||||
//Regular bitfields
|
||||
//These define macros for read/write regular bitfield based subbitfields.
|
||||
/**
|
||||
* Regular bitfields
|
||||
* These define macros for read/write regular bitfield based subbitfields.
|
||||
*
|
||||
* @ingroup api_bitunion
|
||||
*/
|
||||
#define SignedSubBitUnion(name, first, last) \
|
||||
__SubBitUnion(name, SignedBitfield, first, last)
|
||||
|
||||
//Use this to define an arbitrary type overlayed with bitfields.
|
||||
/**
|
||||
* Use this to define an arbitrary type overlayed with bitfields.
|
||||
*
|
||||
* @ingroup api_bitunion
|
||||
*/
|
||||
#define BitUnion(type, name) __BitUnion(type, name)
|
||||
|
||||
//Use this to define conveniently sized values overlayed with bitfields.
|
||||
/**
|
||||
* Use this to define conveniently sized values overlayed with bitfields.
|
||||
*
|
||||
* @ingroup api_bitunion
|
||||
*/
|
||||
#define BitUnion64(name) __BitUnion(uint64_t, name)
|
||||
#define BitUnion32(name) __BitUnion(uint32_t, name)
|
||||
#define BitUnion16(name) __BitUnion(uint16_t, name)
|
||||
@@ -392,6 +417,9 @@ namespace BitfieldBackend
|
||||
|
||||
//Also, BitUnionBaseType can be used on a BitUnion type directly.
|
||||
|
||||
/**
|
||||
* @ingroup api_bitunion
|
||||
*/
|
||||
template <typename T>
|
||||
using BitUnionType = BitfieldBackend::BitUnionOperators<T>;
|
||||
|
||||
@@ -410,6 +438,9 @@ namespace BitfieldBackend
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup api_bitunion
|
||||
*/
|
||||
template <typename T>
|
||||
using BitUnionBaseType = typename BitfieldBackend::BitUnionBaseType<T>::Type;
|
||||
|
||||
@@ -460,8 +491,12 @@ namespace BitfieldBackend
|
||||
}
|
||||
}
|
||||
|
||||
//A default << operator which casts a bitunion to its underlying type and
|
||||
//passes it to BitfieldBackend::bitfieldBackendPrinter.
|
||||
/**
|
||||
* A default << operator which casts a bitunion to its underlying type and
|
||||
* passes it to BitfieldBackend::bitfieldBackendPrinter.
|
||||
*
|
||||
* @ingroup api_bitunion
|
||||
*/
|
||||
template <typename T>
|
||||
std::ostream &
|
||||
operator << (std::ostream &os, const BitUnionType<T> &bu)
|
||||
|
||||
Reference in New Issue
Block a user