diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-27 21:04:42 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-27 21:04:42 +0000 |
commit | 46bfa65fccf58cee280bf552193f93388b00d16d (patch) | |
tree | 02e80407cd7a19697e9b6b606db2d2f7733ac21b /internal.h | |
parent | 6cf78f0e6786cf0074c68302594bd6964f6b3ca8 (diff) | |
download | ruby-46bfa65fccf58cee280bf552193f93388b00d16d.tar.gz |
internal.h: add BITFIELD macro to aid C99 users
I plan to use this macro to pack other enums in the VM.
* internal.h: add BITFIELD macro
* method.h: use BITFIELD for rb_method_visibility_t
[ruby-core:85074] [Misc #14395]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'internal.h')
-rw-r--r-- | internal.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/internal.h b/internal.h index 59f5d640cc..f6742cd458 100644 --- a/internal.h +++ b/internal.h @@ -2066,6 +2066,19 @@ rb_obj_builtin_type(VALUE obj) # define FLEX_ARY_LEN 1 /* VALUE ary[1]; */ #endif +/* + * For declaring bitfields out of non-unsigned int types: + * struct date { + * BITFIELD(enum months) month:4; + * ... + * }; + */ +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) +# define BITFIELD(type) type +#else +# define BITFIELD(type) unsigned int +#endif + #if defined(__cplusplus) #if 0 { /* satisfy cc-mode */ |