diff options
author | David Garcia Quintas <dgq@google.com> | 2015-07-15 16:51:14 -0700 |
---|---|---|
committer | David Garcia Quintas <dgq@google.com> | 2015-07-15 16:51:14 -0700 |
commit | 305e3bd6359f646746a0046f8fc44c82270c16ef (patch) | |
tree | 1ed54d2a9df5f9e2325cc7988521280376d71f13 /include/grpc/support/useful.h | |
parent | 58ff670f03dda1116420a838a6d2ade4a15eb4c5 (diff) |
Added bitset macro ops
Diffstat (limited to 'include/grpc/support/useful.h')
-rw-r--r-- | include/grpc/support/useful.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/grpc/support/useful.h b/include/grpc/support/useful.h index e1ce0455c6..6eb212a311 100644 --- a/include/grpc/support/useful.h +++ b/include/grpc/support/useful.h @@ -52,4 +52,13 @@ b = x; \ } while (0) +/** Set the \a n-th bit of \a i */ +#define GPR_BITSET(i, n) (i |= (1u << n)) + +/** Clear the \a n-th bit of \a i */ +#define GPR_BITCLEAR(i, n) (i &= ~(1u << n)) + +/** Get the \a n-th bit of \a i */ +#define GPR_BITGET(i, n) ((i & (1u << n)) != 0) + #endif /* GRPC_SUPPORT_USEFUL_H */ |