Macros for operations (eg "and", "bitand") using iso646.h

Introduction

Macros for logic

Adds "and", "or", "not" and "not_eq".


int x = 1;
int y = 0;

// These are the same.
int z = x && y;
int z = x and y;

int x = 1;

// These are the same.
int z = ! x;
int z = not x;

int x = 1;
int y = 0;

// These are the same.
int z = x || y;
int z = x or y;

int x = 1;
int y = 0;

// These are the same.
int z = x != y;
int z = x not_eq y;

Macros for bitwise operations


int x = 12;
int y = 10;

// These are the same.
int z = x & y;
int z = x bitand y;

// These are the same.
int z = x | y;
int z = x bitor y;

// These are the same.
int z = x ^ y;
int z = x xor y;

Also eq versions


int x = 12;
int y = 10;

// These are the same.
int y &= x;
int y and_eq x;

// These are the same.
int y |= x;
int y or_eq x;

// These are the same.
int y ^= x;
int y xor_eq x;

And also bitwise not


int x = 10;

// These are the same.
int y = ~x;
int y = compl x;