root/trunk/src/bitflag.h

Revision 918, 1.0 kB (checked in by takkaria, 4 months ago)

Use consistent newlines everywhere, and also set the svn:eol-style property to native on all text files.

  • Property svn:eol-style set to native
Line 
1 /*
2  * File: bitflag.h
3  * Purpose: Manipulating bitflags.
4  *
5  * Copyright (c) 2007 Kenneth Boyd.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  *  * Redistributions of source code must retain the above copyright notice,
11  *    this list of conditions and the following disclaimer.
12  *
13  *  * Redistributions in binary form must reproduce the above copyright notice,
14  *    this list of conditions and the following disclaimer in the documentation
15  *    and/or other materials provided with the distribution.
16  */
17
18 /*
19  * alternate flag approach for 32-bit bitvectors
20  */
21 #define FLAG_FROM_INDEX(F)   (1UL << ((F)%32))
22 #define OFFSET_FROM_INDEX(F) ((F)/32)
23 #define TEST_FLAG(A,F)       (A[OFFSET_FROM_INDEX(F)] & FLAG_FROM_INDEX(F))
24 #define SET_FLAG(A,F)        (A[OFFSET_FROM_INDEX(F)] |= FLAG_FROM_INDEX(F))
25 #define RESET_FLAG(A,F)      (A[OFFSET_FROM_INDEX(F)] &= ~(FLAG_FROM_INDEX(F))
Note: See TracBrowser for help on using the browser.