You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

bits.h 1.2 kB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * $Id: bits.h,v 1.3 2004/07/21 10:10:22 mclark Exp $
  3. *
  4. * Copyright Metaparadigm Pte. Ltd. 2004.
  5. * Michael Clark <michael@metaparadigm.com>
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public (LGPL)
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details: http://www.gnu.org/
  16. *
  17. */
  18. #ifndef _bits_h_
  19. #define _bits_h_
  20. #define min(x,y) ({ \
  21. typeof(x) _x = (x); \
  22. typeof(y) _y = (y); \
  23. (void) (&_x == &_y); \
  24. _x < _y ? _x : _y; })
  25. #define max(x,y) ({ \
  26. typeof(x) _x = (x); \
  27. typeof(y) _y = (y); \
  28. (void) (&_x == &_y); \
  29. _x > _y ? _x : _y; })
  30. #define hexdigit(x) (((x) <= '9') ? (x) - '0' : ((x) & 7) + 9)
  31. #define error_ptr(error) ((void*)error)
  32. #define is_error(ptr) ((unsigned long)ptr > (unsigned long)-4000L)
  33. #endif

No Description

Contributors (1)