VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/include/cr_bits.h@ 22509

Last change on this file since 22509 was 15532, checked in by vboxsync, 16 years ago

crOpenGL: export to OSE

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.4 KB
Line 
1/* Copyright (c) 2001, Stanford University
2 * All rights reserved.
3 *
4 * See the file LICENSE.txt for information on redistributing this software.
5 */
6
7/* Bit vector functions */
8
9#ifndef CR_BITS_H
10#define CR_BITS_H
11
12
13#include "cr_compiler.h"
14
15
16#define CR_MAX_CONTEXTS 512
17#define CR_MAX_BITARRAY (CR_MAX_CONTEXTS / 32) /* 32 contexts per uint */
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23static INLINE void RESET( unsigned int *b, const unsigned int *d )
24{
25 int j;
26 for (j=0;j<CR_MAX_BITARRAY;j++)
27 b[j] |= d[j];
28}
29static INLINE void DIRTY( unsigned int *b, const unsigned int *d )
30{
31 int j;
32 for (j=0;j<CR_MAX_BITARRAY;j++)
33 b[j] = d[j];
34}
35static INLINE void FILLDIRTY( unsigned int *b )
36{
37 int j;
38 for (j=0;j<CR_MAX_BITARRAY;j++)
39 b[j] = 0xffffffff;
40}
41static INLINE void CLEARDIRTY( unsigned int *b, const unsigned int *d )
42{
43 int j;
44 for (j=0;j<CR_MAX_BITARRAY;j++)
45 b[j] &= d[j];
46}
47
48/* As above, but complement the bits here instead of in the calling code */
49static INLINE void CLEARDIRTY2( unsigned int *b, const unsigned int *d )
50{
51 int j;
52 for (j=0;j<CR_MAX_BITARRAY;j++)
53 b[j] &= ~d[j];
54}
55
56static INLINE int CHECKDIRTY( const unsigned int *b, const unsigned int *d )
57{
58 int j;
59
60 for (j=0;j<CR_MAX_BITARRAY;j++)
61 if (b[j] & d[j])
62 return 1;
63
64 return 0;
65}
66
67#ifdef __cplusplus
68}
69#endif
70
71
72#endif /* CR_BITS_H */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette