1/* |
2 * Copyright (c) 2007-2008 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; 9 * redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the --- 226 unchanged lines hidden (view full) --- 237//the type to propagate outside of the macro itself in a controlled way. 238//Finally, the base storage is defined which BitfieldOperators will refer to 239//in the operators it defines. This macro is intended to be followed by 240//bitfield definitions which will end up inside it's union. As explained 241//above, these is overlayed the __data member in its entirety by each of the 242//bitfields which are defined in the union, creating shared storage with no 243//overhead. 244#define __BitUnion(type, name) \ |
245 class BitfieldUnderlyingClasses##name : \ |
246 public BitfieldBackend::BitfieldTypes<type> \ 247 { \ 248 public: \ 249 typedef type __DataType; \ 250 union { \ 251 type __data;\ 252 253//This closes off the class and union started by the above macro. It is 254//followed by a typedef which makes "name" refer to a BitfieldOperator 255//class inheriting from the class and union just defined, which completes 256//building up the type for the user. 257#define EndBitUnion(name) \ 258 }; \ 259 }; \ 260 typedef BitfieldBackend::BitUnionOperators< \ |
261 BitfieldUnderlyingClasses##name::__DataType, \ 262 BitfieldUnderlyingClasses##name> name; |
263 264//This sets up a bitfield which has other bitfields nested inside of it. The 265//__data member functions like the "underlying storage" of the top level 266//BitUnion. Like everything else, it overlays with the top level storage, so 267//making it a regular bitfield type makes the entire thing function as a 268//regular bitfield when referred to by itself. 269#define __SubBitUnion(fieldType, first, last, name) \ 270 class : public BitfieldBackend::BitfieldTypes<__DataType> \ --- 39 unchanged lines hidden --- |