blob: 2c107cce11a42fd1dd7821613e55dcb4666d1484 [file] [log] [blame]
Michael Clarkf0d08882007-03-13 08:26:18 +00001/*
Michael Clark837240f2007-03-13 08:26:25 +00002 * $Id: bits.h,v 1.10 2006/01/30 23:07:57 mclark Exp $
Michael Clarkf0d08882007-03-13 08:26:18 +00003 *
Michael Clarkf6a6e482007-03-13 08:26:23 +00004 * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
Michael Clarkf0d08882007-03-13 08:26:18 +00005 * Michael Clark <michael@metaparadigm.com>
6 *
Michael Clarkf6a6e482007-03-13 08:26:23 +00007 * This library is free software; you can redistribute it and/or modify
8 * it under the terms of the MIT license. See COPYING for details.
Michael Clarkf0d08882007-03-13 08:26:18 +00009 *
10 */
11
12#ifndef _bits_h_
13#define _bits_h_
14
Michael Clark4504df72007-03-13 08:26:20 +000015#ifndef min
Michael Clarkf6a6e482007-03-13 08:26:23 +000016#define min(a,b) ((a) < (b) ? (a) : (b))
Michael Clark4504df72007-03-13 08:26:20 +000017#endif
Michael Clarkf0d08882007-03-13 08:26:18 +000018
Michael Clark4504df72007-03-13 08:26:20 +000019#ifndef max
Michael Clarkf6a6e482007-03-13 08:26:23 +000020#define max(a,b) ((a) > (b) ? (a) : (b))
Michael Clark4504df72007-03-13 08:26:20 +000021#endif
Michael Clarkf0d08882007-03-13 08:26:18 +000022
23#define hexdigit(x) (((x) <= '9') ? (x) - '0' : ((x) & 7) + 9)
24#define error_ptr(error) ((void*)error)
Michael Clark7b899b62007-03-13 08:26:21 +000025#define is_error(ptr) ((unsigned long)ptr > (unsigned long)-4000L)
Michael Clarkf0d08882007-03-13 08:26:18 +000026
27#endif