Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * This file is part of LibParserUtils.
  3.  * Licensed under the MIT License,
  4.  *                http://www.opensource.org/licenses/mit-license.php
  5.  * Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
  6.  */
  7.  
  8. #ifndef parserutils_utils_h_
  9. #define parserutils_utils_h_
  10.  
  11. #ifndef max
  12. #define max(a,b) ((a)>(b)?(a):(b))
  13. #endif
  14.  
  15. #ifndef min
  16. #define min(a,b) ((a)<(b)?(a):(b))
  17. #endif
  18.  
  19. #ifndef SLEN
  20. /* Calculate length of a string constant */
  21. #define SLEN(s) (sizeof((s)) - 1) /* -1 for '\0' */
  22. #endif
  23.  
  24. #ifndef UNUSED
  25. #define UNUSED(x) ((x)=(x))
  26. #endif
  27.  
  28. #ifndef N_ELEMENTS
  29. #define N_ELEMENTS(s) (sizeof((s)) / sizeof((s)[0]))
  30. #endif
  31.  
  32. #ifndef ALIGN
  33. #define ALIGN(val) (((val) + 3) & ~(3))
  34. #endif
  35.  
  36. #endif
  37.