bitunion.hh (4698:88acffc31e4a) bitunion.hh (5136:53c8a5da3d65)
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 179 unchanged lines hidden (view full) ---

188 //implementations for various operators. Setting things up this way
189 //prevents having to redefine these functions in every different BitUnion
190 //type. More operators could be implemented in the future, as the need
191 //arises.
192 template <class Type, class Base>
193 class BitUnionOperators : public Base
194 {
195 public:
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 179 unchanged lines hidden (view full) ---

188 //implementations for various operators. Setting things up this way
189 //prevents having to redefine these functions in every different BitUnion
190 //type. More operators could be implemented in the future, as the need
191 //arises.
192 template <class Type, class Base>
193 class BitUnionOperators : public Base
194 {
195 public:
196 BitUnionOperators(Type & _data)
196 BitUnionOperators(Type const & _data)
197 {
198 Base::__data = _data;
199 }
200
201 BitUnionOperators() {}
202
203 operator Type () const
204 {
205 return Base::__data;
206 }
207
208 Type
197 {
198 Base::__data = _data;
199 }
200
201 BitUnionOperators() {}
202
203 operator Type () const
204 {
205 return Base::__data;
206 }
207
208 Type
209 operator=(const Type & _data)
209 operator=(Type const & _data)
210 {
211 Base::__data = _data;
212 return _data;
213 }
214
215 bool
210 {
211 Base::__data = _data;
212 return _data;
213 }
214
215 bool
216 operator<(const Base & base) const
216 operator<(Base const & base) const
217 {
218 return Base::__data < base.__data;
219 }
220
221 bool
217 {
218 return Base::__data < base.__data;
219 }
220
221 bool
222 operator==(const Base & base) const
222 operator==(Base const & base) const
223 {
224 return Base::__data == base.__data;
225 }
226 };
227}
228
229//This macro is a backend for other macros that specialize it slightly.
230//First, it creates/extends a namespace "BitfieldUnderlyingClasses" and

--- 83 unchanged lines hidden ---
223 {
224 return Base::__data == base.__data;
225 }
226 };
227}
228
229//This macro is a backend for other macros that specialize it slightly.
230//First, it creates/extends a namespace "BitfieldUnderlyingClasses" and

--- 83 unchanged lines hidden ---