logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git/

bitmasks.h (406B)


  1. // SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  2. // SPDX-License-Identifier: CC0-1.0
  3. // C had one job: Portable bitfields.
  4. #define FIELD_SET(field, val) field |= (val)
  5. #define FIELD_CLR(field, val) field &= ~(val)
  6. #define FIELD_TGL(field, val) field ^= (val)
  7. #define FIELD_GET(field, val) (field & (val))
  8. #define FIELD_MATCH(field, val) ((field & (val)) == (val))