Keywords: quad

Next: 4 Library Calls Up: Quad Integer Library Reference Previous: 2 Issues Contents
Subsections

- 3.1 Arithmetic Operations
- 3.2 Bitwise Operations
- 3.3 Comparisons
- 3.4 Type Conversions

# 3 Portability Macros

## 3.1 Arithmetic Operations

quad_t QADD(quad_t x, quad_t y) |
Return (x + y) |
quad_t QSUB(quad_t x, quad_t y) |
Return (x - y) |
quad_t QMUL(quad_t x, quad_t y) |
Return (x * y) |
quad_t QDIV(quad_t x, quad_t y) |
Return (x / y) |
quad_t QMOD(quad_t x, quad_t y) |
Return (x % y) |
quad_t QNEG(quad_t x) |
Return (0 - x) |

## 3.2 Bitwise Operations

quad_t QAND(quad_t x, quad_t y) |
Return (x & y) |
quad_t QOR(quad_t x, quad_t y) |
Return (x | y) |
quad_t QXOR(quad_t x, quad_t y) |
Return (x XOR y) |
quad_t QNOT(quad_t x) |
Return ( x), ie one's complement of x. |

## 3.3 Comparisons

bool QGT(quad_t x, quad_t y) |
Return (x > y) |
bool QLT(quad_t x, quad_t y) |
Return (x < y) |
bool QEQ(quad_t x, quad_t y) |
Return (x == y) |

## 3.4 Type Conversions

quad_t LTOQ(long x) |
Returns a quad_t with the lower bits filled with x. Effectively converting a long to a quad_t. |
long QTOL(quad_t x) |
Returns the lower bits of x. Truncating a quad_t into a long. |
bool QTOBOOL(quad_t x) |
Return a bool containing non-zero if x is non-zero and zero otherwise. Effectively convert a quad_t to a boolean. |
char * QTOSTR(quad_t x) |
Return a string of the base 10 representation of x. This call will allocate space on the heap to store the string, so this memory must be free()'d when no longer in use. |
quad_t STRTOQ(char *str) |
Return the quad_t representation of the base 10 number contained in str. |

Next: 4 Library Calls Up: Quad Integer Library Reference Previous: 2 Issues Contents