Created
May 2, 2020 14:22
-
-
Save lighth7015/8cae2c42a94f59b77275ad25ecdae8ee to your computer and use it in GitHub Desktop.
Calculating maximum number based on value of enum
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
enum { MAX_NUM_OBJECTS = 29 }; | |
typedef struct { | |
union { | |
uint32_t mask; | |
struct { | |
bool available : 1; | |
bool client : 1; | |
bool inproc : 1; | |
uint32_t index : MAX_NUM_OBJECTS; | |
}; | |
}; | |
} ObjectInfo; | |
int main() { | |
printf("The maximum number of entries is a calculation involving MAX_NUM_OBJECTS (%x).\n", 0); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment