summaryrefslogtreecommitdiff
path: root/cogl/cogl-flags.h
diff options
context:
space:
mode:
Diffstat (limited to 'cogl/cogl-flags.h')
-rw-r--r--cogl/cogl-flags.h29
1 files changed, 12 insertions, 17 deletions
diff --git a/cogl/cogl-flags.h b/cogl/cogl-flags.h
index af07532f..14fb8f19 100644
--- a/cogl/cogl-flags.h
+++ b/cogl/cogl-flags.h
@@ -36,36 +36,31 @@ G_BEGIN_DECLS
that will be set is known at compile time, for example when setting
for recording a set of known available features */
-/* The bits are stored in an array of unsigned ints. It would probably
- make sense to use unsigned long instead because then on 64-bit
- systems where it can handle 64-bits just as easily and it can test
- more bits. However GDebugKey uses a guint for the mask and we need
- to fit the masks into this */
-
-/* To use these macros, you would typically have an enum defining the
- available bits with an extra last enum to define the maximum
- value. Then to store the flags you would declare an array of
- unsigned ints sized using COGL_FLAGS_N_INTS_FOR_SIZE, eg:
+/* The bits are stored in an array of unsigned longs. To use these
+ macros, you would typically have an enum defining the available
+ bits with an extra last enum to define the maximum value. Then to
+ store the flags you would declare an array of unsigned longs sized
+ using COGL_FLAGS_N_LONGS_FOR_SIZE, eg:
typedef enum { FEATURE_A, FEATURE_B, FEATURE_C, N_FEATURES } Features;
- unsigned int feature_flags[COGL_FLAGS_N_INTS_FOR_SIZE (N_FEATURES)];
+ unsigned long feature_flags[COGL_FLAGS_N_LONGS_FOR_SIZE (N_FEATURES)];
*/
-#define COGL_FLAGS_N_INTS_FOR_SIZE(size) \
+#define COGL_FLAGS_N_LONGS_FOR_SIZE(size) \
(((size) + \
- (sizeof (unsigned int) * 8 - 1)) \
- / (sizeof (unsigned int) * 8))
+ (sizeof (unsigned long) * 8 - 1)) \
+ / (sizeof (unsigned long) * 8))
/* @flag is expected to be constant so these should result in a
constant expression. This means that setting a flag is equivalent
to just setting in a bit in a global variable at a known
location */
#define COGL_FLAGS_GET_INDEX(flag) \
- ((flag) / (sizeof (unsigned int) * 8))
+ ((flag) / (sizeof (unsigned long) * 8))
#define COGL_FLAGS_GET_MASK(flag) \
- (1U << ((unsigned int) (flag) & \
- (sizeof (unsigned int) * 8 - 1)))
+ (1UL << ((unsigned long) (flag) & \
+ (sizeof (unsigned long) * 8 - 1)))
#define COGL_FLAGS_GET(array, flag) \
(!!((array)[COGL_FLAGS_GET_INDEX (flag)] & \