X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fbase%2Fbitunion.hh;h=f640fa3b19275b3d77400037312bc5453cdf870f;hb=b8c2fa6ba9850d079574ca6d7c91b93dcd3aacb8;hp=7f7b06966609e91e0601ec18e1ceea19f07cd827;hpb=90f42bf3ad99f3c99323773e7e26db7e66597fb9;p=gem5.git diff --git a/src/base/bitunion.hh b/src/base/bitunion.hh index 7f7b06966..f640fa3b1 100644 --- a/src/base/bitunion.hh +++ b/src/base/bitunion.hh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2005 The Regents of The University of Michigan + * Copyright (c) 2007-2008 The Regents of The University of Michigan * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,10 +31,10 @@ #ifndef __BASE_BITUNION_HH__ #define __BASE_BITUNION_HH__ -#include #include "base/bitfield.hh" +#include "base/types.hh" -// The following implements the BitUnion system of defining bitfields +// The following implements the BitUnion system of defining bitfields //on top of an underlying class. This is done through the pervasive use of //both named and unnamed unions which all contain the same actual storage. //Since they're unioned with each other, all of these storage locations @@ -86,7 +86,7 @@ namespace BitfieldBackend class Bitfield : public BitfieldBase { public: - operator uint64_t () const + operator const uint64_t () const { return this->getBits(first, last); } @@ -117,7 +117,7 @@ namespace BitfieldBackend class BitfieldWO : public Bitfield { private: - operator uint64_t () const; + operator const uint64_t () const; public: using Bitfield::operator=; @@ -136,7 +136,7 @@ namespace BitfieldBackend class SignedBitfield : public BitfieldBase { public: - operator int64_t () const + operator const int64_t () const { return sext(this->getBits(first, last)); } @@ -167,7 +167,7 @@ namespace BitfieldBackend class SignedBitfieldWO : public SignedBitfield { private: - operator int64_t () const; + operator const int64_t () const; public: int64_t operator=(const int64_t _data) @@ -200,7 +200,7 @@ namespace BitfieldBackend BitUnionOperators() {} - operator Type () const + operator const Type () const { return Base::__data; } @@ -242,11 +242,7 @@ namespace BitfieldBackend //bitfields which are defined in the union, creating shared storage with no //overhead. #define __BitUnion(type, name) \ - namespace BitfieldUnderlyingClasses \ - { \ - class name; \ - } \ - class BitfieldUnderlyingClasses::name : \ + class BitfieldUnderlyingClasses##name : \ public BitfieldBackend::BitfieldTypes \ { \ public: \ @@ -262,8 +258,8 @@ namespace BitfieldBackend }; \ }; \ typedef BitfieldBackend::BitUnionOperators< \ - BitfieldUnderlyingClasses::name::__DataType, \ - BitfieldUnderlyingClasses::name> name; + BitfieldUnderlyingClasses##name::__DataType, \ + BitfieldUnderlyingClasses##name> name; //This sets up a bitfield which has other bitfields nested inside of it. The //__data member functions like the "underlying storage" of the top level @@ -284,7 +280,7 @@ namespace BitfieldBackend //do so. #define EndSubBitUnion(name) \ }; \ - inline operator const __DataType () \ + inline operator const __DataType () const \ { return __data; } \ \ inline const __DataType operator = (const __DataType & _data) \